<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">
   <parent>
      <artifactId>webbeans-parent</artifactId>
      <groupId>org.jboss.webbeans</groupId>
      <version>1.0.0.PREVIEW2.SP2</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jboss.webbeans</groupId>
   <artifactId>webbeans-jboss-tck-runner</artifactId>
   <name>JSR-299 TCK runner for JBoss AS</name>
   <description>Aggregates dependencies and run's the JSR-299 TCK on JBoss AS</description>
   
   <dependencies>

      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>jsr299-api</artifactId>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>webbeans-core</artifactId>
      </dependency>

      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>webbeans-porting-package</artifactId>
      </dependency>
      
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <classifier>jdk15</classifier>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.test-harness</groupId>
         <artifactId>jboss-test-harness-jboss-as-51</artifactId>
      </dependency>
         
      
   </dependencies>
   
   <build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
               <execution>
                  <id>copy</id>
                  <phase>process-resources</phase>
                  <goals>
                     <goal>copy</goal>
                  </goals>
                  <configuration>
                     <stripVersion>true</stripVersion>
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.jboss.jsr299.tck</groupId>
                           <artifactId>jsr299-tck-impl</artifactId>
                           <type>xml</type>
                           <classifier>suite</classifier>
                           <overWrite>true</overWrite>
                        </artifactItem>
                        <artifactItem>
                           <groupId>org.jboss.webbeans</groupId>
                           <artifactId>webbeans-porting-package</artifactId>
                           <overWrite>true</overWrite>
                           <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                           <groupId>org.jboss.webbeans</groupId>
                           <artifactId>webbeans-core-test</artifactId>
                           <overWrite>true</overWrite>
                           <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                        </artifactItem>
                        <artifactItem>
                           <groupId>javax.el</groupId>
                           <artifactId>el-ri</artifactId>
                           <overWrite>true</overWrite>
                           <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                        </artifactItem>
                     </artifactItems>
                  </configuration>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <suiteXmlFiles>
                  <suiteXmlFile>${project.build.directory}/dependency/jsr299-tck-impl-suite.xml</suiteXmlFile>
               </suiteXmlFiles>
               <argLine>-Xmx128m</argLine>
               <forkMode>once</forkMode>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <executions>
               <execution>
                  <id>generate-test-report</id>
                  <phase>test</phase>
                  <goals>
                     <goal>report-only</goal>
                  </goals>
               </execution>
            </executions>
            <configuration>
               <outputDirectory>${project.build.directory}/surefire-reports</outputDirectory>
               <outputName>test-report</outputName>
            </configuration>
         </plugin>
      </plugins>
   </build>
   
   <profiles>
      <profile>
         <id>run</id>
         <activation>
            <property>
               <name>!osgi.bundles.defaultStartLevel</name>
            </property>
         </activation>
         <dependencies>
                  
		      <dependency>
		         <groupId>org.jboss.jsr299.tck</groupId>
		         <artifactId>jsr299-tck-impl</artifactId>
		      </dependency>
		      
         </dependencies>
      </profile>
      <profile>
         <id>incontainer-debug</id>
         <activation>
            <property>
               <name>incontainer-debug</name>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <suiteXmlFiles>
                        <suiteXmlFile>${project.build.directory}/dependency/jsr299-tck-impl-suite.xml</suiteXmlFile>
                     </suiteXmlFiles>
                     <systemProperties>
                        <property>
                           <name>org.jboss.testharness.standalone</name>
                           <value>false</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.container.extraConfigurationDir</name>
                           <value>../jboss-as</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.container.forceRestart</name>
                           <value>false</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.libraryDirectory</name>
                           <value>target/dependency/lib</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.runIntegrationTests</name>
                           <value>true</value>
                        </property>
                     </systemProperties>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
      <profile>
         <id>incontainer</id>
         <activation>
            <property>
               <name>incontainer</name>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <suiteXmlFiles>
                        <suiteXmlFile>${project.build.directory}/dependency/jsr299-tck-impl-suite.xml</suiteXmlFile>
                     </suiteXmlFiles>
                     <systemProperties>
                        <property>
                           <name>org.jboss.testharness.standalone</name>
                           <value>false</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.container.extraConfigurationDir</name>
                           <value>../jboss-as</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.container.forceRestart</name>
                           <value>true</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.runIntegrationTests</name>
                           <value>true</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.libraryDirectory</name>
                           <value>target/dependency/lib</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.outputDirectory</name>
                           <value>target</value>
                        </property>
                     </systemProperties>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
      <profile>
         <id>write-artifacts-to-disk</id>
         <activation>
            <property>
               <name>dumpArtifacts</name>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.codehaus.mojo</groupId>
                  <artifactId>exec-maven-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>generate-jsr-299-artifacts</id>
                        <phase>generate-test-sources</phase> 
                        <goals>
                        <goal>java</goal>
                        </goals>
                     </execution>
                  </executions>
                  <configuration>
                     <mainClass>org.jboss.testharness.api.TCK</mainClass>
                     <systemProperties>
                        <systemProperty>
                           <key>dumpArtifacts</key>
                           <value>true</value>
                        </systemProperty>
                        <systemProperty>
                           <key>org.jboss.testharness.outputDirectory</key>
                           <value>target/jsr299-artifacts</value>
                        </systemProperty>
                        <systemProperty>
                           <key>org.jboss.testharness.libraryDirectory</key>
                           <value>target/dependency/lib</value>
                        </systemProperty>
                     </systemProperties>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
   
   

</project>
