<?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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.atlassian.oauth</groupId>
        <artifactId>atlassian-oauth</artifactId>
        <version>1.0.rc2</version>
    </parent>

    <artifactId>atlassian-oauth-integration-tests</artifactId>
    <packaging>war</packaging>
    <name>Atlassian OAuth - Integration Tests</name>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>install-plugins</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>
                                ${project.build.directory}/${project.build.finalName}/WEB-INF/plugins
                            </outputDirectory>
                            <includeScope>provided</includeScope>
                            <includeTypes>jar,bundle</includeTypes>
                            <excludeTransitive>true</excludeTransitive>
                            <excludeArtifactIds>atlassian-plugins-refimpl,jsp-api,servlet-api,sal-api</excludeArtifactIds>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <!--
                    Override version: previous versions had a bug that prevented command-line
                    property overrides from being detected when filtering web resources
                -->
                <version>2.1-alpha-2</version>
                <configuration>
                    <overlays>
                        <overlay>
                            <groupId>com.atlassian.refapp</groupId>
                            <artifactId>atlassian-refapp</artifactId>
                            <excludes>
                                <exclude>WEB-INF/plugins/atlassian-oauth*</exclude>
                            </excludes>
                        </overlay>
                    </overlays>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.0</version>
                <executions>
                    <execution>
                        <id>start-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <wait>${cargo.wait}</wait>
                            <configuration>
                                <home>${project.build.directory}/tomcat5x</home>
                                <deployables>
                                    <deployable>
                                        <properties>
                                            <context>${context}</context>
                                        </properties>
                                    </deployable>
                                </deployables>
                                <properties>
                                    <cargo.servlet.port>${http.port}</cargo.servlet.port>
                                    <cargo.rmi.port>${rmi.port}</cargo.rmi.port>
                                    <cargo.jvmargs>${jvmargs}</cargo.jvmargs>
                                </properties>
                            </configuration>
                        </configuration>
                    </execution>
                    <execution>
                        <id>stop-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <container>
                        <containerId>tomcat5x</containerId>
                        <zipUrlInstaller>
                            <url>${tomcat.installer.url}</url>
                            <installDir>${project.build.directory}</installDir>
                        </zipUrlInstaller>
                        <output>${project.build.directory}/output.log</output>
                        <log>${project.build.directory}/cargo-log.log</log>
                        <systemProperties>
                            <baseurl>${baseurl}</baseurl>
                            <!-- <plugin.resource.directories>
                                                            service-provider-plugin/src/main/resources/,consumer-plugin/src/main/resources/
                                                        </plugin.resource.directories> -->
                        </systemProperties>
                    </container>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>${maven.test.unit.skip}</skip>
                    <excludes>
                        <exclude>it/**/*</exclude>
                        <exclude>**/*Abstract*</exclude>
                        <exclude>**/*Mock*</exclude>
                        <exclude>**/*$*</exclude>
                    </excludes>
                    <systemProperties>
                        <property>
                            <name>baseurl</name>
                            <value>${baseurl}</value>
                        </property>
                    </systemProperties>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>${maven.test.it.skip}</skip>
                            <excludes>
                                <exclude>none</exclude>
                                <exclude>**/*Abstract*</exclude>
                                <exclude>**/*Mock*</exclude>
                                <exclude>**/*$*</exclude>
                            </excludes>
                            <includes>
                                <include>it/**/*java</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>debug</id>
            <properties>
                <cargo.wait>true</cargo.wait>
                <debug.suspend>n</debug.suspend>
                <jvmargs>-agentlib:jdwp=server=y,transport=dt_socket,address=${debugger.port},suspend=${debug.suspend}</jvmargs>
                <maven.test.skip>true</maven.test.skip>
            </properties>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.refapp</groupId>
            <artifactId>atlassian-refapp</artifactId>
            <version>2.3.3</version>
            <type>war</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <!--
            These are plugins that we want to install in the refimpl container.  They're marked as scope provided so the
            Maven WAR plugin doesn't try to package them in WEB-INF/lib.
        -->
        <dependency>
            <groupId>com.atlassian.bundles</groupId>
            <artifactId>google-collections</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore-osgi</artifactId>
            <version>4.0</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient-osgi</artifactId>
            <version>4.0-beta2</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>net.jcip</groupId>
            <artifactId>com.springsource.net.jcip.annotations</artifactId>
            <version>1.0.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-api</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.templaterenderer</groupId>
            <artifactId>atlassian-template-renderer-velocity1.6-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-api</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-service-provider-spi</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-service-provider-plugin</artifactId>
            <version>${project.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-service-provider-sal-plugin</artifactId>
            <version>${project.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-service-provider-testdata-plugin</artifactId>
            <version>${project.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-consumer-spi</artifactId>
            <version>${pom.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-consumer-plugin</artifactId>
            <version>${pom.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-consumer-sal-plugin</artifactId>
            <version>${pom.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-whoami-plugin</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-service-provider-opensocial-plugin</artifactId>
            <version>${project.version}</version>
            <type>bundle</type>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>atlassian-oauth-integration-test-plugin</artifactId>
            <version>${project.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-spi</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-publisher-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-renderer-plugin</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.gadgets</groupId>
            <artifactId>atlassian-gadgets-sample-gadgets-plugin</artifactId>
        </dependency>
        
        <!-- Testing -->
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.oauth.core</groupId>
            <artifactId>oauth-httpclient4</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.5</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>xalan</groupId>
                    <artifactId>xalan</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>xalan</groupId>
            <artifactId>xalan</artifactId>
            <version>2.7.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <atlassian.refapp.version>2.3.3</atlassian.refapp.version>
        <http.port>8080</http.port>
        <rmi.port>8580</rmi.port>
        <debugger.port>5005</debugger.port>
        <context>oauth</context>
        <baseurl>http://localhost:${http.port}/${context}</baseurl>
        <buildNumber>${project.version}</buildNumber>
        <tomcat.installer.url>
            https://m2proxy.atlassian.com/repository/public/org/apache/tomcat/apache-tomcat/5.5.25/apache-tomcat-5.5.25.zip
        </tomcat.installer.url>
        <cargo.wait>false</cargo.wait>
        <jvmargs />
    </properties>
</project>
