<?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">
    <parent>
        <artifactId>crowd-user-management-test</artifactId>
        <groupId>com.atlassian.crowd</groupId>
        <version>3.0.16-D20140716T083140</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>crowd-user-management-test-rest</artifactId>
    <name>Atlassian User Management - REST Tests</name>


    <properties>
        <crowd.cargo.servlet.port>4990</crowd.cargo.servlet.port>
        <testClassDirectory>${project.build.testOutputDirectory}</testClassDirectory>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-user-management-plugin</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-user-management-test-common</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-acceptance-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.plugins.rest</groupId>
            <artifactId>atlassian-rest-common</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <profiles>
        <!-- Don't re-run the acceptance tests in release:perform -->
        <profile>
            <id>release</id>
            <properties>
                <skipTests>true</skipTests>
            </properties>
        </profile>
        <profile>
            <id>ide</id>
            <dependencies>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>${slf4j.version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-user-management-plugin</artifactId>
                    <version>${project.version}</version>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack-func-tests</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>

                        <configuration>
                            <artifactItems>
                                <!-- We need some classes from this to be present in the test-classes directory -->
                                <artifactItem>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-acceptance-test</artifactId>
                                    <version>${crowd.version}</version>
                                </artifactItem>
                            </artifactItems>

                            <outputDirectory>${testClassDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <!-- Exclude everything: we don't have any unit tests here, and we don't want the classed we've
                     unpacked from crowd-acceptance-test to be picked up -->
                    <excludes>
                        <exclude>**/*</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-crowd-plugin</artifactId>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>integration-test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <installPlugin>false</installPlugin>
                    <excludeAllTestDependencies>true</excludeAllTestDependencies>
                    <productVersion>${crowd.version}</productVersion>
                    <productDataVersion>${crowd.data.version}</productDataVersion>
                    <enableFastdev>false</enableFastdev>
                    <enableDevToolbox>false</enableDevToolbox>
                    <pluginArtifacts>
                        <pluginArtifact>
                            <groupId>com.atlassian.crowd</groupId>
                            <artifactId>crowd-user-management-plugin</artifactId>
                            <version>${project.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <systemPropertyVariables>
                        <acceptance.test.crowd.port>${crowd.cargo.servlet.port}</acceptance.test.crowd.port>
                        <crowd.property.crowd.server.url>http://localhost:${crowd.cargo.servlet.port}/crowd</crowd.property.crowd.server.url>
                        <xvfb.enable>${xvfb.enable}</xvfb.enable>
                        <applinks.cache.expiry>0</applinks.cache.expiry> <!-- disable DefaultReadOnlyApplicationLinkService cache -->
                    </systemPropertyVariables>
                    <functionalTestPattern>it/**/*.java</functionalTestPattern>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
