<?xml version="1.0" encoding="UTF-8"?>
<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-servlet-parent</artifactId>
      <groupId>org.jboss.webbeans.servlet</groupId>
      <version>1.0.0.CR1</version>
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jboss.webbeans.servlet</groupId>
   <artifactId>webbeans-servlet-test</artifactId>
   <version>1.0.0.CR1</version>
   <packaging>jar</packaging>
   <name>Web Beans Servlet Integration Tests</name>
   <url>http://www.seamframework.org/WebBeans</url>
    
   <dependencies>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <scope>test</scope>
         <classifier>jdk15</classifier>
         <exclusions>
            <exclusion>
               <artifactId>junit</artifactId>
               <groupId>junit</groupId>
            </exclusion>
         </exclusions>
      </dependency>
   
      <dependency>
         <groupId>javax.servlet</groupId>
         <artifactId>servlet-api</artifactId>
         <scope>provided</scope>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>webbeans-core-test</artifactId>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.test-harness</groupId>
         <artifactId>jboss-test-harness</artifactId>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.test-harness</groupId>
         <artifactId>jboss-test-harness-tomcat</artifactId>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>webbeans-core</artifactId>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>org.jboss.webbeans</groupId>
         <artifactId>webbeans-spi</artifactId>
         <scope>test</scope>
      </dependency>
      
      <dependency>
         <groupId>javax.el</groupId>
         <artifactId>el-api</artifactId>
         <scope>test</scope>
      </dependency>
      
       <dependency>
         <groupId>javax.el</groupId>
         <artifactId>el-ri</artifactId>
         <scope>test</scope>
      </dependency>
  
      <dependency>
         <groupId>org.apache.tomcat</groupId>
         <artifactId>catalina</artifactId>
         <scope>provided</scope>
         <exclusions>
            <exclusion>
               <groupId>org.apache.tomcat</groupId>
               <artifactId>servlet-api</artifactId>
            </exclusion>
         </exclusions>
      </dependency>    
      
      <dependency>
      	<groupId>commons-httpclient</groupId>
    		<artifactId>commons-httpclient</artifactId>
    	</dependency>
   
   </dependencies>
   
   <build>
      <defaultGoal>test</defaultGoal>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <suiteXmlFiles>
                  <suiteXmlFile>unit-tests.xml</suiteXmlFile>
               </suiteXmlFiles>
            </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>incontainer</id>
         <activation>
            <property>
               <name>incontainer</name>
            </property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-dependency-plugin</artifactId>
                  <executions>
                     <execution>
                        <id>copy</id>
                        <phase>generate-test-sources</phase>
                        <goals>
                           <goal>copy</goal>
                        </goals>
                        <configuration>
                           <stripVersion>true</stripVersion>
                           <artifactItems>
                              <artifactItem>
                                 <groupId>org.jboss.test-harness</groupId>
                                 <artifactId>jboss-test-harness</artifactId>
                                 <overWrite>true</overWrite>
                                 <outputDirectory>${project.build.directory}/classes/lib</outputDirectory>
                              </artifactItem>
                              <artifactItem>
                                 <groupId>javax.el</groupId>
                                 <artifactId>el-ri</artifactId>
                                 <overWrite>true</overWrite>
                                 <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                              </artifactItem>
                              <artifactItem>
                                 <groupId>org.jboss.webbeans.servlet</groupId>
                                 <artifactId>webbeans-servlet</artifactId>
                                 <overWrite>true</overWrite>
                                 <outputDirectory>${project.build.directory}/dependency/lib</outputDirectory>
                              </artifactItem>
                              <artifactItem>
                                 <groupId>log4j</groupId>
                                 <artifactId>log4j</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>unit-tests.xml</suiteXmlFile>
                     </suiteXmlFiles>
                     <systemProperties>
                        <property>
                           <name>org.jboss.testharness.standalone</name>
                           <value>false</value>
                        </property>
                        <property>
                           <name>org.jboss.testharness.container.extraConfigurationDir</name>
                           <value>../</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-test-artifacts</id>
                        <phase>generate-test-sources</phase> 
                        <goals>
                        <goal>java</goal>
                        </goals>
                     </execution>
                  </executions>
                  <configuration>
                     <mainClass>org.jboss.testharness.api.TCK</mainClass>
                     <classpathScope>test</classpathScope>
                     <systemProperties>
                        <systemProperty>
                           <key>dumpArtifacts</key>
                           <value>true</value>
                        </systemProperty>
                        <systemProperty>
                           <key>org.jboss.testharness.outputDirectory</key>
                           <value>target/test-artifacts</value>
                        </systemProperty>
                        <systemProperty>
                           <key>org.jboss.testharness.libraryDirectory</key>
                           <value>target/dependency/lib</value>
                        </systemProperty>
                     </systemProperties>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>

</project>
