<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">

  <parent>
    <groupId>com.atlassian.bamboo</groupId>
    <artifactId>atlassian-bamboo</artifactId>
    <version>3.4.3</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.atlassian.bamboo</groupId>
  <artifactId>atlassian-acceptance-test</artifactId>

  <packaging>jar</packaging>

  <name>Atlassian Bamboo Acceptance Test Module</name>

  <properties>
    <clover.distributed.coverage>OFF</clover.distributed.coverage>
    <installDir>${java.io.tmpdir}/cargo/installs</installDir>
    <serverPort>9087</serverPort>
    <brokerUri>tcp://localhost:61610</brokerUri>
    <serverJvmArgs>-server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -DhideDashboard=true -DacceptanceTestSettings=${acceptanceTestSettings}</serverJvmArgs>
    <surefireArgs>-Xmx512m</surefireArgs>

    <test.host>localhost</test.host>

    <db.host>${test.host}</db.host>
    <bamboo.builders.enabled>true</bamboo.builders.enabled>
  </properties>

  <profiles>
    <profile>
      <id>clover-optimize</id>
      <dependencies>
        <dependency>
          <groupId>com.cenqua.clover</groupId>
          <artifactId>clover</artifactId>
          <version>${clover.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-clover2-plugin</artifactId>
            <version>${clover.version}</version>
            <configuration>
              <singleCloverDatabase>true</singleCloverDatabase>
              <forceSnapshot>true</forceSnapshot>
              <optimizeIncludes>
                <optimizeInclude>com/atlassian/bamboo/**/*Test.java</optimizeInclude>
              </optimizeIncludes>
              <optimizeExcludes>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/PerformanceBuildTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/ImportFrom1_2_4Test.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/ImportFrom2_0_3Test.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/LdapLoginTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/RemoteAgentTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/salintegraton/tests/*.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/harness/*.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/utils/**/*.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/remote/*.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/MinBuildTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/SetupBambooTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/IndexDrivenReportsTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/MassiveBuildQueueReconstructionTest.java</optimizeExclude>
                <optimizeExclude>com/atlassian/bamboo/acceptance/tests/BulkCreateTestPlans.java</optimizeExclude>
              </optimizeExcludes>
            </configuration>

            <executions>
              <execution>
                <id>10_setup</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>optimize</goal>
                </goals>
              </execution>
              <execution>
                <id>snapshot</id>
                <phase>verify</phase>
                <goals>
                  <goal>snapshot</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <properties>
        <clover.distributed.coverage>port=${clover.port};numClients=1;timeout=${clover.timeout}</clover.distributed.coverage>
        <clover.server>true</clover.server>
        <jvm.args>-XX:MaxPermSize=256M -Djava.awt.headless=true -Xmx512m</jvm.args>
        <maven.test.failure.ignore>true</maven.test.failure.ignore>
      </properties>
    </profile>


    <profile>
      <id>functest</id>
      <properties>
        <testClassName>BambooAcceptanceTestHarness</testClassName>
        <artifactToDeploy>atlassian-bamboo-web-app</artifactToDeploy>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/5.5.23/apache-tomcat-5.5.23.zip</downloadUrl>
        <brokerUri>tcp://localhost:61620</brokerUri>

        <jdbc.artifactGroup>hsqldb</jdbc.artifactGroup>
        <jdbc.artifactId>hsqldb</jdbc.artifactId>

        <testng.setup>testng-setup.xml</testng.setup>
        <testng.suites>testng-requires-clean.xml,testng-sequential.xml,testng-permissions.xml,testng-notification.xml,testng-svn.xml,testng-svn-noncore.xml,testng-repository.xml,testng-misc.xml,testng-config.xml,testng-dependencies.xml</testng.suites>
      </properties>

      <build>
        <testResources>
          <testResource>
            <directory>src/it/resources</directory>
          </testResource>
        </testResources>
        <plugins>

          <!-- Make sure that the /it/resources is picked up in the resources phase -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>testResources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Cargo plugin definition-->
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>

            <!-- Default plugin definition for cargo maven plugin-->
            <configuration>

              <!-- Wait since we want the container startup to wait -->
              <wait>false</wait>

              <!-- Config the server to be started -->
              <container>
                <containerId>${containerId}</containerId>
                <output>output.log</output>
                <log>cargo-log.log</log>
                <systemProperties>
                  <bamboo.home>${project.build.directory}/bamboo-home</bamboo.home>
                  <bamboo.jms.broker.uri>${brokerUri}</bamboo.jms.broker.uri>
                  <clover.distributed.coverage>${clover.distributed.coverage}</clover.distributed.coverage>
                  <bamboo.builders.enabled>${bamboo.builders.enabled}</bamboo.builders.enabled>
                </systemProperties>
                <!--<home>${containerHome}</home>-->
                <zipUrlInstaller>
                  <url>${downloadUrl}</url>
                  <installDir>${installDir}</installDir>
                </zipUrlInstaller>

                <dependencies>
                  <dependency>
                    <groupId>${jdbc.artifactGroup}</groupId>
                    <artifactId>${jdbc.artifactId}</artifactId>
                  </dependency>
                </dependencies>
              </container>

              <!-- Cargo config element -->
              <configuration>
                <home>${project.build.directory}/tomcat5x/container</home>
                <properties>
                  <cargo.servlet.port>${serverPort}</cargo.servlet.port>
                  <cargo.rmi.port>10546</cargo.rmi.port>
                  <cargo.jvmargs>${serverJvmArgs}</cargo.jvmargs>
                  <cargo.logging>high</cargo.logging>
                </properties>
              </configuration>

              <deployer>
                <deployables>
                  <deployable>
                    <groupId>com.atlassian.bamboo</groupId>
                    <artifactId>${artifactToDeploy}</artifactId>
                    <location>${bamboo.war.override}</location>
                    <type>war</type>
                    <pingURL>http://localhost:${serverPort}/bamboo</pingURL>
                    <pingTimeout>240000</pingTimeout>
                    <properties>
                      <context>bamboo</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>

            </configuration>
            <!-- END maven config element -->

            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                  <goal>deploy</goal>
                </goals>
              </execution>

              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Run the ${testClassName} as part of the test-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>bambooSetupForFunctionalTests</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>${testng.setup}</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                  <systemProperties>
                    <property>
                      <name>acceptanceTestSettings</name>
                      <value>${acceptanceTestSettings}</value>
                    </property>
                    <property>
                      <name>bamboo.acceptance.exception.detection</name>
                      <value>${bamboo.acceptance.exception.detection}</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
              <execution>
                <id>bambooFunctionalTests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>${testng.suites}</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <testFailureIgnore>${maven.test.failure.ignore}</testFailureIgnore>
                  <argLine>${surefireArgs}</argLine>
                  <systemProperties>
                    <property>
                      <name>clover.distributed.coverage</name>
                      <value>${clover.distributed.coverage}</value>
                    </property>
                    <property>
                      <name>bamboo.acceptance.exception.detection</name>
                      <value>${bamboo.acceptance.exception.detection}</value>
                    </property>
                    <property>
                      <name>clover.server</name>
                      <value>true</value>
                    </property>
                  </systemProperties>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <argLine>${surefireArgs}</argLine>
              <skip>true</skip>
            </configuration>
          </plugin>

          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <executions>
              <execution>
                <id>auto-clean</id>
                <phase>validate</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile>
      <id>remoteAgentFuncTest</id>
      <properties>
        <testClassName>RemoteAgentAcceptanceTestHarness</testClassName>
        <artifactToDeploy>atlassian-bamboo-web-app</artifactToDeploy>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/5.5.23/apache-tomcat-5.5.23.zip</downloadUrl>
        <serverPort>9987</serverPort>
        <brokerUri>tcp://localhost:61619</brokerUri>
      </properties>

      <build>
        <testResources>
          <testResource>
            <directory>src/it/resources</directory>
          </testResource>
        </testResources>
        <plugins>

          <!-- Cargo plugin definition-->
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>

            <!-- Default plugin definition for cargo maven plugin-->
            <configuration>

              <!-- Wait since we want the container startup to wait -->
              <wait>false</wait>

              <!-- Config the server to be started -->
              <container>
                <containerId>${containerId}</containerId>
                <output>output.log</output>
                <log>cargo-log.log</log>
                <systemProperties>
                  <bamboo.home>${project.build.directory}/bamboo-home</bamboo.home>
                  <bamboo.jms.broker.uri>${brokerUri}</bamboo.jms.broker.uri>
                </systemProperties>
                <!--<home>${containerHome}</home>-->
                <zipUrlInstaller>
                  <url>${downloadUrl}</url>
                  <installDir>${installDir}</installDir>
                </zipUrlInstaller>
              </container>

              <!-- Cargo config element -->
              <configuration>
                <home>${project.build.directory}/tomcat5x/container</home>
                <properties>
                  <cargo.servlet.port>${serverPort}</cargo.servlet.port>
                  <cargo.rmi.port>10547</cargo.rmi.port>
                  <cargo.jvmargs>${serverJvmArgs}</cargo.jvmargs>
                  <cargo.logging>high</cargo.logging>
                </properties>
              </configuration>

              <deployer>
                <deployables>
                  <deployable>
                    <groupId>com.atlassian.bamboo</groupId>
                    <artifactId>${artifactToDeploy}</artifactId>
                    <type>war</type>
                    <pingURL>http://localhost:${serverPort}/bamboo</pingURL>
                    <pingTimeout>240000</pingTimeout>
                    <properties>
                      <context>bamboo</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>

            </configuration>
            <!-- END maven config element -->

            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                  <goal>deploy</goal>
                </goals>
              </execution>

              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Run the ${testClassName} as part of the test-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>bambooSetupForFunctionalTests</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>testng-setup.xml</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                </configuration>
              </execution>
              <execution>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>testng-remote.xml</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <argLine>${surefireArgs}</argLine>
              <skip>true</skip>
              <systemProperties>
                <property>
                  <name>bamboo.jms.broker.uri</name>
                  <value>${brokerUri}</value>
                </property>
                <property>
                  <name>acceptance.test.webapp.port</name>
                  <value>${serverPort}</value>
                </property>
                <property>
                  <name>acceptance.test.webapp.context</name>
                  <value>/bamboo/</value>
                </property>
                <property>
                  <name>acceptance.test.version</name>
                  <value>${project.version}</value>
                </property>
              </systemProperties>
            </configuration>
          </plugin>

          <!-- Make sure that the /it/resources is picked up in the resources phase -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>testResources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <executions>
              <execution>
                <id>auto-clean</id>
                <phase>validate</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile>
      <id>salIntegrationTest</id>
      <properties>
        <testClassName>SalIntegrationTestHarness</testClassName>
        <artifactToDeploy>atlassian-bamboo-web-app</artifactToDeploy>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/5.5.23/apache-tomcat-5.5.23.zip</downloadUrl>
        <serverPort>9986</serverPort>
        <brokerUri>tcp://localhost:61620</brokerUri>
      </properties>

      <dependencies>
        <dependency>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>atlassian-bamboo-plugin-salintegrationtest</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
      <build>
        <testResources>
          <testResource>
            <directory>src/it/resources</directory>
          </testResource>
        </testResources>
        <plugins>

          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>copy</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>com.atlassian.bamboo</groupId>
                      <artifactId>atlassian-bamboo-plugin-salintegrationtest</artifactId>
                      <version>${project.version}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bamboo-home/plugins/</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>com.atlassian.refapp</groupId>
                      <artifactId>platform-ctk-plugin</artifactId>
                      <version>${platformCompliancyVersion}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bamboo-home/plugins/</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>com.atlassian.functest</groupId>
                      <artifactId>functest-plugin</artifactId>
                      <version>${fpVersion}</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/bamboo-home/plugins/</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>


          <!-- Cargo plugin definition-->
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>

            <!-- Default plugin definition for cargo maven plugin-->
            <configuration>

              <!-- Wait since we want the container startup to wait -->
              <wait>false</wait>

              <!-- Config the server to be started -->
              <container>
                <containerId>${containerId}</containerId>
                <output>output.log</output>
                <log>cargo-log.log</log>
                <systemProperties>
                  <bamboo.home>${project.build.directory}/bamboo-home</bamboo.home>
                  <bamboo.jms.broker.uri>${brokerUri}</bamboo.jms.broker.uri>
                </systemProperties>
                <!--<home>${containerHome}</home>-->
                <zipUrlInstaller>
                  <url>${downloadUrl}</url>
                  <installDir>${installDir}</installDir>
                </zipUrlInstaller>
              </container>

              <!-- Cargo config element -->
              <configuration>
                <home>${project.build.directory}/tomcat5x/container</home>
                <properties>
                  <cargo.servlet.port>${serverPort}</cargo.servlet.port>
                  <cargo.rmi.port>10547</cargo.rmi.port>
                  <cargo.jvmargs>${serverJvmArgs}</cargo.jvmargs>
                  <cargo.logging>high</cargo.logging>
                </properties>
              </configuration>

              <deployer>
                <deployables>
                  <deployable>
                    <groupId>com.atlassian.bamboo</groupId>
                    <artifactId>${artifactToDeploy}</artifactId>
                    <type>war</type>
                    <pingURL>http://localhost:${serverPort}/bamboo</pingURL>
                    <pingTimeout>240000</pingTimeout>
                    <properties>
                      <context>bamboo</context>
                    </properties>
                  </deployable>
                </deployables>
              </deployer>

            </configuration>
            <!-- END maven config element -->

            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                  <goal>deploy</goal>
                </goals>
              </execution>

              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <!-- Run the ${testClassName} as part of the test-->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>bambooSetupForFunctionalTests</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>testng-setup.xml</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                </configuration>
              </execution>
              <execution>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>testng-sal.xml</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                </configuration>
              </execution>
            </executions>
            <configuration>
              <argLine>${surefireArgs}</argLine>
              <skip>true</skip>
              <systemProperties>
                <property>
                  <name>bamboo.jms.broker.uri</name>
                  <value>${brokerUri}</value>
                </property>
                <property>
                  <name>acceptance.test.webapp.port</name>
                  <value>${serverPort}</value>
                </property>
                <property>
                  <name>acceptance.test.webapp.context</name>
                  <value>/bamboo/</value>
                </property>
                <property>
                  <name>acceptance.test.version</name>
                  <value>${project.version}</value>
                </property>
              </systemProperties>
            </configuration>
          </plugin>

          <!-- Make sure that the /it/resources is picked up in the resources phase -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <goals>
                  <goal>testResources</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <executions>
              <execution>
                <id>auto-clean</id>
                <phase>validate</phase>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

    </profile>

    <profile>
      <id>ldap</id>
      <properties>
        <testClassName>BambooLdapTestHarness</testClassName>
        <artifactToDeploy>atlassian-bamboo-ldap-web-app</artifactToDeploy>
        <serverPort>9187</serverPort>
        <brokerUri>tcp://localhost:61611</brokerUri>

      </properties>
      <dependencies>

        <!-- Module dependencies -->
        <dependency>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>atlassian-bamboo-ldap-web-app</artifactId>
          <type>war</type>
        </dependency>
      </dependencies>
    </profile>

    <!-- Servers -->
    <profile>
      <id>tomcat5</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/5.0.30/jakarta-tomcat-5.0.30.zip</downloadUrl>
        <serverPort>9287</serverPort>
        <brokerUri>tcp://localhost:61612</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>tomcat55</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/5.5.23/apache-tomcat-5.5.23.zip</downloadUrl>
        <serverPort>9387</serverPort>
        <brokerUri>tcp://localhost:61613</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>tomcat6</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>tomcat5x</containerId>
        <downloadUrl>https://maven.atlassian.com/public/org/apache/tomcat/apache-tomcat/6.0.14/apache-tomcat-6.0.14.zip</downloadUrl>
        <serverPort>9487</serverPort>
        <brokerUri>tcp://localhost:61614</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>orion2</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>orion2x</containerId>
        <downloadUrl>http://www.orionserver.com/distributions/orion2.0.7.zip</downloadUrl>
        <serverPort>9587</serverPort>
        <brokerUri>tcp://localhost:61615</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>resin3</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>resin3x</containerId>
        <downloadUrl>http://www.caucho.com/download/resin-3.0.24.zip</downloadUrl>
        <serverPort>9687</serverPort>
        <brokerUri>tcp://localhost:61616</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>resin31</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>resin3x</containerId>
        <downloadUrl>http://www.caucho.com/download/resin-3.1.2.zip</downloadUrl>
        <serverPort>9787</serverPort>
        <brokerUri>tcp://localhost:61617</brokerUri>

      </properties>
    </profile>

    <profile>
      <id>jboss4</id>
      <properties>
        <testClassName>MinimalAcceptanceTestHarness</testClassName>
        <containerId>jboss4x</containerId>
        <downloadUrl>http://downloads.sourceforge.net/jboss/jboss-4.0.5.GA.zip?big_mirror=1</downloadUrl>
        <serverPort>9887</serverPort>
        <brokerUri>tcp://localhost:61618</brokerUri>

      </properties>
    </profile>

    <!-- Database profiles -->
    <profile>
      <id>mysql</id>

      <properties>
        <db.name>MySQL</db.name>
        <db.provider>${db.name}</db.provider>
        <db.port>3306</db.port>
        <db.instance>bamboo-functest</db.instance>
        <db.username>bamboo</db.username>
        <db.password>bamboo</db.password>

        <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
        <jdbc.url>jdbc:mysql://${db.host}:${db.port}</jdbc.url>

        <db.url>${jdbc.url}/${db.instance}?autoReconnect=true&amp;useUnicode=true&amp;useServerPrepStmts=false&amp;characterEncoding=UTF-8</db.url>
        <db.dialect>com.atlassian.hibernate.dialect.MySQL5Dialect</db.dialect>

        <jdbc.artifactGroup>mysql</jdbc.artifactGroup>
        <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
        <jdbc.artifactVersion>5.1.10</jdbc.artifactVersion>

        <acceptanceTestSettings>db-mysql.properties</acceptanceTestSettings>
      </properties>

      <build>
        <plugins>
          <!-- Drop and recreate database -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sql-maven-plugin</artifactId>

            <dependencies>
              <dependency>
                <groupId>${jdbc.artifactGroup}</groupId>
                <artifactId>${jdbc.artifactId}</artifactId>
                <version>${jdbc.artifactVersion}</version>
              </dependency>
            </dependencies>

            <configuration>
              <username>${db.admin.username}</username>
              <password>${db.admin.password}</password>
              <url>${jdbc.url}</url>
              <driver>${jdbc.driver}</driver>
            </configuration>

            <executions>
              <execution>
                <id>drop-database</id>
                <phase>clean</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    DROP DATABASE `${db.instance}`;
                    DROP USER '${db.username}'@'${db.host}';
                  </sqlCommand>
                  <onError>continue</onError>
                </configuration>
              </execution>

              <execution>
                <id>create-database</id>
                <phase>process-test-resources</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    CREATE DATABASE `${db.instance}` CHARACTER SET UTF8;
                    GRANT ALL ON `${db.instance}`.* TO '${db.username}'@'${db.host}' IDENTIFIED BY '${db.password}';
                  </sqlCommand>
                  <onError>abort</onError>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>${jdbc.artifactGroup}</groupId>
          <artifactId>${jdbc.artifactId}</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>mysql-beac</id>
      <properties>
        <db.admin.username>root</db.admin.username>
        <db.admin.password>ceBRe9hu</db.admin.password>
      </properties>
    </profile>

    <profile>
      <id>mysql-ec2</id>
      <properties>
        <db.admin.username>root</db.admin.username>
        <db.admin.password />
      </properties>
    </profile>

    <profile>
      <id>pgsql</id>

      <properties>
        <db.name>PostgreSQL</db.name>
        <db.provider>${db.name}</db.provider>
        <db.port>5432</db.port>
        <db.instance>bamboo-functest</db.instance>
        <db.username>bamboo</db.username>
        <db.password>bamboo</db.password>
        <!-- BEAC PostgreSQL root credentials -->
        <db.admin.username>postgres</db.admin.username>
        <db.admin.password />

        <jdbc.driver>org.postgresql.Driver</jdbc.driver>
        <jdbc.url>jdbc:postgresql://${db.host}:${db.port}</jdbc.url>

        <db.url>${jdbc.url}/${db.instance}</db.url>
        <db.dialect>net.sf.hibernate.dialect.PostgreSQLDialect</db.dialect>

        <jdbc.artifactGroup>postgresql</jdbc.artifactGroup>
        <jdbc.artifactId>postgresql</jdbc.artifactId>
        <jdbc.artifactVersion>8.4-701.jdbc3</jdbc.artifactVersion>

        <acceptanceTestSettings>db-postgresql.properties</acceptanceTestSettings>
      </properties>

      <build>
        <plugins>
          <!-- Drop and recreate database -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sql-maven-plugin</artifactId>

            <dependencies>
              <dependency>
                <groupId>${jdbc.artifactGroup}</groupId>
                <artifactId>${jdbc.artifactId}</artifactId>
                <version>${jdbc.artifactVersion}</version>
              </dependency>
            </dependencies>

            <configuration>
              <username>${db.admin.username}</username>
              <password>${db.admin.password}</password>
              <url>${jdbc.url}</url>
              <driver>${jdbc.driver}</driver>
            </configuration>

            <executions>
              <execution>
                <id>drop-database</id>
                <phase>clean</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    DROP DATABASE "${db.instance}";
                    DROP USER ${db.username};
                  </sqlCommand>
                  <onError>continue</onError>
                </configuration>
              </execution>

              <execution>
                <id>create-database</id>
                <phase>process-test-resources</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';
                    DROP DATABASE template1;
                    CREATE DATABASE template1 WITH template = template0 encoding = 'UTF8';
                    CREATE USER ${db.username} NOSUPERUSER NOCREATEDB NOCREATEROLE ENCRYPTED PASSWORD '${db.password}';
                    CREATE DATABASE "${db.instance}" WITH OWNER ${db.username} ENCODING 'UTF8';
                  </sqlCommand>
                  <onError>abort</onError>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>${jdbc.artifactGroup}</groupId>
          <artifactId>${jdbc.artifactId}</artifactId>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>pgsql-beac</id>
      <properties>
        <db.admin.username>postgres</db.admin.username>
        <db.admin.password>Queerau4</db.admin.password>
      </properties>
    </profile>

    <profile>
      <id>pgsql-ec2</id>
      <properties>
        <db.admin.username>postgres</db.admin.username>
        <db.admin.password />
      </properties>
    </profile>

    <profile>
      <id>oracle</id>

      <properties>
        <db.name>Oracle</db.name>
        <db.provider>${db.name}</db.provider>
        <db.host>localhost</db.host>
        <db.port>1521</db.port>
        <db.instance>XE</db.instance>
        <db.username>bamboo</db.username>
        <db.password>bamboo</db.password>
        <db.admin.username>system</db.admin.username>
        <db.admin.password>root</db.admin.password>

        <jdbc.driver>oracle.jdbc.driver.OracleDriver</jdbc.driver>
        <jdbc.url>jdbc:oracle:thin:@${db.host}:${db.port}:${db.instance}</jdbc.url>

        <db.url>${jdbc.url}/${db.instance}</db.url>
        <db.dialect>net.sf.hibernate.dialect.OracleDialect</db.dialect>

        <jdbc.artifactGroup>com.oracle</jdbc.artifactGroup>
        <jdbc.artifactId>ojdbc14</jdbc.artifactId>
        <jdbc.artifactVersion>10.2.0.4</jdbc.artifactVersion>

        <acceptanceTestSettings>db-oracle10and11g.properties</acceptanceTestSettings>
      </properties>

      <build>
        <plugins>
          <!-- Drop and recreate database -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sql-maven-plugin</artifactId>

            <dependencies>
              <dependency>
                <groupId>${jdbc.artifactGroup}</groupId>
                <artifactId>${jdbc.artifactId}</artifactId>
                <version>${jdbc.artifactVersion}</version>
              </dependency>
            </dependencies>

            <configuration>
              <username>${db.admin.username}</username>
              <password>${db.admin.password}</password>
              <url>${jdbc.url}</url>
              <driver>${jdbc.driver}</driver>
            </configuration>

            <executions>
              <execution>
                <id>drop-database</id>
                <phase>clean</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    DROP USER ${db.username} CASCADE;
                  </sqlCommand>
                  <onError>continue</onError>
                </configuration>
              </execution>

              <execution>
                <id>create-database</id>
                <phase>process-test-resources</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                    CREATE USER ${db.username} identified by ${db.password};
                    GRANT ALL PRIVILEGES TO ${db.username} WITH ADMIN OPTION;
                  </sqlCommand>
                  <onError>abort</onError>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>${jdbc.artifactGroup}</groupId>
          <artifactId>${jdbc.artifactId}</artifactId>
          <version>${jdbc.artifactVersion}</version>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>mssql2005</id>

      <properties>
        <db.name>MSSQL 2005</db.name>
        <db.provider>${db.name}</db.provider>
        <db.host>localhost</db.host>
        <db.port>1433</db.port>
        <db.username>bamboo</db.username>
        <db.password>bamboo</db.password>
        <db.admin.username>sa</db.admin.username>
        <db.admin.password />  <!-- yup, empty password -->

        <jdbc.driver>net.sourceforge.jtds.jdbc.Driver</jdbc.driver>
        <jdbc.url>jdbc:jtds:sqlserver://${db.host}:${db.port}/</jdbc.url>

        <jdbc.artifactGroup>net.sourceforge.jtds</jdbc.artifactGroup>
        <jdbc.artifactId>jtds</jdbc.artifactId>
        <jdbc.artifactVersion>1.2.2</jdbc.artifactVersion>

        <acceptanceTestSettings>db-myssql2005.properties</acceptanceTestSettings>
      </properties>

      <build>
        <plugins>
          <!-- Drop and recreate database -->
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>sql-maven-plugin</artifactId>

            <dependencies>
              <dependency>
                <groupId>${jdbc.artifactGroup}</groupId>
                <artifactId>${jdbc.artifactId}</artifactId>
                <version>${jdbc.artifactVersion}</version>
              </dependency>
            </dependencies>

            <configuration>
              <username>${db.admin.username}</username>
              <password>${db.admin.password}</password>
              <url>${jdbc.url}</url>
              <driver>${jdbc.driver}</driver>
            </configuration>

            <executions>
              <!--<execution>
                <id>drop-database</id>
                <phase>clean</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                  </sqlCommand>
                  <onError>continue</onError>
                </configuration>
              </execution>-->

              <!--<execution>
                <id>create-database</id>
                <phase>process-test-resources</phase>

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

                <configuration>
                  <autocommit>true</autocommit>
                  <sqlCommand>
                  </sqlCommand>
                  <onError>abort</onError>
                </configuration>
              </execution>-->
            </executions>
          </plugin>
        </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>${jdbc.artifactGroup}</groupId>
          <artifactId>${jdbc.artifactId}</artifactId>
          <version>${jdbc.artifactVersion}</version>
        </dependency>
      </dependencies>
    </profile>


  </profiles>

  <dependencies>

    <!-- Module dependencies -->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-web-app</artifactId>
      <type>war</type>
    </dependency>

    <!-- For the tests to be able to assert resource keys-->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-language</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins</groupId>
      <artifactId>atlassian-bamboo-plugin-clover</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.maven</groupId>
      <artifactId>atlassian-bamboo-plugin-maven</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.ant</groupId>
      <artifactId>atlassian-bamboo-plugin-ant</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.testresultparser</groupId>
      <artifactId>atlassian-bamboo-plugin-testresultparser</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.scripttask</groupId>
      <artifactId>atlassian-bamboo-plugin-scripttask</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.php</groupId>
      <artifactId>atlassian-bamboo-plugin-php</artifactId>
    </dependency>

    <dependency>
      <groupId>com.atlassian.bamboo.plugins.vcs</groupId>
      <artifactId>atlassian-bamboo-plugin-vcs</artifactId>
    </dependency>

    <!-- To hit the right URLs-->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-api</artifactId>
    </dependency>

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

    <!-- To reach default image AmiId -->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-agent-elastic-server</artifactId>
    </dependency>

    <!-- Atlassian dependencies -->

    <!-- Other dependencies -->
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
    </dependency>

    <dependency>
      <groupId>tomcat</groupId>
      <artifactId>jasper-compiler</artifactId>
    </dependency>

    <dependency>
      <groupId>tomcat</groupId>
      <artifactId>jasper-runtime</artifactId>
    </dependency>

    <dependency>
      <groupId>net.sourceforge.jwebunit</groupId>
      <artifactId>jwebunit-htmlunit-plugin</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>htmlunit</artifactId>
          <groupId>htmlunit</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <artifactId>htmlunit</artifactId>
      <groupId>htmlunit</groupId>
    </dependency>

    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1.1</version>
    </dependency>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-webapp</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-core-api-container</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-core-api-generic</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.cargo</groupId>
      <artifactId>cargo-core-container-tomcat</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jsp-api</artifactId>
      <scope>runtime</scope>
    </dependency>

    <dependency>
      <groupId>com.icegreen</groupId>
      <artifactId>greenmail</artifactId>
    </dependency>

    <dependency>
      <groupId>org.testng</groupId>
      <artifactId>testng</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>exml</groupId>
      <artifactId>exml</artifactId>
      <version>7.0</version>
    </dependency>

    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>com.atlassian.functest</groupId>
      <artifactId>functest-plugin</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.atlassian.selenium</groupId>
          <artifactId>atlassian-webdriver-core</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>com.atlassian.testtools</groupId>
      <artifactId>atlassian-testtools</artifactId>
      <scope>compile</scope>
      <version>1.8</version>
      <exclusions>
        <exclusion>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
      <dependency>
        <groupId>com.atlassian.refapp</groupId>
        <artifactId>platform-ctk-plugin</artifactId>
        <version>${platformCompliancyVersion}</version>
        <!-- This dependency offers a convenient way for developers to put a breakpoint.
             It is not directly used by the test classes, but this plugin is installed in Bamboo and
             CtkIntegrationTest calls it. It is not technically required here, this is just to
             be developer friendly. -->
        <scope>test</scope>
      </dependency>
  </dependencies>

  <build>

    <testResources>
      <testResource>
        <directory>src/it/resources</directory>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>

    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip> <!-- If no profile specified, run no tests-->
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <executions>
          <execution>
            <id>test-compile</id>
            <phase>compile</phase>
            <goals>
              <goal>testCompile</goal>
            </goals>
            <configuration>
              <skip>false</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>package-test-jar</id>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
            <configuration>
              <excludes>
                <exclude>**/*.key</exclude>
                <exclude>**/*.pub</exclude>
                <exclude>bamboo_tests_id_rsa</exclude>
              </excludes>
              <skip>false</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <testSourceDirectory>src/it/java</testSourceDirectory>
  </build>
</project>
