<?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.
-->
<!-- $Rev$ $Date$ -->
<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.geronimo</groupId>
        <artifactId>geronimo</artifactId>
        <version>2.0.3-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <groupId>org.apache.geronimo.testsuite</groupId>
    <artifactId>testsuite</artifactId>
    <name>Geronimo TestSuite</name>
    <packaging>pom</packaging>
    <description>
        Geronimo integration testsuite. This contains 2 profiles, default and child.
        The default profile is used by the top level suites directly under this. The child profile is used by the test poms under the suites.
        This pom defines the basic dependencies needed by most suites.
        The start-selenium, start-server, invoke, and stop-server goals are globally configured here in the pluginManagement sections.
        They just need to be bound in the suites where needed and appropriate.
        The test poms under the suites should have this pom as their parent and set their relativePath appropriately
        The test poms under the suites inherit an empty 'child' profile from here. But any other build executions within the test poms should all be inside a 'child' profile.
    </description>
    <dependencyManagement>
        <!-- mainatain the versioning of all dependencies in this one common location here. -->
        <dependencies>
            <!-- testsupport-selenium brings with it testsupport-common, selenium and testng dependencies -->
            <dependency>
                <groupId>org.apache.geronimo.testsupport</groupId>
                <artifactId>testsupport-selenium</artifactId>
                <version>${version}</version>
                <scope>compile</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.geronimo.testsupport</groupId>
            <artifactId>testsupport-selenium</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <modules>
        <module>console-testsuite</module>
        <module>corba-testsuite</module>
        <module>deployment-testsuite</module>
        <module>enterprise-testsuite</module>
        <module>web-testsuite</module>
        <module>webservices-testsuite</module>
    </modules>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.geronimo.plugins</groupId>
                    <artifactId>testsuite-maven-plugin</artifactId>
                    <version>${version}</version>
                </plugin>
                <plugin>
                    <artifactId>maven-ear-plugin</artifactId>
                    <configuration>
                        <resourcesDir>${project.build.outputDirectory}</resourcesDir>
                    </configuration>
                </plugin>
                <!--
                     FIXME: Need to reset the default values here since our parent sets up wars
                     for use with jspc.  Remove once parent pom has been fixed.
                 -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <configuration>
                        <webXml>${pom.basedir}/src/main/webapp/WEB-INF/web.xml</webXml>
                        <webResources>
                            <resource>
                                <directory>${pom.basedir}/src/main/webapp</directory>
                                <filtering>true</filtering>
                            </resource>
                            <resource>
                                <directory>${project.build.outputDirectory}</directory>
                            </resource>
                        </webResources>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.3</version>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                    <executions>
                        <execution>
                            <id>test</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <skip>true</skip>
                            </configuration>
                        </execution>
                        <execution>
                            <id>integration</id>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <testFailureIgnore>true</testFailureIgnore>
                                <skip>false</skip>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.geronimo.genesis.plugins</groupId>
                    <artifactId>maven-maven-plugin</artifactId>
                    <configuration>
                        <fileset>
                            <basedir>${pom.basedir}</basedir>
                            <includes>
                                <include>*/pom.xml</include>
                            </includes>
                        </fileset>
                        <profiles>
                            <profile>child</profile>
                        </profiles>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>integration-test</phase>
                            <goals>
                                <goal>invoke</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>site-deploy</id>
                            <phase>site-deploy</phase>
                            <goals>
                                <goal>invoke</goal>
                            </goals>
                            <configuration>
                                <goals>
                                    <goal>site-deploy</goal>
                                </goals>
                                <parameters>
                                    <buildNumber>${buildNumber}</buildNumber>
                                </parameters>
                            </configuration>
                        </execution>
                        <execution>
                            <id>clean</id>
                            <phase>clean</phase>
                            <goals>
                                <goal>invoke</goal>
                            </goals>
                            <configuration>
                                <goals>
                                    <goal>clean</goal>
                                </goals>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.geronimo.plugins</groupId>
                    <artifactId>geronimo-maven-plugin</artifactId>
                    <configuration>
                        <reporters>
                            <reporter implementation="org.apache.geronimo.mavenplugins.geronimo.reporting.SurefireReporter">
                                <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
                            </reporter>
                        </reporters>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>selenium-maven-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>start-server</id>
                            <phase>pre-integration-test</phase>
                            <goals>
                                <goal>start-server</goal>
                            </goals>
                            <configuration>
                                <logOutput>true</logOutput>
                                <background>true</background>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <distributionManagement>
        <site>
            <id>website</id>
            <url>scp://people.apache.org/www/people.apache.org/builds/geronimo/server/testsuite/${buildNumber}</url>
        </site>
    </distributionManagement>
    

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.geronimo.plugins</groupId>
                <artifactId>testsuite-maven-plugin</artifactId>
            </plugin>
            <!-- This should actually be configured in genesis:project-config -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <source>1.5</source>
                </configuration>
            </plugin>
        </plugins>
    </reporting>
    
    <profiles>
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <pluginManagement>
                    <plugins>

                        <plugin>
                            <groupId>org.apache.geronimo.plugins</groupId>
                            <artifactId>geronimo-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>start-server</id>
                                    <phase>pre-integration-test</phase>
                                    <goals>
                                        <goal>start-server</goal>
                                    </goals>
                                    <configuration>
                                        <logOutput>true</logOutput>
                                        <background>true</background>
                                        <verifyTimeout>300</verifyTimeout>
                                        <optionSets>
                                            <optionSet>
                                                <id>default</id>
                                                <options>
                                                   <option>-XX:MaxPermSize=128m</option>
                                                </options>
                                            </optionSet>
                                        </optionSets>
                                    </configuration>
                                </execution>
                                <execution>
                                    <id>stop-server</id>
                                    <phase>install</phase>
                                    <goals>
                                        <goal>stop-server</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
                
                <plugins>
                    <plugin>
                        <groupId>org.apache.geronimo.plugins</groupId>
                        <artifactId>testsuite-maven-plugin</artifactId>
                        <inherited>false</inherited>
                        <executions>
                            <execution>
                                <id>summarize</id>
                                <phase>post-site</phase>
                                <goals>
                                    <goal>summarize</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        
        <profile>
            <id>headless</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.codehaus.mojo</groupId>
                            <artifactId>selenium-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>xvfb</id>
                                    <phase>process-test-sources</phase>
                                    <goals>
                                        <goal>xvfb</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        

        <profile>
            <id>common</id>
            <build>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.geronimo.plugins</groupId>
                            <artifactId>geronimo-maven-plugin</artifactId>
                            <executions>
                                <execution>
                                    <id>start-server</id>
                                    <phase>pre-integration-test</phase>
                                    <goals>
                                        <goal>start-server</goal>
                                    </goals>
                                    <configuration>
                                        <logOutput>true</logOutput>
                                        <background>true</background>
                                        <installDirectory>${basedir}/../server</installDirectory>
                                    </configuration>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
        
        <profile>
            <id>child</id>
        </profile>
    </profiles>

     <repositories>
        <!--
        NOTE: This is useful to run the testsuite on any machine, independent of the Geronimo build.
        scm location svn co https://svn.apache.org/repos/asf/geronimo/server/trunk/testsuite
        -->
        <repository>
            <id>apache-snapshots</id>
            <name>Apache Snapshots Repository</name>
            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
            <layout>default</layout>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
                <checksumPolicy>ignore</checksumPolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
     </repositories>
</project>
