<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <artifactId>seam-persistence-parent</artifactId>
      <groupId>org.jboss.seam.persistence</groupId>
      <version>3.0.0.CR2</version>
      <relativePath>../../pom.xml</relativePath>
   </parent>

   <artifactId>seam-persistence-tests-jbossas</artifactId>
   <packaging>jar</packaging>

   <name>Seam Persistence Tests: JBoss AS</name>
   <!-- url required for JAR Manifest -->
   <url>${project.parent.url}</url> 

   <properties>
      <jboss.home>${env.JBOSS_HOME}</jboss.home>
      <jboss.domain>default</jboss.domain>
   </properties>

   <prerequisites>
      <maven>3.0</maven>
   </prerequisites>

   <dependencies>

      <!-- including whole API breaks tests -->
      <!--
      <dependency>
         <groupId>org.jboss.spec</groupId>
         <artifactId>jboss-javaee-6.0</artifactId>
         <type>pom</type>
         <scope>provided</scope>
      </dependency>
      -->

      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.0-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.spec.javax.interceptor</groupId>
         <artifactId>jboss-interceptors-api_1.1_spec</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>org.jboss.spec.javax.el</groupId>
        <artifactId>jboss-el-api_2.2_spec</artifactId>
        <scope>provided</scope>
      </dependency>

      <dependency>
        <groupId>org.jboss.spec.javax.transaction</groupId>
        <artifactId>jboss-transaction-api_1.1_spec</artifactId>
        <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.seam.persistence</groupId>
         <artifactId>seam-persistence-api</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.seam.persistence</groupId>
         <artifactId>seam-persistence-impl</artifactId>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-api</artifactId>
         <scope>provided</scope>
      </dependency>

      <dependency>
         <groupId>org.slf4j</groupId>
         <artifactId>slf4j-simple</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.weld</groupId>
         <artifactId>weld-core</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.jboss.seam.solder</groupId>
         <artifactId>seam-solder</artifactId>
      </dependency>

      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-search</artifactId>
         <optional>true</optional>
      </dependency>

      <dependency>
         <groupId>org.jboss.arquillian</groupId>
         <artifactId>arquillian-junit</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.seam.persistence</groupId>
         <artifactId>seam-persistence-tests-base</artifactId>
      </dependency>

   </dependencies>

   <build>
      <plugins>
         <!--
            skip unit test run, tests to be executed during
            integration-test
         -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <skip>true</skip>
            </configuration>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <profile>
         <id>jbossas-managed-6</id>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <dependencies>

            <dependency>
               <groupId>org.jboss.arquillian.container</groupId>
               <artifactId>arquillian-jbossas-managed-6</artifactId>
            </dependency>

            <dependency>
               <groupId>org.jboss.jbossas</groupId>
               <artifactId>jboss-server-manager</artifactId>
            </dependency>

            <dependency>
               <groupId>org.jboss.jbossas</groupId>
               <artifactId>jboss-as-client</artifactId>
               <type>pom</type>
            </dependency>

         </dependencies>
         <build>
            <testResources>
               <testResource>
                  <directory>src/test/resources</directory>
               </testResource>
               <testResource>
                  <directory>src/test/resources-jbossas</directory>
               </testResource>
            </testResources>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-enforcer-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>enforce-property</id>
                        <goals>
                           <goal>enforce</goal>
                        </goals>
                        <configuration>
                           <rules>
                              <requireProperty>
                                 <property>jboss.home</property>
                              </requireProperty>
                           </rules>
                           <fail>true</fail>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <skip>true</skip>
                  </configuration>
                  <executions>
                     <execution>
                        <id>surefire-it</id>
                        <phase>integration-test</phase>
                        <goals>
                           <goal>test</goal>
                        </goals>
                        <configuration>
                           <skip>false</skip>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>jbossas-remote-6</id>
         <dependencies>
            <dependency>
               <groupId>org.jboss.arquillian.container</groupId>
               <artifactId>arquillian-jbossas-remote-6</artifactId>
            </dependency>
            <!-- need for org.jnp.interfaces.NamingContextFactory -->
            <dependency>
               <groupId>org.jboss.jbossas</groupId>
               <artifactId>jboss-as-client</artifactId>
               <type>pom</type>
            </dependency>
         </dependencies>
         <build>
            <testResources>
               <testResource>
                  <directory>src/test/resources</directory>
               </testResource>
               <testResource>
                  <directory>src/test/resources-jbossas</directory>
               </testResource>
            </testResources>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <skip>true</skip>
                  </configuration>
                  <executions>
                     <execution>
                        <id>surefire-it</id>
                        <phase>integration-test</phase>
                        <goals>
                           <goal>test</goal>
                        </goals>
                        <configuration>
                           <skip>false</skip>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
         
      <profile>
         <id>code-coverage</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>deploy-emma-jar</id>
                        <phase>process-test-sources</phase>
                        <goals>
                           <goal>copy</goal>
                        </goals>
                        <configuration>
                           <artifactItems>
                              <artifactItem>
                                 <groupId>emma</groupId>
                                 <artifactId>emma</artifactId>
                                 <version>${emma.version}</version>
                                 <type>jar</type>
                                 <overWrite>true</overWrite>
                                 <outputDirectory>${env.JBOSS_HOME}/server/default/lib</outputDirectory>
                              </artifactItem>
                           </artifactItems>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.sonatype.maven.plugin</groupId>
                  <artifactId>emma4it-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>merge</id>
                        <phase>post-integration-test</phase>
                        <goals>
                           <goal>merge</goal>
                        </goals>
                        <configuration>
                           <searchPath>${project.parent.build.directory}/../</searchPath>
                        </configuration>
                     </execution>
                     <execution>
                        <id>report</id>
                        <phase>verify</phase>
                        <goals>
                           <goal>report</goal>
                        </goals>
                        <configuration>
                           <sourceSets>
                              <sourceSet>
                                 <directory>${project.parent.build.directory}/../impl/src/main/java</directory>
                              </sourceSet>
                           </sourceSets>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-antrun-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>retrieve-coverage-files</id>
                        <phase>post-integration-test</phase>
                        <goals>
                           <goal>run</goal>
                        </goals>
                        <configuration>
                           <tasks>
                              <copy file="${env.JBOSS_HOME}/bin/coverage.ec" todir="${basedir}" />
                              <copy file="${project.parent.build.directory}/../impl/target/coverage.em" todir="${basedir}" />
                           </tasks>
                        </configuration>
                     </execution>
                  </executions>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>
