<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.confluence</groupId>
        <artifactId>confluence-studio-project</artifactId>
        <version>6.0.0-OD-2016.02.0-0737</version>
    </parent>

    <artifactId>confluence-studio-ondemand-test</artifactId>
    <name>Confluence OnDemand Acceptance Tests</name>

    <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
        <!-- This is fed to Cargo via com.atlassian.maven.plugins.studio.util.ConfluenceApplication.getJvmArgs() and used
            by com.atlassian.studio.confluence.common.ConfluencePluginEnabler.enableCorrectConfluencePlugin() to decide which plugin
            to enable. -->
        <conf.jvmargs.extra>-Dconfluence.standalone=true</conf.jvmargs.extra>
        <crowd.jvmargs.extra>-Dconfluence.standalone=true</crowd.jvmargs.extra>
        <!-- This is used by the Confluence acceptance tests. -->
        <host.name>localhost</host.name>
        <confluence.http.port>1990</confluence.http.port>
        <confluence.http.context>wiki</confluence.http.context>
        <confluence.baseurl>http://${host.name}:${confluence.http.port}/${confluence.http.context}</confluence.baseurl>
        <crowd.http.port>4990</crowd.http.port>
        <crowd.http.context>crowd</crowd.http.context>
        <jira.http.port>2990</jira.http.port>
        <jira.http.context>jira</jira.http.context>
        <test.ondemand>true</test.ondemand>

        <resource.directories />
        <plugin.directories />

        <!-- selenium test properties -->
        <selenium.xvfb.skip>true</selenium.xvfb.skip>
        <selenium.xvfb.display>:20</selenium.xvfb.display>
        <selenium.server.port>4444</selenium.server.port>
        <selenium.server.location>localhost</selenium.server.location>

        <selenium.firefox.profile /> <!-- blank -->
        <selenium.max.wait.time>10000</selenium.max.wait.time>
        <selenium.max.action.wait.time>7500</selenium.max.action.wait.time>
        <selenium.max.editor.wait.time>15000</selenium.max.editor.wait.time>
        <selenium.max.comment.editor.wait.time>15000</selenium.max.comment.editor.wait.time>
        <selenium.clear.window.wait.time>0</selenium.clear.window.wait.time>
        <selenium.restart.frequency>0</selenium.restart.frequency>
        <ie6.mode>false</ie6.mode>
        <single.window>true</single.window>
        <maven.test.selenium.skip>false</maven.test.selenium.skip>
        <!-- end selenium test properties -->

        <!-- webdriver test properties -->
        <xvfb.enable>false</xvfb.enable>
        <xvfb.display>:20</xvfb.display>
        <!-- end webdriver test properties -->
        <!-- empty = first line from /tmp/jmsconfig -->
        <hallelujah.broker.url />
        <!-- empty = second line from /tmp/jmsconfig -->
        <hallelujah.test.name.queue />
        <!-- empty = third line from /tmp/jmsconfig -->
        <hallelujah.test.result.queue />
        <!-- empty = fourth line from /tmp/jmsconfig or random string, see com.atlassian.buildeng.hallelujah.jms.JMSConfiguration.JMSConfiguration(File) -->
        <hallelujah.id />
        <!-- empty = 5 minutes, see com.atlassian.studio.test.integration.hallelujah.ConfluenceHallelujahTemplate.getTimeoutInMillis() -->
        <hallelujah.timeout.minutes />
        <!-- empty = no retries -->
        <hallelujah.test.failure.max.retries />
        <!-- used to share the same configuration between batched and unbatched runs -->
        <scanning.suite.configuration.classname />
        <!-- use JUnit >= 4 for Hallelujah servers as a runner by default -->
        <hallelujah.server.class>com/atlassian/confluence/hallelujah/ConfluenceHallelujahJUnit4Server.java</hallelujah.server.class>
        <!-- use JUnit >= 4 for Hallelujah clients as a runner by default -->
        <hallelujah.client.class>com/atlassian/confluence/hallelujah//ConfluenceHallelujahJUnit4Client.java</hallelujah.client.class>
        <hallelujah.queue.suffix />

    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.refapp</groupId>
                <artifactId>platform-ctk-plugin</artifactId>
                <version>${platform.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-simple</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.selenium</groupId>
            <artifactId>atlassian-webdriver-core</artifactId>
            <version>${atlassian.selenium.and.webdriver.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.collections</groupId>
                    <artifactId>google-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.bundles</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-testutils</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-acceptance-test</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-hallelujah-support</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <!-- jcl-over-slf4j instead -->
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-webdriver-support</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
            <exclusions>
                <!-- this exclusion and the corresponding dependency on webdriver support is required so that
                     we can compile webdriver tests, but only provide the selenium 2 runtime when we are running them -->
                <exclusion>
                    <groupId>com.atlassian.selenium</groupId>
                    <artifactId>atlassian-webdriver-core</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.atlassian.upm</groupId>
            <artifactId>atlassian-universal-plugin-manager-pageobjects</artifactId>
            <version>${upm.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.atlassian.bundles</groupId>
                    <artifactId>google-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.google.collections</groupId>
                    <artifactId>google-collections</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.selenium</groupId>
                    <artifactId>atlassian-webdriver-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.selenium</groupId>
                    <artifactId>atlassian-pageobjects-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>com.atlassian.bundles</groupId>
                    <artifactId>jsr305</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <!-- Need this one to run tests which use UPM PageObjects -->
            <groupId>com.atlassian.upm</groupId>
            <artifactId>atlassian-universal-plugin-manager-javascript-tests</artifactId>
            <version>${upm.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-webdriver-test</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-stateless-webdriver-test</artifactId>
            <version>${project.version}</version>
            <type>jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <!--
                we need this dependency in the runners, since the runners
                extracts @com.atlassian.confluence.util.test.annotations.ExportedTestClass from
                plugins, and those test classes can potentially contain the annotation from
                this dependency.
            -->
            <groupId>com.atlassian</groupId>
            <artifactId>atlassian-test-categories</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- Plugin test dependencies -->
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-create-content-plugin</artifactId>
            <version>${create.content.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-create-content-test-support</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>watch-button-integration-tests</artifactId>
            <version>${watch.button.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins.search</groupId>
            <artifactId>confluence-search-test-support</artifactId>
            <version>${search.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-space-ia-test-support</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-page-banner-test-support</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-jira-metadata-test-support</artifactId>
            <version>${jira-metadata.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.extra</groupId>
            <artifactId>confluence-flyingpdf-plugin</artifactId>
            <version>${confluence.pdfexport.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-questions</artifactId>
            <version>${bundled.confluence-question.version}</version>
            <type>test-jar</type>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.confluence.plugins</groupId>
            <artifactId>confluence-questions-test-support</artifactId>
            <version>${bundled.confluence-question.version}</version>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mockito</groupId>
                    <artifactId>mockito-core</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.codehaus.jackson</groupId>
                    <artifactId>jackson-mapper-asl</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.test.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>org.ow2.asm</groupId>
                    <artifactId>asm-all</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.atlassian.confluence</groupId>
            <artifactId>confluence-test-utils</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>2.16</version>
                    <configuration>
                        <dependenciesToScan>
                            <dependency>com.atlassian.confluence:confluence-hallelujah-support</dependency>
                        </dependenciesToScan>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                    <systemPropertyVariables>
                        <java.io.tmpdir>${java.io.tmpdir}</java.io.tmpdir>
                        <http.port>${confluence.http.port}</http.port>
                        <webappContext>${confluence.http.context}</webappContext>
                        <confluence.version>${confluence.version}</confluence.version>
                        <baseurl>${confluence.baseurl}</baseurl>
                        <http.jira.url>${http.jira.url}</http.jira.url>
                        <dynamicPluginDirectory>${project.build.directory}/dependency</dynamicPluginDirectory>
                        <ldapMode>${ldapMode}</ldapMode>
                        <indra.baseurl>${indra.baseurl}</indra.baseurl>
                        <crowd.url>http://${host.name}:${crowd.http.port}/${crowd.http.context}</crowd.url>
                        <baseurl.crowd>${crowd.url}</baseurl.crowd>
                        <crowd.confluence.application.name>confluence</crowd.confluence.application.name>
                        <crowd.confluence.application.password>foobar</crowd.confluence.application.password>
                        <crowd.directory.name>Crowd Repository</crowd.directory.name>
                        <crowdMode>true</crowdMode>
                        <extra.default.test.user>sysadmin</extra.default.test.user>
                        <extra.default.test.group>system-administrators</extra.default.test.group>
                        <ssoAuthenticator>true</ssoAuthenticator>
                        <test.ondemand>${test.ondemand}</test.ondemand>
                        <checkTestTearDown>true</checkTestTearDown>
                        <admin.user.name>Administrator</admin.user.name>
                        <admin.user.email>admin@example.org</admin.user.email>
                        <greenmail.timeout>15000</greenmail.timeout>
                        <confluence.ondemand.default.user.group>${confluence.default.users}</confluence.ondemand.default.user.group>

                        <!-- selenium specific properties -->
                        <selenium.location>${selenium.server.location}</selenium.location>
                        <selenium.port>${selenium.server.port}</selenium.port>
                        <selenium.browser>${selenium.browser}</selenium.browser>
                        <selenium.max.wait.time>${selenium.max.wait.time}</selenium.max.wait.time>
                        <selenium.max.action.wait.time>${selenium.max.action.wait.time}</selenium.max.action.wait.time>
                        <selenium.max.editor.wait.time>${selenium.max.editor.wait.time}</selenium.max.editor.wait.time>
                        <selenium.max.comment.editor.wait.time>${selenium.max.comment.editor.wait.time}</selenium.max.comment.editor.wait.time>
                        <ie6.mode>${ie6.mode}</ie6.mode>
                        <selenium.clear.window.wait.time>${selenium.clear.window.wait.time}</selenium.clear.window.wait.time>
                        <selenium.restart.frequency>${selenium.restart.frequency}</selenium.restart.frequency>

                        <!-- webdriver specific properties -->
                        <webdriver.browser>${webdriver.browser}</webdriver.browser>
                        <xvfb.enable>${xvfb.enable}</xvfb.enable>
                        <xvfb.display>${xvfb.display}</xvfb.display>
                        <http.confluence.port>${confluence.http.port}</http.confluence.port>
                        <context.confluence.path>${confluence.http.context}</context.confluence.path>
                        <baseurl.confluence>${confluence.baseurl}</baseurl.confluence>
                    </systemPropertyVariables>
                    <argLine>-XX:MaxPermSize=512m -Xmx1000m -Duser.language=en -Duser.country=AU</argLine>
                </configuration>
                <executions>
                    <execution>
                        <id>50_acceptance_tests</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <configuration>
                            <skip>${maven.test.it.skip}</skip>
                            <testClassesDirectory>${project.build.directory}/test-classes</testClassesDirectory>
                            <includes>
                                <include>${scanning.suite.configuration.classname}</include>
                            </includes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>unpack-testjar</artifactId>
                <version>${unpack-testjar.plugin.version}</version>
                <executions>
                    <execution>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>unpack-tests</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <!-- Unpacks the acceptance tests so they can be run by surefire.
                     A smarter ClassResolver (as used by the ScanningSuite test runner) would eliminate the need for this. -->
                    <execution>
                        <id>unpack-confluence-tests</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <excludeTransitive>true</excludeTransitive>
                            <includeArtifactIds>confluence-acceptance-test</includeArtifactIds>
                            <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>test-remote-ondemand</id>
            <properties>
                <host.name>SUBSTITUTE_ME</host.name>
                <confluence.baseurl>https://${host.name}/wiki</confluence.baseurl>
                <crowd.url>${confluence.baseurl}/plugins/servlet/crowdproxy</crowd.url>
                <test.ondemand>true</test.ondemand>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceCloudAcceptanceTestHarness.java</scanning.suite.configuration.classname>
                <http.jira.url>https://${host.name}/</http.jira.url>
                <ldapMode>EXTERNAL_CROWD</ldapMode>
                <indra.baseurl>${http.jira.url}</indra.baseurl>
                <confluence.default.users>confluence-users</confluence.default.users>
                <ctk.outdir>/tmp/ctkout</ctk.outdir>
                <xvfb.enable>true</xvfb.enable>
                <webdriver.browser>chrome</webdriver.browser>
            </properties>
        </profile>

        <profile>
            <id>onDemandTestSharedArtifact</id>
            <!-- This profile is used to declare the confluence-studio-webapp.war dependency that has been imported into the Bamboo build via a ahared artifact-->
            <properties>
                <studio.confluence.artifactId>confluence-studio-webapp-sharedartifact</studio.confluence.artifactId>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-install-plugin</artifactId>
                        <executions>
                            <!-- Install Bamboo's shared artifact into out local repo so that it can be later run by the tests -->
                            <execution>
                                <id>install-confluence-studio-webapp-sharedartifact</id>
                                <phase>initialize</phase>
                                <goals>
                                    <goal>install-file</goal>
                                </goals>
                                <configuration>
                                    <file>${shared.artifact.dir}/confluence-studio-webapp-${project.version}.war</file>
                                    <artifactId>${studio.confluence.artifactId}</artifactId>
                                    <groupId>${project.groupId}</groupId>
                                    <version>${project.version}</version>
                                    <packaging>war</packaging>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>onDemandTestSetup</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <!-- Copies dynamic plugins to target/dependency for discovery by MavenDependencyHelper -->
                            <execution>
                                <id>copy-dynamic-plugins</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>${testing.dynamicplugin.list}</includeArtifactIds>
                                    <stripVersion>true</stripVersion>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <!-- Stops and starts whatever apps are configured in the applicable pluginManagement
                             declarations for the amps-plugin.   -->
                        <groupId>com.atlassian.maven.plugins</groupId>
                        <artifactId>maven-amps-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>pre-integration-test</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                            <execution>
                                <id>post-integration-test</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>alacarte</id>
            <properties>
                <http.jira.url>http://${host.name}:${jira.http.port}/${jira.http.context}</http.jira.url>
                <ldapMode>EXTERNAL_CROWD</ldapMode>
            </properties>
        </profile>
        <profile>
            <id>standalone</id>
            <properties>
                <ldapMode>CROWD</ldapMode>
            </properties>
        </profile>
        <profile>
            <id>selenium</id>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.confluence</groupId>
                    <artifactId>confluence-selenium-test</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-selenium-tests</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>confluence-selenium-test</includeArtifactIds>
                                    <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>selenium-maven-plugin</artifactId>
                        <version>${selenium.maven.version}</version>
                        <executions>
                            <execution>
                                <id>start-xvfb-instance</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>xvfb</goal>
                                </goals>
                                <configuration>
                                    <skip>${selenium.xvfb.skip}</skip>
                                    <display>${selenium.xvfb.display}</display>
                                </configuration>
                            </execution>
                            <execution>
                                <id>start-selenium-server</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>start-server</goal>
                                </goals>
                                <configuration>
                                    <background>true</background>
                                    <singleWindow>${single.window}</singleWindow>
                                    <port>${selenium.server.port}</port>
                                    <firefoxProfileTemplate>${selenium.firefox.profile}</firefoxProfileTemplate>
                                </configuration>
                            </execution>
                            <execution>
                                <id>stop-selenium-server</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>stop-server</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>webdriver</id>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.confluence</groupId>
                    <artifactId>confluence-webdriver-test</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.confluence</groupId>
                    <artifactId>confluence-stateless-webdriver-test</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
                <dependency>
                    <groupId>com.atlassian.confluence</groupId>
                    <artifactId>confluence-webdriver-support</artifactId>
                    <version>${project.version}</version>
                    <scope>test</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>unpack-webdriver-tests</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>unpack-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>confluence-webdriver-test,confluence-stateless-webdriver-test</includeArtifactIds>
                                    <outputDirectory>${project.build.testOutputDirectory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>dev</id>
            <!-- This profile can be used to reproduce and isolate isolate issues with tests. In order to setup the environment,
                that is to compile the local tests and extract the Confluence acceptance tests, to start Crowd and Confluence and run the
                adjustment tests against them, run [setup]. You can the either [runTest] or [debugTest] with -Dtest={ErroneousTest}. -->
            <build>
                <defaultGoal>cli:execute-phase</defaultGoal>
                <plugins>
                    <plugin>
                        <groupId>org.twdata.maven</groupId>
                        <artifactId>maven-cli-plugin</artifactId>
                        <configuration>
                            <ignoreFailures>false</ignoreFailures>
                            <userAliases>
                                <prepare>studio:prepare-studio studio:prepare-confluence</prepare>
                                <startCrowd>studio:start-crowd studio:wait-crowd</startCrowd>
                                <startConfluence>studio:start-confluence -Dstudio.debug=true studio:wait-confluence</startConfluence>
                                <stopCrowd>studio:stop-crowd</stopCrowd>
                                <stopConfluence>studio:stop-confluence</stopConfluence>
                                <stop>stopCrowd stopConfluence</stop>
                                <runTest>surefire:test</runTest>
                                <debugTest>runTest -Dmaven.surefire.debug=true</debugTest>
                                <setup>pre-integration-test -Dstudio.debug=true</setup>
                            </userAliases>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
            </properties>
        </profile>

        <profile>
            <id>onDemandStandaloneAcceptanceTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceStandaloneAcceptanceTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>
        <profile>
            <id>onDemandALaCarteAcceptanceTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceALaCarteAcceptanceTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>
        <profile>
            <id>onDemandStandaloneSeleniumTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceStandaloneSeleniumTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>
        <profile>
            <id>onDemandALaCarteSeleniumTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceALaCarteSeleniumTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>
        <profile>
            <id>onDemandStandaloneWebDriverTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceStandaloneWebDriverTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>
        <profile>
            <id>onDemandALaCarteWebDriverTests</id>
            <properties>
                <maven.test.it.skip>false</maven.test.it.skip>
                <scanning.suite.configuration.classname>com/atlassian/studio/test/integration/harness/ConfluenceALaCarteWebDriverTestHarness.java</scanning.suite.configuration.classname>
            </properties>
        </profile>

        <profile>
            <id>bamboo-firefox36</id>
            <properties>
                <selenium.browser.path>/import/tools/firefox/3.6/firefox-bin</selenium.browser.path>
                <selenium.browser>*firefoxproxy ${selenium.browser.path}</selenium.browser>
                <selenium.xvfb.skip>false</selenium.xvfb.skip>
            </properties>
        </profile>

        <!-- Runs both the server and the client -->
        <profile>
            <id>hallelujah-server</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>00_setup</id>
                                <phase>pre-integration-test</phase>
                                <!-- Needed so that clover can optimize acceptance tests.-->
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <skip>${maven.test.acceptance.skip}</skip>
                                    <testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
                                    <includes>
                                        <include>com/atlassian/confluence/setup/SetupAcceptanceTest.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>50_run_hallelujah</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <skip>false</skip>
                                    <parallel>classes</parallel>
                                    <threadCount>2</threadCount>
                                    <systemPropertyVariables>
                                        <hallelujah.scanning.suite.configuration.classname>${scanning.suite.configuration.classname}</hallelujah.scanning.suite.configuration.classname>
                                        <hallelujah.broker.url>${hallelujah.broker.url}</hallelujah.broker.url>
                                        <hallelujah.test.name.queue>${hallelujah.test.name.queue}</hallelujah.test.name.queue>
                                        <hallelujah.test.result.queue>${hallelujah.test.result.queue}</hallelujah.test.result.queue>
                                        <hallelujah.queue.suffix>${hallelujah.queue.suffix}</hallelujah.queue.suffix>
                                        <hallelujah.id>${hallelujah.id}</hallelujah.id>
                                        <hallelujah.timeout.minutes>${hallelujah.timeout.minutes}</hallelujah.timeout.minutes>
                                        <hallelujah.test.failure.max.retries>${hallelujah.test.failure.max.retries}</hallelujah.test.failure.max.retries>
                                    </systemPropertyVariables>
                                    <includes>
                                        <include>${hallelujah.server.class}</include>
                                        <include>${hallelujah.client.class}</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <maven.test.it.skip>true</maven.test.it.skip>
            </properties>
        </profile>

        <profile>
            <id>hallelujah-client</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>00_setup</id>
                                <phase>pre-integration-test</phase>
                                <!-- Needed so that clover can optimize acceptance tests.-->
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <skip>${maven.test.acceptance.skip}</skip>
                                    <testClassesDirectory>${project.build.directory}/it-classes</testClassesDirectory>
                                    <includes>
                                        <include>com/atlassian/confluence/setup/SetupAcceptanceTest.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                            <execution>
                                <id>50_run_hallelujah</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <systemPropertyVariables>
                                        <hallelujah.broker.url>${hallelujah.broker.url}</hallelujah.broker.url>
                                        <hallelujah.test.name.queue>${hallelujah.test.name.queue}</hallelujah.test.name.queue>
                                        <hallelujah.test.result.queue>${hallelujah.test.result.queue}</hallelujah.test.result.queue>
                                        <hallelujah.queue.suffix>${hallelujah.queue.suffix}</hallelujah.queue.suffix>
                                        <hallelujah.id>${hallelujah.id}</hallelujah.id>
                                        <hallelujah.timeout.minutes>${hallelujah.timeout.minutes}</hallelujah.timeout.minutes>
                                    </systemPropertyVariables>
                                    <skip>false</skip>
                                    <includes>
                                        <include>${hallelujah.client.class}</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <maven.test.it.skip>true</maven.test.it.skip>
            </properties>
        </profile>

        <!-- These are to turn on different modes of FileStore integration:
        MODE 1: local only (default)
        MODE 2: Primary local, secondary filestore
        MODE 3: Secondary local, primary filestore
        MODE 4: filestore only
        -->
        <profile>
            <id>filestore-primary-local</id>
            <properties>
                <confluence.filestore.mode>DUAL_PRIMARY_LOCAL</confluence.filestore.mode>
            </properties>
        </profile>
        <profile>
            <id>filestore-primary-cloud</id>
            <properties>
                <confluence.filestore.mode>DUAL_PRIMARY_CLOUD</confluence.filestore.mode>
            </properties>
        </profile>
        <profile>
            <id>filestore-cloud-only</id>
            <properties>
                <confluence.filestore.mode>CLOUD_ONLY</confluence.filestore.mode>
            </properties>
        </profile>
    </profiles>
</project>
