<?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">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.atlassian.jira.plugins</groupId>
		<artifactId>jira-greenhopper-parent-pom</artifactId>
		<version>8.6.2-int-0016</version>
	</parent>

    <name>Jira Agile OnDemand Acceptance Tests</name>
    <description>Jira Agile OnDemand Acceptance Tests</description>
	<artifactId>jira-greenhopper-ondemand-acceptance-tests</artifactId>
	<packaging>jar</packaging>

    <properties>
        <atlassian.test.categories.version>0.5</atlassian.test.categories.version>
        <context.jira.path />
        <http.jira.port />
        <http.jira.hostname />
        <http.jira.protocol />
        <jira.xml.data.location>./greenhopper-integration-test/src/test/xml</jira.xml.data.location>
        <license.scope>test</license.scope>
        <atlassian.test.target.dir>${project.build.directory}/webdriverTests</atlassian.test.target.dir>
        <od.testing.configuration>
            use-java,8
            use-maven,3
            set-categories,on-trigger="com.atlassian.jira:.*webapp",categories="com.atlassian.test.categories.OnDemandAcceptanceTest"
            set-categories,on-trigger="com.atlassian.jira:jira-projects-plugin",categories="com.atlassian.test.categories.OnDemandAcceptanceTest"
            set-categories,on-trigger="com.atlassian.jira.plugins:jira-software-plugin",categories="com.atlassian.test.categories.OnDemandAcceptanceTest"
        </od.testing.configuration>

        <webdriver.browser>firefox</webdriver.browser>
        <xvfb.enable>true</xvfb.enable>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-ui-test-utils</artifactId>
            <version>${jira.ui.test.utils.version}</version>
            <exclusions>
                <!--
                    Deliberately exclude jira-func-tests because we don't want to use a fixed version when running
                    AT/SLAT. Instead we want to use the same version as the Jira version that we're testing against.
                -->
                <exclusion>
                    <groupId>com.atlassian.jira</groupId>
                    <artifactId>jira-func-tests</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-acceptance-test</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
		<dependency>
            <groupId>com.atlassian.plugins.jstestrunner</groupId>
            <artifactId>atlassian-jstest-runner-pageobjects</artifactId>
            <version>${atlassian.jstest.runner.plugin.version}</version>
            <scope>test</scope>
        </dependency>
		<dependency>
			<groupId>com.atlassian.jira</groupId>
			<artifactId>atlassian-jira-pageobjects</artifactId>
            <version>${jira.version}</version>
            <exclusions>
                <!--
                    Deliberately NOT excluding jira-func-tests because for AT/SLAT run we want to use the same version
                    of jira-func-test as the version of Jira we're running against.

                    NOTE that this is not the case when running our regular CI builds.
                -->
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
            </exclusions>
		</dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>greenhopper-client-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira.plugins</groupId>
            <artifactId>jira-greenhopper-integration-test</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>atlassian-universal-plugin-manager-pageobjects</artifactId>
            <version>2.9.3</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.jira.tests</groupId>
            <artifactId>jira-testkit-client</artifactId>
            <version>${testkit.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.hamcrest</groupId>
                    <artifactId>hamcrest-library</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-xc</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-core-asl</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-mapper-asl</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian</groupId>
            <artifactId>atlassian-test-categories</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-projects-page-objects</artifactId>
            <version>${jira.projects.pageobjects.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>com.atlassian.selenium</groupId>
				<artifactId>atlassian-webdriver-core</artifactId>
				<version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>com.atlassian.selenium</groupId>
				<artifactId>atlassian-pageobjects-api</artifactId>
				<version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
			</dependency>
			<dependency>
				<groupId>com.atlassian.selenium</groupId>
				<artifactId>atlassian-pageobjects-elements</artifactId>
				<version>${atlassian.selenium.version}</version>
                <scope>provided</scope>
			</dependency>
            <dependency>
                <groupId>com.atlassian</groupId>
                <artifactId>atlassian-test-categories</artifactId>
                <version>${atlassian.test.categories.version}</version>
            </dependency>
		</dependencies>
	</dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.12.4</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <testResources>
            <testResource>
                 <directory>src/test/resources</directory>
                 <filtering>false</filtering>
            </testResource>
        </testResources>
        <plugins>
            <!-- Tell maven to exclude the webdriver tests from the regular surefire
                        unit test run, since that happens before Jira spins up. -->
            <plugin>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                      <excludes>
                          <exclude>it/**</exclude>
                      </excludes>
                 </configuration>
            </plugin>
			<plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <executions>
                    <execution>
                        <id>enforce-build-environment</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                        <configuration>
                            <forceCreation>true</forceCreation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>2.12.4</version>
                <configuration>
                    <systemPropertyVariables>
                        <atlassian.test.target.dir>${atlassian.test.target.dir}</atlassian.test.target.dir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>software-bundled-plugins</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-test</id>
                                <configuration>
                                    <skipTests>true</skipTests>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>software-bundled-plugins</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <systemPropertyVariables>
                                <atlassian.dev.mode>false</atlassian.dev.mode>
                                <atlassian.webresource.disable.minification>false</atlassian.webresource.disable.minification>
                                <plugin.webresource.batching.off>false</plugin.webresource.batching.off>
                                <atlassian.mail.senddisabled>true</atlassian.mail.senddisabled>
                                <atlassian.mail.fetchdisabled>true</atlassian.mail.fetchdisabled>
                                <xvfb.enable>${xvfb.enable}</xvfb.enable>
                                <jira.websudo.is.disabled>true</jira.websudo.is.disabled>
                            </systemPropertyVariables>

                            <productDataPath>${project.build.testOutputDirectory}/generated-test-resources.zip</productDataPath>

                            <applications>
                                <application>
                                    <applicationKey>jira-software</applicationKey>
                                    <version>${jira.software.application.version}</version>
                                </application>
                            </applications>

                            <pluginArtifacts>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.plugins</groupId>
                                    <artifactId>greenhopper-client-plugin</artifactId>
                                    <version>${project.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira.tests</groupId>
                                    <artifactId>jira-testkit-plugin</artifactId>
                                    <version>${testkit.version}</version>
                                </pluginArtifact>
                                <pluginArtifact>
                                    <groupId>com.atlassian.jira</groupId>
                                    <artifactId>jira-func-test-plugin</artifactId>
                                    <version>${jira.version}</version>
                                </pluginArtifact>
                            </pluginArtifacts>

                            <productVersion>${jira.version}</productVersion>
                            <productDataVersion>${jira.version}</productDataVersion>

                            <testGroups>
                                <testGroup>
                                    <id>acceptanceTests</id>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                    <excludes>
                                        <exclude>**/*FlakyTest.java</exclude>
                                    </excludes>
                                    <includes>
                                        <include>**/*Test.java</include>
                                    </includes>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>ondemand-acceptance-tests</id>
            <activation>
                <property>
                    <name>ondemand-acceptance-tests</name>
                </property>
            </activation>
            <properties>
                <jira.protocol>${http.jira.protocol}</jira.protocol>
                <jira.url>${http.jira.hostname}</jira.url>
                <jira.port>${http.jira.port}</jira.port>
                <jira.context>${context.jira.path}</jira.context>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>default-test</id>
                                <configuration>
                                    <skipTests>true</skipTests>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>jira-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>ondemand-acceptance-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                            </execution>
                        </executions>
                        <configuration>
                            <testGroups>
                                <testGroup>
                                    <id>acceptanceTests</id>
                                    <productIds>
                                        <productId>jira</productId>
                                    </productIds>
                                    <includes>
                                        <include>**/*Test.java</include>
                                    </includes>
                                </testGroup>
                            </testGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>skip-unit-tests</id>
            <activation>
                <property>
                    <name>skipUTs</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <skipTests>true</skipTests>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
