<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
-->
<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>
    <groupId>org.apache.myfaces.tobago</groupId>
    <artifactId>tobago-example</artifactId>
    <version>2.5.0</version>
  </parent>
  <artifactId>tobago-example-test</artifactId>
  <packaging>war</packaging>
  <name>Tobago Example Test</name>
  <description>A web application to provide test pages for running automated tests.</description>
  <build>
    <finalName>tobago-example-test</finalName>
    <plugins>
<!--
      <plugin>
        <groupId>org.apache.myfaces.tobago</groupId>
        <artifactId>tobago-theme-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
-->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <webResources>
            <resource>
              <targetPath>src</targetPath>
              <directory>${basedir}/src/main/java</directory>
            </resource>
          </webResources>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>xml-maven-plugin</artifactId>
        <version>1.0.2</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <goals>
              <goal>transform</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <transformationSets>
            <transformationSet>
              <dir>src/main/webapp</dir>
              <outputDir>${project.build.directory}/tobago-example-test</outputDir>
              <!-- not nice, but works... -->
              <stylesheet>../tobago-example-demo/src/main/xslt/facelet2jsp.xsl</stylesheet>
              <includes>
                <include>**/*.xhtml</include>
              </includes>
              <fileMappers>
                <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.RegExpFileMapper">
                  <pattern>(.*).xhtml</pattern>
                  <replacement>$1.jspx</replacement>
                </fileMapper>
              </fileMappers>
            </transformationSet>
          </transformationSets>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>false</skip>
          <excludes>
            <exclude>**/*SeleniumTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>

    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-example-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-sandbox</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-fileupload</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>oro</groupId>
      <artifactId>oro</artifactId>
      <version>2.0.8</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.seleniumhq.selenium</groupId>
      <artifactId>selenium-java</artifactId>
      <version>2.53.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.myfaces.tobago</groupId>
      <artifactId>tobago-core</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <!-- DeltaSpike/CDI -->
<!--
    <dependency>
      <groupId>org.apache.deltaspike.modules</groupId>
      <artifactId>deltaspike-jsf-module-impl</artifactId>
      <version>1.3.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-jcdi_1.0_spec</artifactId>
      <version>1.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.geronimo.specs</groupId>
      <artifactId>geronimo-atinject_1.0_spec</artifactId>
      <version>1.0</version>
    </dependency>
-->
  </dependencies>
  <profiles>
    <profile>
      <id>integration-test</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>false</skip>
              <excludes>
                <exclude>**/*SeleniumTest.java</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <id>integration-tests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <skip>false</skip>
                  <excludes>
                    <exclude>none</exclude>
                  </excludes>
                  <includes>
                    <include>**/*SeleniumTest.java</include>
                  </includes>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!--
                <plugin>
                  <groupId>org.codehaus.cargo</groupId>
                  <artifactId>cargo-maven2-plugin</artifactId>
                  <version>1.0-beta-2</version>
                  <configuration>
                    <wait>false</wait>
                    <container>
                      <containerId>tomcat5x</containerId>
                      <zipUrlInstaller>
                        <url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.zip</url>
                      </zipUrlInstaller>
                    </container>
                  </configuration>

                  <executions>
                    <execution>
                      <id>start-container</id>
                      <phase>pre-integration-test</phase>
                      <goals>
                        <goal>start</goal>
                        <goal>deploy</goal>
                      </goals>
                    </execution>

                    <execution>
                      <id>stop-container</id>
                      <phase>post-integration-test</phase>
                      <goals>
                        <goal>stop</goal>
                      </goals>
                    </execution>
                  </executions>
                </plugin>
          -->
          <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <configuration>
              <httpConnector>
                <port>8080</port>
              </httpConnector>
              <stopKey>stopKey</stopKey>
              <stopPort>9999</stopPort>
            </configuration>
            <executions>
              <execution>
                <id>start-jetty</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>deploy-war</goal>
                </goals>
                <configuration>
                  <daemon>true</daemon>
                </configuration>
              </execution>
              <execution>
                <id>stop-jetty</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>selenium-maven-plugin</artifactId>
            <version>2.3</version>
            <executions>
              <execution>
                <id>start</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start-server</goal>
                </goals>
                <configuration>
                  <background>true</background>
                  <logOutput>true</logOutput>
                  <!--multiWindow>true</multiWindow-->
                </configuration>
              </execution>

              <execution>
                <id>stop</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop-server</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!--
       mvn package cargo:start -Ptomcat6x
      -->
      <id>tomcat6x</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.8.5</version>
            <configuration>
              <container>
                <containerId>tomcat6x</containerId>
                <zipUrlInstaller>
                  <url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.33/bin/apache-tomcat-6.0.33.zip</url>
                  <installDir>${project.build.directory}/tomcat6</installDir>
                </zipUrlInstaller>
              </container>
              <configuration>
                <home>${project.build.directory}/tomcat6/container</home>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!--
       mvn package cargo:start -Ptomcat5x
      -->
      <id>tomcat5x</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.8.5</version>
            <configuration>
              <container>
                <containerId>tomcat5x</containerId>
                <zipUrlInstaller>
                  <url>http://archive.apache.org/dist/tomcat/tomcat-5/v5.5.33/bin/apache-tomcat-5.5.33.zip</url>
                  <installDir>${project.build.directory}/tomcat5</installDir>
                </zipUrlInstaller>
              </container>
              <configuration>
                <home>${project.build.directory}/tomcat5/container</home>
              </configuration>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

  <properties>
    <tobago.basedir>${project.basedir}/../..</tobago.basedir>
  </properties>
</project>
