<?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>
    <groupId>org.jboss.jsfunit</groupId>
    <artifactId>jboss-jsfunit-examples</artifactId>
    <version>2.0.0.Beta2</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>jboss-jsfunit-examples-richfaces</artifactId>
  <packaging>war</packaging>  
  <name>Test RichFaces demo app</name>      
   
  <profiles>
    <profile>
      <id>test</id>        
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            
            <executions>
              <execution>
                <id>surefire-it</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skip>false</skip>
                  <systemProperties>
                    <property>
                      <name>cactus.contextURL</name>
                      <value>http://localhost:8080/${project.artifactId}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <wait>false</wait>
              <container>
                <systemProperties>
                <!-- snoops request and response from client side
                     result is in server.log 
                  <jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
                  <jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
                </systemProperties>
              </container>
              <configuration>                  
                <deployables>
                  <deployable>
                    <location>${project.build.directory}/${project.artifactId}.war</location>
                    <type>war</type>
                  </deployable>
                </deployables>
              </configuration>
            </configuration>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

        </plugins>
      </build>
      <activation>
        <property>
           <name>jsfunit-test-profile</name>
        </property>
      </activation>
    </profile>
    
    <profile>
      <id>jee5</id>
      <dependencies>
         <dependency>
           <groupId>org.richfaces.samples</groupId>
           <artifactId>richfaces-demo</artifactId>
           <version>${richfaces-version}</version>
           <classifier>jee5</classifier>
           <type>war</type>
           <scope>runtime</scope>
         </dependency>
      </dependencies>
    </profile>   
    
    <profile>
      <id>jboss6x</id>
      <dependencies>
         <dependency>
           <groupId>org.richfaces.samples</groupId>
           <artifactId>richfaces-demo-jsf2</artifactId>
           <version>${richfaces-version}</version>
           <classifier>jee5</classifier>
           <type>war</type>
           <scope>runtime</scope>
         </dependency>
      </dependencies>
    </profile>  
    
    <profile>
      <id>tomcat6x</id>
      <dependencies>
         <dependency>
           <groupId>org.richfaces.samples</groupId>
           <artifactId>richfaces-demo</artifactId>
           <version>${richfaces-version}</version>
           <classifier>tomcat6</classifier>
           <type>war</type>
           <scope>runtime</scope>
         </dependency>
      </dependencies>
    </profile>    
    
    <profile>
       <id>myfaces1.1</id>
       <dependencies>
         <dependency>
           <groupId>org.richfaces.samples</groupId>
           <artifactId>richfaces-demo</artifactId>
           <version>${richfaces-version}</version>
           <type>war</type>
           <scope>runtime</scope>
         </dependency>
         <dependency>
           <groupId>javax.el</groupId>
           <artifactId>el-api</artifactId>
           <version>1.0</version>
           <scope>compile</scope>
         </dependency>  
         <dependency>
           <groupId>com.sun.el</groupId>
           <artifactId>el-ri</artifactId>
           <version>1.0</version>
           <scope>compile</scope>
         </dependency> 
      </dependencies>
      <activation>
         <property>
           <name>jsfunit-test-profile</name>
         </property>
       </activation>
    </profile>
  </profiles>

  <dependencies>    
  
    <dependency>
      <groupId>org.jboss.jsfunit</groupId>
      <artifactId>jsfunit-cactus</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
      <exclusions>
         <exclusion>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
         </exclusion>
         <exclusion>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
         </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.jboss.jsfunit</groupId>
      <artifactId>jboss-jsfunit-richfaces</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>
    
    <dependency>
      <groupId>org.richfaces.ui</groupId>
      <artifactId>richfaces-ui</artifactId>
      <scope>compile</scope>
    </dependency>
    
    <dependency>
      <groupId>org.richfaces.framework</groupId>
      <artifactId>richfaces-impl</artifactId>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-impl</artifactId>
      <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.myfaces.core</groupId>
      <artifactId>myfaces-api</artifactId>
      <scope>provided</scope>
    </dependency>
        
    <!--
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>
-->
    <dependency>
       <groupId>jboss.web</groupId>
       <artifactId>servlet-api</artifactId>
       <scope>provided</scope>
    </dependency>
    
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
      <scope>compile</scope>
    </dependency>
  </dependencies>

  <!-- repo for el-ri -->
  <repositories>
    <repository>
      <id>java.net</id>
      <url>http://download.java.net/maven/2</url>
    </repository>
  </repositories>
  
  <build>
    <sourceDirectory>src/test/java</sourceDirectory>
    <testSourceDirectory>src/test/java</testSourceDirectory>
    
    <plugins>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <directory>${basedir}/src/test/java/org/jboss/jsfunit/test/richfaces</directory>
              <targetPath>testsrc</targetPath>
              <includes>
                <include>*.java</include>
              </includes>
            </resource>
          </webResources>
          <dependentWarExcludes>/WEB-INF/lib/jstl-1.0.jar,WEB-INF/lib/commons-collections-3.2.jar,WEB-INF/lib/nekohtml-1.9.6.jar,WEB-INF/lib/commons-collections-3.1.jar,WEB-INF/lib/commons-beanutils-1.7.0.jar</dependentWarExcludes>
        </configuration>
      </plugin>
      
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
          <excludes>
            <exclude>**/AjaxPollTest.java</exclude>
            <exclude>**/RichInplaceInputTest.java</exclude>
            <exclude>**/RichDataFilterSliderTest.java</exclude>
            <exclude>**/RichSuggestionBoxTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>  
  </build>

</project>
