<?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-hellojsf</artifactId>
    <version>1.2.0.Final</version>
  </parent>

  <modelVersion>4.0.0</modelVersion>
  <artifactId>jboss-jsfunit-examples-hellojsf-pathmapped</artifactId>
  <packaging>war</packaging>
  <name>HelloJSF JSFUnit test with path-mapped FacesServlet</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/${artifactId}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
          </plugin>
          
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <wait>false</wait>  
              <configuration>                  
                <deployables>
                  <deployable>
                    <location>${project.build.directory}/${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>
  </profiles>
  
  <dependencies>

    <dependency>
      <groupId>org.jboss.jsfunit</groupId>
      <artifactId>jboss-jsfunit-core</artifactId>
      <version>${project.version}</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.jsfunit</groupId>
      <artifactId>jboss-jsfunit-examples-hellojsf-webapp</artifactId>
      <version>${project.version}</version>
      <type>war</type>
      <scope>runtime</scope>
    </dependency>
  </dependencies>      

  <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>
          <dependentWarExcludes>WEB-INF/web.xml,index.*</dependentWarExcludes>   
          <webResources>
            <resource>
              <directory>${basedir}/src/test/java/org/jboss/jsfunit/example/hellojsf</directory>
              <includes>
                <include>**/*.java</include>
              </includes>
            </resource>
            <resource>
              <directory>${basedir}/src/resources</directory>
              <targetPath>WEB-INF</targetPath> 
              <filtering>true</filtering> 
            </resource>
            <resource>
              <directory>${basedir}/src/resources</directory>
              <targetPath>META-INF</targetPath>
              <filtering>true</filtering>
            </resource> 
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>  
  </build>
</project>
