<?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.crowd</groupId>
        <artifactId>atlassian-crowd</artifactId>
        <version>5.2.11</version>
    </parent>

    <artifactId>crowd-test-runner</artifactId>
    <name>Atlassian Crowd Acceptance Test Runner Module</name>
    <packaging>pom</packaging>

    <modules>
        <!-- Running on Windows with a local SQL Server database -->
        <module>crowd-sql-server-upgrade-test</module>
        <module>crowd-testkit-plugin</module>
        <module>crowd-web-load-test</module>
        <module>crowd-functest-plugin</module>
        <module>crowd-dummy-plugin</module>
        <module>crowd-tomcat-encrypted-protocols-test</module>
        <module>crowd-jacoco-report</module>
    </modules>

    <dependencies>
        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-web-app</artifactId>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-openid-server</artifactId>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-openid-client</artifactId>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-apacheds-server</artifactId>
            <version>${project.version}</version>
            <type>war</type>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-acceptance-test</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <!-- gatling in web-load-tests uses a different scala version than openid in bundled-apps tests-->
                <exclusion>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-openid-spray-acceptance-test</artifactId>
                </exclusion>

                <!-- gatling in web-load-tests uses a different netty version than mockserver in cluster tests -->
                <exclusion>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-rest-test</artifactId>
            <version>${project.version}</version>
            <exclusions>
                <!-- gatling in web-load-tests uses a different netty version than mockserver in cluster tests -->
                <exclusion>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-decorator-test</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-decorator-test-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.hsqldb</groupId>
            <artifactId>hsqldb</artifactId>
            <classifier>jdk8</classifier>
            <!-- Needs to be compile at this point so cargo can access it, scope:test will not work -->
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <!-- Needs to be compile at this point so cargo can access it, scope:test will not work -->
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <!-- Needs to be compile at this point so cargo can access it, scope:test will not work -->
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>com.oracle.database.jdbc</groupId>
            <artifactId>ojdbc8</artifactId>
            <version>${ojdbc.version}</version>
            <!-- Needs to be compile at this point so cargo can access it, scope:test will not work -->
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
        </dependency>

        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <!-- Needs to be compile at this point so cargo can access it, scope:test will not work -->
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>javax.activation-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.activation</groupId>
            <artifactId>javax.activation</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jaxb</groupId>
            <artifactId>jaxb-runtime</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-testkit-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.atlassian.crowd</groupId>
            <artifactId>crowd-functest-plugin</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>com.atlassian.functest</groupId>
            <artifactId>functest-plugin</artifactId>
        </dependency>

        <dependency>
            <groupId>com.atlassian.labs.plugins</groupId>
            <artifactId>quickreload</artifactId>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.jwebunit</groupId>
            <artifactId>jwebunit-core</artifactId>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>net.sourceforge.nekohtml</groupId>
            <artifactId>nekohtml</artifactId>
            <scope>runtime</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <scope>runtime</scope>
        </dependency>

    </dependencies>

    <properties>
        <bamboo.buildKey>UNKNOWN</bamboo.buildKey>
        <crowd.home>${project.build.directory}/crowd-home</crowd.home>
        <crowd.shared>${crowd.home}/shared</crowd.shared> <!-- overridden in profiles that spin up a second crowd instance/node -->
        <crowd2.home>${crowd.home}</crowd2.home> <!-- overriden in profiles that spin up a second crowd instance/node -->
        <acceptanceTestClassDirectory>${project.build.directory}/it-classes</acceptanceTestClassDirectory>

        <crowdid.cargo.goal>start</crowdid.cargo.goal>
        <cargo.pingTimeout>${cargo.timeout}</cargo.pingTimeout>
        <!-- Set to false (-Dselenium.background=false) to run selenium server and wait (similar to cargo's run/wait) -->
        <selenium.background>true</selenium.background>
        <!-- Set to false (-Dselenium.test.skip=false) to run selenium tests -->
        <selenium.test.skip>true</selenium.test.skip>
        <!-- By default same as maven.test.skip. Running the selenium profile will change this value to allow crowd to setup -->
        <maven.test.skip>${skipTests}</maven.test.skip>
        <crowd.setup.skip>${maven.test.skip}</crowd.setup.skip>
        <crowd2.setup.skip>true</crowd2.setup.skip>
        <crowdid.setup.skip>true</crowdid.setup.skip>
        <cargo.additional.plugins />

        <!-- please list ALL port configurations here -->
        <crowd.cargo.servlet.port>8095</crowd.cargo.servlet.port>
        <crowd.cargo.rmi.port>8195</crowd.cargo.rmi.port>
        <crowd.cargo.ajp.port>8009</crowd.cargo.ajp.port>
        <crowd.cargo.debug /> <!-- set in the debug profile if activated -->
        <crowd.cargo.extra.jvmargs /> <!-- could be set in different profiles -->
        <crowd.cargo.suspend>n</crowd.cargo.suspend>
        <crowd2.cargo.servlet.port>8096</crowd2.cargo.servlet.port>
        <crowd2.cargo.rmi.port>8196</crowd2.cargo.rmi.port>
        <crowd2.cargo.ajp.port>8010</crowd2.cargo.ajp.port>
        <crowd2.cargo.debug />
        <crowdid.cargo.servlet.port>8097</crowdid.cargo.servlet.port>
        <crowdid.cargo.rmi.port>8197</crowdid.cargo.rmi.port>
        <crowdid.cargo.ajp.port>8011</crowdid.cargo.ajp.port>
        <crowdid.cargo.debug />
        <apacheds.1.5.ldap.port>12389</apacheds.1.5.ldap.port>

        <!-- Configure logging to files as default, but in practice this is usually overridden by -Pstdout-logging -->
        <crowd.cargo.output>${project.build.directory}/output-crowd.log</crowd.cargo.output>
        <crowd.cargo.log>${project.build.directory}/cargo-crowd.log</crowd.cargo.log>
        <crowd2.cargo.output>${project.build.directory}/output-crowd2.log</crowd2.cargo.output>
        <crowd2.cargo.log>${project.build.directory}/cargo-crowd2.log</crowd2.cargo.log>
        <crowdid.cargo.output>${project.build.directory}/output-crowdid.log</crowdid.cargo.output>
        <crowdid.cargo.log>${project.build.directory}/cargo-crowdid.log</crowdid.cargo.log>

        <!-- Selenium properties -->
        <!-- Overide with -Dselenium.browser='*firefox /Applications/path/to/firefox2' in command line -->
        <webdriver.browser>firefox</webdriver.browser>
        <selenium.browser>*firefox</selenium.browser>
        <selenium.xvfb.skip>true</selenium.xvfb.skip>
        <selenium.max.wait.time>10000</selenium.max.wait.time>
        <selenium.server.port>4448</selenium.server.port>
        <selenium.browser.path>/opt/firefox/firefox-7.0/firefox-bin</selenium.browser.path>
        <!-- Confluence uses 4444 -->
        <selenium.server.location>localhost</selenium.server.location>
        <selenium.firefox.profile />

        <xvfb.enable>false</xvfb.enable>
        <xvfb.display>:0</xvfb.display>

        <crowd.context>crowd</crowd.context>
        <crowd.url>http://${selenium.server.location}:${crowd.cargo.servlet.port}/${crowd.context}/</crowd.url>
        <crowd.test.exclusion.suffix>NotFirefoxTest</crowd.test.exclusion.suffix>

        <license.scope>test</license.scope>

        <docker.skip>true</docker.skip>
        <docker.postgres.skip>true</docker.postgres.skip>
        <docker.apacheds.skip>true</docker.apacheds.skip>
        <docker.postgres.opts>-c log_statement=none</docker.postgres.opts>
        <docker.mysql.skip>true</docker.mysql.skip>
        <docker.oracle.skip>true</docker.oracle.skip>
        <docker.openldap.skip>true</docker.openldap.skip>
        <openldap.ldif.dir>${basedir}/src/test/conf/openldap/small</openldap.ldif.dir>

        <crowd.node.urls />
        <crowd.license>DATA_CENTER</crowd.license>
        <stats.prefix>crowd.ci.timings.loadtest</stats.prefix>

        <skip.copy.h2.crowd.home>false</skip.copy.h2.crowd.home>
        <maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>

        <!-- Browserstack properties -->
        <browserstack.project>Crowd x-browser tests</browserstack.project>
        <browserstack.name />
        <browserstack.browser />
        <browserstack.browser.version />
        <browserstack.os />
        <browserstack.os.version />
        <browserstack.idleTimeout>300</browserstack.idleTimeout>

        <bs.api.secret.key />
        <bs.api.user />

        <!-- Browser versions -->
        <edge.legacy.version>18</edge.legacy.version>
        <edge.chromium.version>80</edge.chromium.version>
        <chrome.version>80</chrome.version>
        <safari.version>13</safari.version>
        <firefox.version>74</firefox.version>
        <!-- End of Browserstack properties -->
    </properties>


    <profiles>
        <profile>
            <id>debug</id>
            <properties>
                <crowd.cargo.debug>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${crowd.cargo.suspend},address=5005</crowd.cargo.debug>
                <crowd2.cargo.debug>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=${crowd.cargo.suspend},address=5006</crowd2.cargo.debug>
                <crowdid.cargo.debug>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5007</crowdid.cargo.debug>
            </properties>
        </profile>

        <profile>
            <id>suspend</id>
            <properties>
                <crowd.cargo.suspend>y</crowd.cargo.suspend>
            </properties>
        </profile>

        <profile>
            <id>stdout-logging</id>
            <activation>
                <!-- Enable for convenience; running tests requires explicit profile which will turn this off anyway -->
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Log Tomcats' output and deployed applications' logs to stdout -->
                <crowd.cargo.output />
                <crowd.cargo.log />
                <crowd2.cargo.output />
                <crowd2.cargo.log />
                <crowdid.cargo.output />
                <crowdid.cargo.log />
            </properties>
        </profile>

        <!-- Don't re-run the acceptance tests in release:perform -->
        <profile>
            <id>release</id>
            <properties>
                <maven.test.skip>true</maven.test.skip>
            </properties>
        </profile>

        <!-- Selenium profiles -->
        <profile>
            <id>bamboo-firefox</id>
            <properties>
                <selenium.browser>*firefox ${selenium.browser.path}</selenium.browser>
                <selenium.xvfb.skip>false</selenium.xvfb.skip>
                <selenium.max.wait.time>12000</selenium.max.wait.time>
            </properties>
        </profile>

        <profile>
            <id>local-firefox-mac</id>
            <properties>
                <selenium.browser>*firefox /Applications/Firefox.app/Contents/MacOS/firefox-bin</selenium.browser>
                <selenium.xvfb.skip>false</selenium.xvfb.skip>
                <selenium.max.wait.time>12000</selenium.max.wait.time>
            </properties>
        </profile>

        <profile>
            <id>local-firefox-linux</id>
            <properties>
                <selenium.browser>*firefox /usr/bin/firefox</selenium.browser>
                <selenium.xvfb.skip>false</selenium.xvfb.skip>
                <selenium.max.wait.time>12000</selenium.max.wait.time>
            </properties>
        </profile>

        <profile>
            <id>safari</id>
            <properties>
                <selenium.browser>*safari</selenium.browser>
                <selenium.xvfb.skip>true</selenium.xvfb.skip>
                <crowd.test.exclusion.suffix>NotSafariTest</crowd.test.exclusion.suffix>
            </properties>
        </profile>

        <profile>
            <id>vmwarevista-ie7</id>
            <properties>
                <selenium.browser>*iexplore</selenium.browser>
                <selenium.xvfb.skip>true</selenium.xvfb.skip>
                <crowd.test.exclusion.suffix>NotIExploreTest</crowd.test.exclusion.suffix>
                <selenium.max.wait.time>15000</selenium.max.wait.time>
            </properties>
        </profile>

        <profile>
            <id>vmwarevista-ie6</id>
            <properties>
                <selenium.browser>*iexplore</selenium.browser>
                <selenium.xvfb.skip>true</selenium.xvfb.skip>
                <crowd.test.exclusion.suffix>NotIExploreTest</crowd.test.exclusion.suffix>
            </properties>
        </profile>

        <!-- Browserstack profiles       -->
        <profile>
            <id>bs-edge-legacy</id>
            <properties>
                <webdriver.browser>browserstack</webdriver.browser>
                <browserstack.name>Edge Legacy - ${bamboo.buildKey}</browserstack.name>
                <browserstack.browser>edge</browserstack.browser>
                <browserstack.browser.version>${edge.legacy.version}</browserstack.browser.version>
                <browserstack.os>windows</browserstack.os>
                <browserstack.os.version>10</browserstack.os.version>
            </properties>
        </profile>
        <profile>
            <id>bs-edge-chromium</id>
            <properties>
                <webdriver.browser>browserstack</webdriver.browser>
                <browserstack.name>Edge Chromium - ${bamboo.buildKey}</browserstack.name>
                <browserstack.browser>edge</browserstack.browser>
                <browserstack.browser.version>${edge.chromium.version}</browserstack.browser.version>
                <browserstack.os>windows</browserstack.os>
                <browserstack.os.version>10</browserstack.os.version>
            </properties>
        </profile>
        <profile>
            <id>bs-chrome-windows</id>
            <properties>
                <webdriver.browser>browserstack</webdriver.browser>
                <browserstack.name>Chrome Windows - ${bamboo.buildKey}</browserstack.name>
                <browserstack.browser>chrome</browserstack.browser>
                <browserstack.browser.version>${chrome.version}</browserstack.browser.version>
                <browserstack.os>windows</browserstack.os>
                <browserstack.os.version>10</browserstack.os.version>
            </properties>
        </profile>
        <profile>
            <id>bs-safari</id>
            <properties>
                <webdriver.browser>browserstack</webdriver.browser>
                <browserstack.name>Safari - ${bamboo.buildKey}</browserstack.name>
                <browserstack.browser>safari</browserstack.browser>
                <browserstack.browser.version>${safari.version}</browserstack.browser.version>
                <browserstack.os>os x</browserstack.os>
                <browserstack.os.version>catalina</browserstack.os.version>
            </properties>
        </profile>
        <profile>
            <id>bs-firefox-windows</id>
            <properties>
                <webdriver.browser>browserstack</webdriver.browser>
                <browserstack.name>Firefox Windows - ${bamboo.buildKey}</browserstack.name>
                <browserstack.browser>firefox</browserstack.browser>
                <browserstack.browser.version>${firefox.version}</browserstack.browser.version>
                <browserstack.os>windows</browserstack.os>
                <browserstack.os.version>10</browserstack.os.version>
            </properties>
        </profile>

        <!-- End of Browserstack profiles       -->

        <profile>
            <!-- allows prepopulating the started Crowd instance with config and data to run against sqlserver -->
            <id>sqlserver</id>
            <activation>
                <property>
                    <name>database.type</name>
                    <value>mssql</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- prepare config, based on passed system properties -->
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-crowd-config-files-mssql</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-home-external-db</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- populate the db -->
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>sql-maven-plugin</artifactId>

                        <dependencies>
                            <dependency>
                                <groupId>net.sourceforge.jtds</groupId>
                                <artifactId>jtds</artifactId>
                                <version>${jtds.version}</version>
                            </dependency>
                        </dependencies>

                        <executions>
                            <execution>
                                <id>populate-tpm-db</id>
                                <phase>pre-integration-test</phase>

                                <goals>
                                    <goal>execute</goal>
                                </goals>

                                <configuration>
                                    <username>${database.username}</username>
                                    <password>${database.password}</password>
                                    <url>${database.url}</url>
                                    <driver>net.sourceforge.jtds.jdbc.Driver</driver>
                                    <skip>${skipTests}</skip>
                                    <forceMojoExecution>true</forceMojoExecution>

                                    <autocommit>true</autocommit>
                                    <srcFiles>
                                        <srcFile>src/test/conf/crowd-db-sqlserver/crowd.sql</srcFile>
                                    </srcFiles>
                                    <onError>continue</onError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <database.username>sa</database.username>
                <database.url />
                <database.password />
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>
            </properties>
        </profile>

        <profile>
            <id>tpm-loadTest10k</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>

                        <configuration>
                            <systemProperties>
                                <property>
                                    <name>tpm.loadtest.file</name>
                                    <value>${tpm.loadtest.file}</value>
                                </property>
                            </systemProperties>
                        </configuration>

                        <executions>
                            <!-- Run load tests for AD2K3 -->
                            <execution>
                                <id>loadtest-ad2k3</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/directory/**/*.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                    </systemProperties>

                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.gmaven</groupId>
                        <artifactId>groovy-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>upload-results-to-statsd</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <logFilePattern>.*test-stats.csv</logFilePattern>
                                        <prefix>${stats.prefix}</prefix>
                                        <parser>csv</parser>
                                    </properties>
                                    <source>${project.basedir}/src/test/bin/saveStats.groovy</source>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>com.datadoghq</groupId>
                                <artifactId>java-dogstatsd-client</artifactId>
                                <version>2.3</version>
                            </dependency>
                            <dependency>
                                <groupId>com.atlassian.fugue</groupId>
                                <artifactId>fugue</artifactId>
                                <version>${fugue.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <tpm.loadtest.file />
                <xvfb.enable>true</xvfb.enable>
            </properties>
        </profile>

        <profile>
            <id>tpm-openldap</id>
            <properties>
                <docker.openldap.skip>false</docker.openldap.skip>
                <openldap.ldif.dir>${basedir}/src/test/conf/openldap/large</openldap.ldif.dir>
                <openldap.port>11389</openldap.port>
            </properties>
        </profile>

        <!-- profile for running Java-based performance tests that don't need external LDAP servers -->
        <profile>
            <id>performance</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>

                        <executions>
                            <!-- run performance tests -->
                            <execution>
                                <id>test-performance</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/load/**/*.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                    </systemProperties>

                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- Runs Crowd console interface tests -->
            <id>web-app-ui-tests</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <!-- run Crowd functional tests -->
                            <execution>
                                <id>test-crowd</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/integration/**/*.java</include>
                                    </includes>
                                    <environmentVariables>
                                        <BROWSERSTACK_ACCESS_KEY>${bs.api.secret.key}</BROWSERSTACK_ACCESS_KEY>
                                        <BROWSERSTACK_USER>${bs.api.user}</BROWSERSTACK_USER>
                                    </environmentVariables>
                                    <systemPropertyVariables>
                                        <webdriver.browser>${webdriver.browser}</webdriver.browser>
                                        <browserstack.idleTimeout>${browserstack.idleTimeout}</browserstack.idleTimeout>
                                        <browserstack.browser>${browserstack.browser}</browserstack.browser>
                                        <browserstack.browser.version>${browserstack.browser.version}</browserstack.browser.version>
                                        <browserstack.os>${browserstack.os}</browserstack.os>
                                        <browserstack.os.version>${browserstack.os.version}</browserstack.os.version>
                                        <browserstack.project>${browserstack.project}</browserstack.project>
                                        <browserstack.name>${browserstack.name}</browserstack.name>
                                    </systemPropertyVariables>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                        <property>
                                            <name>crowd.node.urls</name>
                                            <value>${crowd.node.urls}</value>
                                        </property>
                                        <property>
                                            <name>crowd.license</name>
                                            <value>${crowd.license}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <!-- Runs Crowd (the web-app) console acceptance tests -->
            <id>web-app-console-acceptance-tests</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <!-- run Crowd functional tests -->
                            <execution>
                                <id>test-crowd</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/applications/crowd/**/*.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/administration/**/*.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/decorator/**/*.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/integration/**/*.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                        <property>
                                            <name>crowd.node.urls</name>
                                            <value>${crowd.node.urls}</value>
                                        </property>
                                        <property>
                                            <name>crowd.license</name>
                                            <value>${crowd.license}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <!-- Starts CrowdID and runs bundled Crowd OpenID acceptance tests -->
            <id>bundled-apps-acceptance-tests</id>
            <properties>
                <crowdid.setup.skip>${maven.test.skip}</crowdid.setup.skip>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <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>
                                        <artifactItem>
                                            <groupId>com.atlassian.crowd</groupId>
                                            <artifactId>crowd-acceptance-test</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                        <artifactItem>
                                            <groupId>com.atlassian.crowd</groupId>
                                            <artifactId>crowd-openid-spray-acceptance-test</artifactId>
                                            <version>${project.version}</version>
                                        </artifactItem>
                                    </artifactItems>
                                    <outputDirectory>${acceptanceTestClassDirectory}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <!-- run CrowdID functional tests -->
                            <execution>
                                <id>test-crowdid</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/applications/crowdid/**/*.java</include>
                                        <include>com/atlassian/crowd/acceptance/applications/crowdid/server/spray/**/*.scala</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                    </systemProperties>
                                    <systemPropertyVariables>
                                        <crowd.property.application.login.url>http://localhost:${crowdid.cargo.servlet.port}/openidserver</crowd.property.application.login.url>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-openid-spray-acceptance-test</artifactId>
                    <version>${project.version}</version>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <!-- Runs Crowd Server REST API acceptance tests -->
            <id>rest-api-acceptance-tests</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <!-- run Crowd REST API functional tests -->
                            <execution>
                                <id>test-crowd-admin</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/rest/**/*.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                    </systemProperties>

                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>apacheds-docker</id>
            <properties>
                <docker.apacheds.skip>false</docker.apacheds.skip>
                <docker.skip>false</docker.skip>
            </properties>
        </profile>
        <profile>
            <!-- launch 2 nodes connected to a shared postgres db -->
            <id>cluster</id>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.postgres.skip>false</docker.postgres.skip>
                <docker.openldap.skip>false</docker.openldap.skip>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>

                <crowd.shared>${project.build.directory}/crowd-shared</crowd.shared>
                <crowd2.home>${project.build.directory}/crowd2-home</crowd2.home>
                <crowd2.setup.skip>false</crowd2.setup.skip>
                <crowd.node.urls>http://localhost:${crowd.cargo.servlet.port}/crowd,http://localhost:${crowd2.cargo.servlet.port}/crowd</crowd.node.urls>
                <crowd.license.key>AAABrw0ODAoPeNp1kctu2zAQRff8CgLdGaAsqUn9AAQ0kZgmRSIZthSgrwVFjW22Minw4dR/X9qSkaRNF9zM8N65c+ZduXX4BmocxjiczS+jeTjDVZniOIwmKHe7GnSxrgxok5AIpUpaxm3OdpC0HbOgPzLbMmMEkwFXO7Rwmm+Zgcz3kqMHCSMSTdG94CANlIcOTuKMPtL7YkGX5w793Ql9OMkW8cXteRJ9YKJ9exTX6qkJ/m+8Ar0HfZcl13RCyUX2NSYfis8T8un9bDqI/TiWgvTeidUO0MrVhmvRWaFkXxmNRnlRkptiSRbLIqvS8q7ISbWivpGkGnyuBtcHbLeAhyiYSq4a0LjT6idwi79tre2+z8fjjQperTBuewWBXvEjwJnCUlncCGO1qJ0F7ywMtgpzZ6za+TsEyDPxmSWT/BW2aRje/kvlBRGfOV3Sq5Jm5PrLcYE3uQ5aD66Sv6R6kmhF88Q/chmGqNAbJoVhJ0RXZyE6ofClv+/ex/GHFHvoiQ47P/pNjhYxyuCZeQnG4uEHXivPsHUbIXEDe2hV5zWI7lnr+vFr1hpAfwDKnPEMMCwCFAmZGEuZ8ec23uk1hgrTb14sdW0NAhQBBLtGgJRWDpAy3ibJD727YOqvrw==X02ko</crowd.license.key>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-node1-config-files-cluster</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/cluster-crowd-home</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.home}</outputDirectory>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-node2-config-files-cluster</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/cluster-crowd-home</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd2.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <inherited>false</inherited>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>symlink-shared-directory</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <!-- create directories if needed -->
                                        <mkdir dir="${crowd.shared}" />
                                        <mkdir dir="${crowd.home}" />
                                        <mkdir dir="${crowd2.home}" />

                                        <!-- create symlinks or overwrite (will not work on Windows) -->
                                        <symlink link="${crowd.home}/shared" resource="${crowd.shared}" overwrite="true" />
                                        <symlink link="${crowd2.home}/shared" resource="${crowd.shared}" overwrite="true" />
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>upgrade-license-to-dc</id>
            <properties>
                <crowd.license.upgradedc>true</crowd.license.upgradedc>
                <test.listener>com.atlassian.crowd.acceptance.utils.CrowdInstanceState</test.listener>
            </properties>
        </profile>

        <profile>
            <!-- launch 1 node with DC license and clustering disabled -->
            <id>sndc</id>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.postgres.skip>false</docker.postgres.skip>
                <docker.openldap.skip>false</docker.openldap.skip>

                <crowd2.setup.skip>true</crowd2.setup.skip>
                <crowd.node.urls>http://localhost:${crowd.cargo.servlet.port}/crowd</crowd.node.urls>
                <crowd.license.key>AAABrw0ODAoPeNp1kctu2zAQRff8CgLdGaAsqUn9AAQ0kZgmRSIZthSgrwVFjW22Minw4dR/X9qSkaRNF9zM8N65c+ZduXX4BmocxjiczS+jeTjDVZniOIwmKHe7GnSxrgxok5AIpUpaxm3OdpC0HbOgPzLbMmMEkwFXO7Rwmm+Zgcz3kqMHCSMSTdG94CANlIcOTuKMPtL7YkGX5w793Ql9OMkW8cXteRJ9YKJ9exTX6qkJ/m+8Ar0HfZcl13RCyUX2NSYfis8T8un9bDqI/TiWgvTeidUO0MrVhmvRWaFkXxmNRnlRkptiSRbLIqvS8q7ISbWivpGkGnyuBtcHbLeAhyiYSq4a0LjT6idwi79tre2+z8fjjQperTBuewWBXvEjwJnCUlncCGO1qJ0F7ywMtgpzZ6za+TsEyDPxmSWT/BW2aRje/kvlBRGfOV3Sq5Jm5PrLcYE3uQ5aD66Sv6R6kmhF88Q/chmGqNAbJoVhJ0RXZyE6ofClv+/ex/GHFHvoiQ47P/pNjhYxyuCZeQnG4uEHXivPsHUbIXEDe2hV5zWI7lnr+vFr1hpAfwDKnPEMMCwCFAmZGEuZ8ec23uk1hgrTb14sdW0NAhQBBLtGgJRWDpAy3ibJD727YOqvrw==X02ko</crowd.license.key>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-config-files-sndc</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/sndc-crowd-home</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- launch Crowd on server license -->
            <id>server</id>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.postgres.skip>false</docker.postgres.skip>
                <docker.openldap.skip>false</docker.openldap.skip>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>

                <crowd2.setup.skip>true</crowd2.setup.skip>
                <crowd.node.urls>http://localhost:${crowd.cargo.servlet.port}/crowd</crowd.node.urls>
                <crowd.license>SERVER</crowd.license>
                <crowd.license.key>AAABog0ODAoPeNp1kc1u2zAQhO98igV6KGCAsqQ4dWJAQBuJTZwmkmHLLfp3oKh1zEYmBZKy67cvYzlI0qYHXnZnuLPfvvmCNVxzBfEYonByOpqcxHB5W0IcxhHJu02FplgtLRqb0IikWjkuXM43mNR6p8V77hpureQqEHpDhNG7OriRApXFct/iQZmxz+ymmLE5mXVGrLnFjDtM4jA6p2FE4zH5v+PYYb9bafYH2yweXT0GYbdcNq8mWaDZoplmyQUbMzrKvsX0XXE9ppcn52dk0VVWGNk6qVXiTIdkMBjkRUk/FnM6mxfZMi2nRU6XC+YbSWrQD66h2oNbIxwjAVNC12igNfoXCgff1861PybD4Z0OXoQZNr2DYu/4GUCmQWkHtbTOyKpz6H+WFpwG0VmnN553QPxyyqHiSrzY/ywMr/4l/YyZz5zO2YeSZfTi68MCrwE6Wj2hpbpXeqfIguWJf/Q0DElh7riSlh8IfTL83mvJgYMv/H29Pos/h9xijzPDJ76PuFbaQPqgfGuh6mRTW9AK0ilhW950/aQVbyySP4HD3pcwLQIUUMHyo/El/akYOUYhSNvWNSxtJHMCFQCTUQVoEevQTHc9Yh/2ug/TLHIjrg==X02k8</crowd.license.key>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-config-files-server</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/server-crowd-home</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.cargo</groupId>
                        <artifactId>cargo-maven2-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>functest</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-functest-plugins</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>functest-plugin, crowd-functest-plugin</includeArtifactIds>
                                    <outputDirectory>${crowd.shared}/plugins</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>cluster-functest-plugin-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/functest/**/*.java</include>
                                    </includes>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <!-- Runs Crowd cluster acceptance tests, only makes sense with -Pcluster -->
            <id>cluster-acceptance-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>cluster-acceptance-tests</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/cluster/**/*.java</include>
                                    </includes>
                                    <systemPropertyVariables>
                                        <crowd.node.urls>${crowd.node.urls}</crowd.node.urls>
                                        <openldap.port>${openldap.port}</openldap.port>
                                        <dummy.plugin.jar>${project.basedir}/crowd-dummy-plugin/target/crowd-dummy-plugin-${project.version}.jar</dummy.plugin.jar>
                                        <atst.plugin.jar>${crowd.home}/bundled-plugins/plugin-crowd-${atlassian.atst.version}.jar</atst.plugin.jar>
                                    </systemPropertyVariables>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>postgres</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-crowd-config-files-postgres</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-home-postgres</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.postgres.skip>false</docker.postgres.skip>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>
            </properties>
        </profile>
        <profile>
            <id>postgres-logs</id>
            <properties>
                <docker.postgres.opts>-c log_statement=all</docker.postgres.opts>
            </properties>
        </profile>

        <profile>
            <id>mysql</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-crowd-config-files-mysql</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-home-external-db</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.shared}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.mysql.skip>false</docker.mysql.skip>
                <docker.wait.log>MySQL init process done. Ready for start up.</docker.wait.log>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>

                <!-- properties for crowd.cfg.xml -->
                <database.username>crowd</database.username>
                <database.password>crowd</database.password>

                <database.driver>com.mysql.jdbc.Driver</database.driver>
                <database.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</database.dialect>
                <database.url>jdbc:mysql://localhost:${db.port}/crowd?autoReconnect=true&amp;amp;characterEncoding=utf8&amp;amp;useUnicode=true</database.url>
            </properties>
        </profile>

        <profile>
            <id>oracle</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-crowd-config-files-oracle</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-home-external-db</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd.shared}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                </plugins>
            </build>
            <properties>
                <docker.skip>false</docker.skip>
                <docker.oracle.skip>false</docker.oracle.skip>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>

                <!-- properties for crowd.cfg.xml -->
                <database.username>crowd</database.username>
                <database.password>crowd</database.password>
                <database.driver>oracle.jdbc.OracleDriver</database.driver>
                <database.dialect>com.atlassian.crowd.util.persistence.hibernate.CustomOracle10gDialect</database.dialect>
                <database.url>jdbc:oracle:thin:@localhost:${db.port}:xe</database.url>
            </properties>
        </profile>

        <profile>
            <id>remote-crowd-acceptance-tests</id>
            <properties>
                <crowd2.home>${project.build.directory}/crowd2-home</crowd2.home>
                <crowd2.setup.skip>false</crowd2.setup.skip>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <!-- Crowd #1 is setup by the main pom (w/o any profile) -->

                            <!-- then setup Crowd #2 -->
                            <execution>
                                <id>copy-crowd2-config-files-remote-crowd</id>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                                <configuration>
                                    <resources>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-hsql/common</directory>
                                        </resource>
                                        <resource>
                                            <directory>${basedir}/src/test/conf/crowd-hsql/crowd2</directory>
                                            <filtering>true</filtering>
                                        </resource>
                                    </resources>
                                    <outputDirectory>${crowd2.home}</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-test-plugins-crowd2</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>copy-dependencies</goal>
                                </goals>
                                <configuration>
                                    <includeArtifactIds>crowd-decorator-test-plugin,crowd-testkit-plugin${cargo.additional.plugins}</includeArtifactIds>
                                    <outputDirectory>${crowd2.home}/shared/plugins</outputDirectory>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <!--Runs the Crowd-to-Crowd tests.-->
                        <executions>
                            <execution>
                                <id>test-remote-crowd</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/synchronisation/remote/**/*.java</include>
                                    </includes>
                                    <skip>${maven.test.skip}</skip>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>crowd-web-load-tests</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.gatling</groupId>
                        <artifactId>gatling-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>run-gatling-tests</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <phase>integration-test</phase>

                                <configuration>
                                    <simulationsFolder>crowd-web-load-test/src/test/scala</simulationsFolder>
                                    <configFolder>crowd-web-load-test/src/test/resources</configFolder>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.gmaven</groupId>
                        <artifactId>groovy-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>upload-results-to-statsd</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>execute</goal>
                                </goals>
                                <configuration>
                                    <properties>
                                        <logFilePattern>/stats.json</logFilePattern>
                                        <prefix>crowd.ci.webloadtest</prefix>
                                        <parser>json</parser>
                                    </properties>
                                    <source>${project.basedir}/src/test/bin/saveStats.groovy</source>
                                </configuration>
                            </execution>
                        </executions>
                        <dependencies>
                            <dependency>
                                <groupId>com.datadoghq</groupId>
                                <artifactId>java-dogstatsd-client</artifactId>
                                <version>2.8</version>
                            </dependency>
                            <dependency>
                                <groupId>com.atlassian.fugue</groupId>
                                <artifactId>fugue</artifactId>
                                <version>${fugue.version}</version>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>zip-gatling-reports</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${project.build.directory}/gatling</outputDirectory>
                                    <descriptors>
                                        <descriptor>crowd-web-load-test/src/main/assembly/gatling-reports.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>com.atlassian.crowd</groupId>
                    <artifactId>crowd-web-load-test</artifactId>
                    <version>${project.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.scala-lang</groupId>
                    <artifactId>scala-library</artifactId>
                    <version>${gatling.scala.version}</version>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>maven-cargo-crowdid-wait</id>
            <activation>
                <property>
                    <name>cargo.wait.crowdid</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <crowdid.cargo.goal>run</crowdid.cargo.goal>
            </properties>
        </profile>

        <profile>
            <id>better-sso-test</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <!-- run Crowd Better SSO functional tests -->
                            <execution>
                                <id>test-crowd-admin</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>com/atlassian/crowd/acceptance/tests/license/LicenseSetupTest.java</include>
                                        <include>com/atlassian/crowd/acceptance/tests/bettersso/**/*.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
            <dependencies>
                <dependency>
                    <groupId>org.mock-server</groupId>
                    <artifactId>mockserver-netty</artifactId>
                </dependency>
            </dependencies>
        </profile>

        <profile>
            <id>restore-crowd-during-setup-test</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>restore-crowd-during-setup-test</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>**/SetupCrowdUsingXmlFileTest.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                        <property>
                                            <name>crowd.node.urls</name>
                                            <value>${crowd.node.urls}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>forged-license-setup-test</id>
            <properties>
                <xvfb.enable>true</xvfb.enable>
                <skip.copy.h2.crowd.home>true</skip.copy.h2.crowd.home>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>restore-crowd-during-setup-test</id>
                                <goals>
                                    <goal>integration-test</goal>
                                </goals>
                                <phase>integration-test</phase>
                                <configuration>
                                    <includes>
                                        <include>**/SetupCrowdTestForgedLicense.java</include>
                                    </includes>
                                    <systemProperties>
                                        <property>
                                            <name>xvfb.enable</name>
                                            <value>${xvfb.enable}</value>
                                        </property>
                                        <property>
                                            <name>xvfb.display</name>
                                            <value>${xvfb.display}</value>
                                        </property>
                                        <property>
                                            <name>crowd.node.urls</name>
                                            <value>${crowd.node.urls}</value>
                                        </property>
                                    </systemProperties>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>quickreload</id>
            <properties>
                <cargo.additional.plugins>,quickreload</cargo.additional.plugins>
            </properties>
        </profile>
    </profiles>

    <build>
        <plugins>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <configuration>
                    <images>
                        <image>
                            <alias>dc-apacheds</alias>
                            <name>crowd-apacheds-server:${project.version}</name>
                            <run>
                                <skip>${docker.apacheds.skip}</skip>
                                <ports>
                                    <port>8089:8080</port>
                                    <port>12389:10389</port>
                                </ports>
                                <wait>
                                    <log>Server startup in</log>
                                    <time>1200000</time>
                                </wait>
                                <log>
                                    <prefix>apacheds</prefix>
                                </log>
                                <namingStrategy>alias</namingStrategy>
                            </run>
                        </image>
                        <image>
                            <alias>dc-postgres</alias>
                            <name>postgres:9.5</name>

                            <run>
                                <skip>${docker.postgres.skip}</skip>
                                <ports>
                                    <port>db.port:5432</port>
                                </ports>
                                <env>
                                    <POSTGRES_DB>crowd</POSTGRES_DB>
                                    <POSTGRES_USER>crowd</POSTGRES_USER>
                                    <POSTGRES_PASSWORD>crowd</POSTGRES_PASSWORD>
                                </env>
                                <volumes>
                                    <bind>
                                        <volume>${basedir}/src/test/conf/basic-crowd-db:/docker-entrypoint-initdb.d</volume>
                                    </bind>
                                </volumes>
                                <wait>
                                    <log>PostgreSQL init process complete</log>
                                    <time>1200000</time>
                                </wait>
                                <log>
                                    <prefix>postgres</prefix>
                                </log>
                                <namingStrategy>alias</namingStrategy>
                                <cmd>${docker.postgres.opts}</cmd>
                            </run>
                        </image>

                        <image>
                            <alias>crowdtestrunner-mysql</alias>
                            <name>mysql:5.7.34</name>
                            <run>
                                <skip>${docker.mysql.skip}</skip>
                                <ports>
                                    <port>db.port:3306</port>
                                </ports>
                                <env>
                                    <MYSQL_DATABASE>crowd</MYSQL_DATABASE>
                                    <MYSQL_USER>crowd</MYSQL_USER>
                                    <MYSQL_PASSWORD>crowd</MYSQL_PASSWORD>
                                    <MYSQL_ROOT_PASSWORD>password</MYSQL_ROOT_PASSWORD>
                                </env>
                                <volumes>
                                    <bind>
                                        <volume>${basedir}/src/test/conf/crowd-db-mysql:/docker-entrypoint-initdb.d</volume>
                                    </bind>
                                </volumes>
                                <wait>
                                    <log>${docker.wait.log}</log>
                                    <time>1200000</time>
                                </wait>
                                <log>
                                    <prefix>mysql</prefix>
                                </log>
                                <namingStrategy>alias</namingStrategy>
                                <cmd>--character-set-server=utf8 --collation-server=utf8_bin --transaction-isolation=READ-COMMITTED</cmd>
                            </run>
                        </image>

                        <image>
                            <alias>crowdtestrunner-oracle</alias>
                            <name>docker.atl-paas.net/crowd/sath89-oracle12c-precooked:latest</name>
                            <run>
                                <skip>${docker.oracle.skip}</skip>
                                <ports>
                                    <port>db.port:1521</port>
                                </ports>
                                <env>
                                    <IMPORT_FROM_VOLUME>true</IMPORT_FROM_VOLUME>
                                    <WEB_CONSOLE>false</WEB_CONSOLE>
                                </env>
                                <volumes>
                                    <bind>
                                        <volume>${basedir}/src/test/conf/crowd-db-oracle:/docker-entrypoint-initdb.d</volume>
                                    </bind>
                                </volumes>
                                <wait>
                                    <log>Database ready</log>
                                    <time>1200000</time>
                                </wait>
                                <log>
                                    <prefix>oracle</prefix>
                                </log>
                                <namingStrategy>alias</namingStrategy>
                            </run>
                        </image>

                        <image>
                            <alias>dc-openldap</alias>
                            <name>dinkel/openldap</name>

                            <run>
                                <skip>${docker.openldap.skip}</skip>
                                <ports>
                                    <port>openldap.port:389</port>
                                </ports>
                                <env>
                                    <SLAPD_PASSWORD>admin</SLAPD_PASSWORD>
                                    <SLAPD_DOMAIN>example.com</SLAPD_DOMAIN>
                                </env>
                                <volumes>
                                    <bind>
                                        <volume>${openldap.ldif.dir}:/etc/ldap.dist/prepopulate</volume>
                                    </bind>
                                </volumes>
                                <wait>
                                    <log>slapd starting</log>
                                    <time>1200000</time>
                                </wait>
                                <log>
                                    <prefix>openldap</prefix>
                                </log>
                                <namingStrategy>alias</namingStrategy>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</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>
                                <artifactItem>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-acceptance-test</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-rest-test</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-decorator-test</artifactId>
                                    <version>${project.version}</version>
                                </artifactItem>
                            </artifactItems>

                            <outputDirectory>${acceptanceTestClassDirectory}</outputDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-test-plugins</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <skip>${crowd.setup.skip}</skip>
                            <includeArtifactIds>crowd-decorator-test-plugin,crowd-testkit-plugin${cargo.additional.plugins}</includeArtifactIds>
                            <outputDirectory>${crowd.shared}/plugins</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <!-- this is here to make sure it's executed before cargo in pre-integration-test -->
                <artifactId>maven-resources-plugin</artifactId>
                <version>${maven-resources-plugin.version}</version>
            </plugin>

            <plugin>
                <!-- this is here to make sure it's executed before cargo in pre-integration-test -->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sql-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <executions>
                    <!-- CrowdID, skipped unless crowdid.setup.skip == false -->
                    <execution>
                        <id>start-crowdid-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>${crowdid.cargo.goal}</goal>
                        </goals>
                        <configuration>
                            <skip>${crowdid.setup.skip}</skip>
                            <container>
                                <output>${crowdid.cargo.output}</output>
                                <log>${crowdid.cargo.log}</log>
                                <systemProperties>
                                    <crowd.openid.home>${acceptanceTestClassDirectory}/openid-server-home</crowd.openid.home>
                                </systemProperties>
                                <dependencies>
                                    <dependency>
                                        <groupId>org.hsqldb</groupId>
                                        <artifactId>hsqldb</artifactId>
                                        <classifier>jdk8</classifier>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.transaction</groupId>
                                        <artifactId>jta</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.mail</groupId>
                                        <artifactId>javax.mail-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.mail</groupId>
                                        <artifactId>javax.mail</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.activation</groupId>
                                        <artifactId>javax.activation-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.activation</groupId>
                                        <artifactId>javax.activation</artifactId>
                                    </dependency>
                                </dependencies>
                            </container>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowdid/container</home>
                                <properties>
                                    <cargo.servlet.port>${crowdid.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.rmi.port>${crowdid.cargo.rmi.port}</cargo.rmi.port>
                                    <cargo.tomcat.ajp.port>${crowdid.cargo.ajp.port}</cargo.tomcat.ajp.port>
                                    <cargo.jvmargs>
                                        ${crowdid.cargo.debug}
                                        -Dcrowd.openid.properties=${acceptanceTestClassDirectory}/localtest.crowdid.properties
                                        -Dcrowd.property.crowd.server.url=http://localhost:${crowd.cargo.servlet.port}/crowd
                                        -Dcrowd.property.application.login.url.template=http://localhost:8097/openidserver?returnToUrl=$${RETURN_TO_URL}
                                        -Dcrowd.property.application.base.url=http://localhost:${crowdid.cargo.servlet.port}/openidserver
                                        -Djava.awt.headless=true
                                    </cargo.jvmargs>
                                    <cargo.tomcat.uriencoding>UTF-8</cargo.tomcat.uriencoding>
                                    <cargo.datasource.datasource>
                                        cargo.datasource.url=jdbc:hsqldb:mem:crowdid_cargo|
                                        cargo.datasource.driver=org.hsqldb.jdbc.JDBCDriver|
                                        cargo.datasource.username=sa|cargo.datasource.password=|
                                        cargo.datasource.jndi=jdbc/CrowdIDDS|
                                        cargo.datasource.properties=validationQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS
                                    </cargo.datasource.datasource>
                                </properties>
                            </configuration>
                            <deployables>
                                <deployable>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-openid-server</artifactId>
                                    <type>war</type>
                                    <properties>
                                        <context>openidserver</context>
                                    </properties>
                                    <pingURL>http://localhost:${crowdid.cargo.servlet.port}/openidserver</pingURL>
                                    <pingTimeout>${cargo.pingTimeout}</pingTimeout>
                                </deployable>
                                <deployable>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-openid-client</artifactId>
                                    <type>war</type>
                                    <properties>
                                        <context>openidclient</context>
                                    </properties>
                                    <pingURL>http://localhost:${crowdid.cargo.servlet.port}/openidclient</pingURL>
                                    <pingTimeout>${cargo.pingTimeout}</pingTimeout>
                                </deployable>
                            </deployables>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stop-crowdid-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <skip>${crowdid.setup.skip}</skip>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowdid/container</home>
                                <properties>
                                    <cargo.servlet.port>${crowdid.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.tomcat.ajp.port>${crowdid.cargo.ajp.port}</cargo.tomcat.ajp.port>
                                    <cargo.jvmargs>-Djava.awt.headless=true</cargo.jvmargs>
                                </properties>
                            </configuration>
                        </configuration>
                    </execution>

                    <!-- Crowd #2, skipped unless crowd2.setup.skip set to false, non-blocking so needs to start first -->
                    <execution>
                        <id>start-crowd2-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <skip>${crowd2.setup.skip}</skip>
                            <container>
                                <output>${crowd2.cargo.output}</output>
                                <log>${crowd2.cargo.log}</log>
                                <systemProperties>
                                    <crowd.username.header>true</crowd.username.header>
                                    <crowd.appname.header>true</crowd.appname.header>
                                    <upm.plugin.upload.enabled>true</upm.plugin.upload.enabled>
                                </systemProperties>
                                <dependencies>
                                    <dependency>
                                        <groupId>org.hsqldb</groupId>
                                        <artifactId>hsqldb</artifactId>
                                        <classifier>jdk8</classifier>
                                    </dependency>
                                    <dependency>
                                        <groupId>org.postgresql</groupId>
                                        <artifactId>postgresql</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.h2database</groupId>
                                        <artifactId>h2</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.transaction</groupId>
                                        <artifactId>jta</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.mail</groupId>
                                        <artifactId>javax.mail-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.mail</groupId>
                                        <artifactId>javax.mail</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.activation</groupId>
                                        <artifactId>javax.activation-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.activation</groupId>
                                        <artifactId>javax.activation</artifactId>
                                    </dependency>
                                </dependencies>
                            </container>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowd2/container</home>
                                <properties>
                                    <cargo.servlet.port>${crowd2.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.rmi.port>${crowd2.cargo.rmi.port}</cargo.rmi.port>
                                    <cargo.tomcat.ajp.port>${crowd2.cargo.ajp.port}</cargo.tomcat.ajp.port>
                                    <cargo.tomcat.uriencoding>UTF-8</cargo.tomcat.uriencoding>
                                    <cargo.jvmargs>${crowd2.cargo.debug} -Xms128m -Xmx1024m -Dcrowd.home=${crowd2.home} -Dcrowd.polling.startdelay=86400000 -Djava.awt.headless=true ${crowd.cargo.extra.jvmargs}</cargo.jvmargs>
                                </properties>
                            </configuration>
                            <deployables>
                                <deployable>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-web-app</artifactId>
                                    <type>war</type>
                                    <properties>
                                        <context>crowd</context>
                                    </properties>
                                    <!-- ping a URL that is not Johnson-protected and returns HTTP 200 -->
                                    <pingURL>http://localhost:${crowd2.cargo.servlet.port}/crowd/console/favicon.ico</pingURL>
                                    <pingTimeout>${cargo.pingTimeout}</pingTimeout>
                                </deployable>
                            </deployables>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stop-crowd2-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <skip>${crowd2.setup.skip}</skip>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowd2/container</home>
                                <properties>
                                    <cargo.servlet.port>${crowd2.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.tomcat.ajp.port>${crowd2.cargo.ajp.port}</cargo.tomcat.ajp.port>
                                    <cargo.jvmargs>-Djava.awt.headless=true</cargo.jvmargs>
                                </properties>
                            </configuration>
                        </configuration>
                    </execution>

                    <!-- Crowd Container (crowd web-app / security server) + Apache DS -->
                    <execution>
                        <id>start-crowd-container</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>${crowd.cargo.goal}</goal>
                        </goals>
                        <configuration>
                            <skip>${crowd.setup.skip}</skip>
                            <container>
                                <output>${crowd.cargo.output}</output>
                                <log>${crowd.cargo.log}</log>
                                <systemProperties>
                                    <ldap.server.example.ldif>${acceptanceTestClassDirectory}/example.ldif</ldap.server.example.ldif>
                                    <crowd.username.header>true</crowd.username.header>
                                    <crowd.appname.header>true</crowd.appname.header>
                                    <upm.plugin.upload.enabled>true</upm.plugin.upload.enabled>
                                </systemProperties>
                                <dependencies>
                                    <dependency>
                                        <groupId>org.hsqldb</groupId>
                                        <artifactId>hsqldb</artifactId>
                                        <classifier>jdk8</classifier>
                                    </dependency>
                                    <dependency>
                                        <groupId>org.postgresql</groupId>
                                        <artifactId>postgresql</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.h2database</groupId>
                                        <artifactId>h2</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>mysql</groupId>
                                        <artifactId>mysql-connector-java</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.oracle.database.jdbc</groupId>
                                        <artifactId>ojdbc8</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>net.sourceforge.jtds</groupId>
                                        <artifactId>jtds</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.transaction</groupId>
                                        <artifactId>jta</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.mail</groupId>
                                        <artifactId>javax.mail-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.mail</groupId>
                                        <artifactId>javax.mail</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>javax.activation</groupId>
                                        <artifactId>javax.activation-api</artifactId>
                                    </dependency>
                                    <dependency>
                                        <groupId>com.sun.activation</groupId>
                                        <artifactId>javax.activation</artifactId>
                                    </dependency>
                                </dependencies>
                            </container>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowd/container</home>

                                <configfiles>
                                    <configfile>
                                        <file>${basedir}/src/test/conf/server.xml</file>
                                        <todir>conf/</todir>
                                        <tofile>server.xml</tofile>
                                        <configfile>true</configfile>
                                        <overwrite>true</overwrite>
                                    </configfile>
                                </configfiles>

                                <properties>
                                    <!-- These must match the provided server.xml -->
                                    <cargo.servlet.port>${crowd.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.rmi.port>${crowd.cargo.rmi.port}</cargo.rmi.port>
                                    <cargo.tomcat.ajp.port>${crowd.cargo.ajp.port}</cargo.tomcat.ajp.port>

                                    <cargo.jvmargs>${crowd.cargo.debug} -Xms128m -Xmx1024m -Dcrowd.home=${crowd.home} -Dapacheds.ldap.port=${apacheds.1.5.ldap.port} -Dcrowd.polling.startdelay=86400000 -Djava.awt.headless=true -Dcluster.node.name=buzz ${crowd.cargo.extra.jvmargs}</cargo.jvmargs>
                                </properties>
                            </configuration>
                            <deployables>
                                <deployable>
                                    <groupId>com.atlassian.crowd</groupId>
                                    <artifactId>crowd-web-app</artifactId>
                                    <type>war</type>
                                    <properties>
                                        <context>crowd</context>
                                    </properties>
                                    <!-- ping a URL that is not Johnson-protected and returns HTTP 200 -->
                                    <pingURL>http://localhost:${crowd.cargo.servlet.port}/crowd/console/favicon.ico
                                    </pingURL>
                                    <pingTimeout>${cargo.pingTimeout}</pingTimeout>
                                </deployable>
                            </deployables>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stop-crowd-container</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                        <configuration>
                            <skip>${crowd.setup.skip}</skip>
                            <configuration>
                                <home>${project.build.directory}/${cargo.containerid}-crowd/container</home>
                                <properties>
                                    <cargo.servlet.port>${crowd.cargo.servlet.port}</cargo.servlet.port>
                                    <cargo.tomcat.ajp.port>${crowd.cargo.ajp.port}</cargo.tomcat.ajp.port>
                                    <cargo.jvmargs>-Djava.awt.headless=true</cargo.jvmargs>
                                </properties>
                            </configuration>
                        </configuration>
                    </execution>
                </executions>

            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>${maven-resources-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>copy-crowd-config-files-hsql</id>
                            <goals>
                                <goal>copy-resources</goal>
                            </goals>
                            <phase>pre-integration-test</phase>
                            <configuration>
                                <skip>${skip.copy.h2.crowd.home}</skip>
                                <resources>
                                    <resource>
                                        <directory>${basedir}/src/test/conf/crowd-hsql/common</directory>
                                    </resource>
                                    <resource>
                                        <directory>${basedir}/src/test/conf/crowd-hsql/crowd1</directory>
                                        <filtering>true</filtering>
                                    </resource>
                                </resources>
                                <outputDirectory>${crowd.home}</outputDirectory>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <artifactId>maven-failsafe-plugin</artifactId>

                    <configuration>
                        <testClassesDirectory>${acceptanceTestClassDirectory}</testClassesDirectory>
                        <systemPropertyVariables>
                            <acceptance.test.crowd.port>${crowd.cargo.servlet.port}</acceptance.test.crowd.port>
                            <acceptance.test.crowd2.port>${crowd2.cargo.servlet.port}</acceptance.test.crowd2.port>
                            <acceptance.test.crowdid.port>${crowdid.cargo.servlet.port}</acceptance.test.crowdid.port>
                            <acceptance.test.crowdidclient.port>${crowdid.cargo.servlet.port}</acceptance.test.crowdidclient.port>
                            <crowd.property.crowd.server.url>http://localhost:${crowd.cargo.servlet.port}/crowd</crowd.property.crowd.server.url>
                            <crowd.url>${crowd.url}</crowd.url>
                            <crowd.home>${crowd.home}</crowd.home>
                            <crowd.license>${crowd.license}</crowd.license>
                        </systemPropertyVariables>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

