<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>4.3.2</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 -DacceptanceTestSettings=${acceptanceTestSettings} -Dacceptance.test.db.connection.type=${acceptance.test.db.connection.type}</serverJvmArgs>
    <surefireArgs>-Xmx512m</surefireArgs>

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

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

    <jdbc.dataSourceName>jdbc/bambooDS</jdbc.dataSourceName>
    <acceptance.test.db.connection.type>JDBC</acceptance.test.db.connection.type>

    <mysql.driver.version>5.1.10</mysql.driver.version>
    <oracle.driver.version>11.2.0.1.0</oracle.driver.version>
    <postgres.driver.version>8.4-701.jdbc3</postgres.driver.version>
    <sqlServer.driver.version>1.2.2</sqlServer.driver.version>
  </properties>

  <profiles>
    <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.27/apache-tomcat-5.5.27.zip</downloadUrl>
        <brokerUri>tcp://localhost:61620</brokerUri>

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

        <bamboo.acceptance.ondemand.mode>false</bamboo.acceptance.ondemand.mode>

        <testng.setup>testng-setup.xml</testng.setup>
        <testng.suites>testng-requires-clean.xml,testng-sequential.xml,testng-permissions.xml,testng-notification.xml,testng-notification2.xml,testng-svn.xml,testng-svn-noncore.xml,testng-svn-noncore2.xml,testng-repository.xml,testng-branches-and-multirepository.xml,testng-misc.xml,testng-config.xml,testng-dependencies.xml,testng-dependencies2.xml</testng.suites>

        <jdbc.url.xmlEscaped>${jdbc.url}</jdbc.url.xmlEscaped>
      </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>
            <version>1.1.4</version>

            <!-- 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>
                  <bamboo.acceptance.ondemand.mode>${bamboo.acceptance.ondemand.mode}</bamboo.acceptance.ondemand.mode>
                </systemProperties>
                <!--<home>${containerHome}</home>-->
                <zipUrlInstaller>
                  <url>${downloadUrl}</url>
                  <installDir>${installDir}</installDir>
                  <!--<downloadDir>${installDir}</downloadDir>-->
                  <!--<extractDir>${installDir}</extractDir>-->
                </zipUrlInstaller>

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

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

                  <cargo.datasource.datasource.bamboo>
                    cargo.datasource.driver=${jdbc.driver}|
                    cargo.datasource.url=${jdbc.url.xmlEscaped}|
                    cargo.datasource.jndi=${jdbc.dataSourceName}|
                    cargo.datasource.username=${db.username}|
                    cargo.datasource.password=${db.password}
                  </cargo.datasource.datasource.bamboo>

                </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>
            <!--Those 2 executions will be run in order by maven so the same phase can be used-->
            <executions>
              <execution>
                <id>bambooSetupForFunctionalTests</id>
                <phase>integration-test</phase>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <suiteXmlFiles>
                    <suiteXmlFile>${testng.setup}</suiteXmlFile>
                  </suiteXmlFiles>
                  <skip>false</skip>
                  <argLine>${surefireArgs}</argLine>
                  <systemPropertyVariables>
                    <acceptanceTestSettings>${acceptanceTestSettings}</acceptanceTestSettings>
                    <bamboo.acceptance.exception.detection>${bamboo.acceptance.exception.detection}</bamboo.acceptance.exception.detection>
                    <bamboo.acceptance.ondemand.mode>${bamboo.acceptance.ondemand.mode}</bamboo.acceptance.ondemand.mode>
                  </systemPropertyVariables>
                </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>
                  <systemPropertyVariables>
                    <clover.distributed.coverage>${clover.distributed.coverage}</clover.distributed.coverage>
                    <clover.server>true</clover.server>
                    <bamboo.acceptance.exception.detection>${bamboo.acceptance.exception.detection}</bamboo.acceptance.exception.detection>
                    <bamboo.acceptance.ondemand.mode>${bamboo.acceptance.ondemand.mode}</bamboo.acceptance.ondemand.mode>
                    <acceptance.test.webapp.port>${serverPort}</acceptance.test.webapp.port>
                    <acceptance.test.webapp.context>/bamboo</acceptance.test.webapp.context>
                    <acceptance.test.version>${project.version}</acceptance.test.version>
                    <bamboo.jms.broker.uri>${brokerUri}</bamboo.jms.broker.uri>
                  </systemPropertyVariables>
                </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>ondemand</id>
      <properties>
        <serverJvmArgs>-server -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -DacceptanceTestSettings=${acceptanceTestSettings} -Dbamboo.hosted.mode=true -Dbamboo.hosted.test.mode=true</serverJvmArgs>
        <bamboo.acceptance.ondemand.mode>true</bamboo.acceptance.ondemand.mode>
        <testng.suites>testng-requires-clean-ondemand.xml,testng-sequential-ondemand.xml,testng-permissions-ondemand.xml,testng-notification-ondemand.xml,testng-svn.xml,testng-svn-noncore-ondemand.xml,testng-repository-ondemand.xml,testng-misc-ondemand.xml,testng-config.xml,testng-dependencies.xml,testng-ondemand.xml</testng.suites>
      </properties>
    </profile>

    <profile>
      <id>remoteondemand</id>
      <properties>
        <bamboo.acceptance.ondemand.mode>true</bamboo.acceptance.ondemand.mode>

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

    </profile>

    <profile>
      <id>remoteAgentFuncTest</id>
      <properties>
        <testng.suites>testng-remote.xml</testng.suites>
      </properties>

      <dependencies>
        <dependency>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>bamboo-agent</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>

    <profile>
      <id>salIntegrationTest</id>
      <properties>
        <testng.suites>testng-sal.xml</testng.suites>
      </properties>

      <dependencies>
        <dependency>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>atlassian-bamboo-plugin-salintegrationtest</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy</id>
                <!--
                Couldn't use pre-integration-test phase as cargo:start/cargo:deploy is bound to the same phase and maven can decide
                to run cargo:deploy before copying these JARs. Reordering profiles in POM and in command line didn't help
                -->
                <phase>process-test-resources</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>
        </plugins>
      </build>
    </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>

        <jdbc.driver>com.mysql.jdbc.Driver</jdbc.driver>
        <dbms.url>jdbc:mysql://${db.host}:${db.port}</dbms.url>
        <jdbc.url>${dbms.url}/${db.instance}?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=utf8&amp;sessionVariables=storage_engine=InnoDB</jdbc.url>
        <!-- double XML encoding... so awesome...-->
        <jdbc.url.xmlEscaped>${dbms.url}/${db.instance}?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=utf8&amp;amp;sessionVariables=storage_engine=InnoDB</jdbc.url.xmlEscaped>

        <db.dialect>com.atlassian.hibernate.dialect.MySQL5Dialect</db.dialect>

        <jdbc.artifactGroup>mysql</jdbc.artifactGroup>
        <jdbc.artifactId>mysql-connector-java</jdbc.artifactId>
        <jdbc.artifactVersion>${mysql.driver.version}</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>${dbms.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>
          <version>${jdbc.artifactVersion}</version>
        </dependency>
      </dependencies>
    </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.admin.username>postgres</db.admin.username>
        <db.admin.password />

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

        <db.dialect>net.sf.hibernate.dialect.PostgreSQLDialect</db.dialect>

        <jdbc.artifactGroup>postgresql</jdbc.artifactGroup>
        <jdbc.artifactId>postgresql</jdbc.artifactId>
        <jdbc.artifactVersion>${postgres.driver.version}</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>${dbms.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-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.port>1521</db.port>
        <db.instance>XE</db.instance>
        <db.admin.username>system</db.admin.username>
        <db.admin.password>root</db.admin.password>

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

        <db.dialect>net.sf.hibernate.dialect.OracleDialect</db.dialect>

        <jdbc.artifactGroup>com.oracle</jdbc.artifactGroup>
        <jdbc.artifactId>ojdbc5</jdbc.artifactId>
        <jdbc.artifactVersion>${oracle.driver.version}</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>
        <!-- testng.suites: copy-paste from "functest" profile, and removed suites containing Cvs-related tests, as they hang up on windows ec2 instance -->
        <testng.suites>testng-requires-clean.xml,testng-permissions.xml,testng-notification.xml,testng-svn.xml,testng-svn-noncore.xml,testng-misc.xml,testng-config.xml,testng-dependencies.xml</testng.suites>

        <db.name>MSSQL 2005</db.name>
        <db.provider>${db.name}</db.provider>
        <db.port>1433</db.port>
        <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>${sqlServer.driver.version}</jdbc.artifactVersion>
        <jdbc.databaseUrl>jdbc:jtds:sqlserver://localhost:1433/</jdbc.databaseUrl>

        <acceptanceTestSettings>db-mssql2005.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>

    <profile>
      <id>resolveDeps</id>
      <dependencies>

        <!-- Module dependencies -->
        <dependency>
          <groupId>com.atlassian.bamboo</groupId>
          <artifactId>atlassian-bamboo-web-app</artifactId>
          <type>war</type>
        </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>

        <dependency>
          <groupId>com.atlassian.bamboo.plugins</groupId>
          <artifactId>atlassian-bamboo-plugin-git</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>

      </dependencies>
    </profile>

    <profile>
      <id>tomcat5x</id>
      <!-- default profile, no overrides -->
    </profile>

    <profile>
      <id>tomcat6x</id>
      <properties>
        <containerId>tomcat6x</containerId>
        <downloadUrl>https://maven.atlassian.com/content/repositories/atlassian-public/org/apache/tomcat/apache-tomcat/6.0.26/apache-tomcat-6.0.26.zip</downloadUrl>
      </properties>
    </profile>

    <profile>
      <id>tomcat7x</id>
      <properties>
        <containerId>tomcat7x</containerId>
        <downloadUrl>https://maven.atlassian.com/content/repositories/atlassian-public/org/apache/tomcat/apache-tomcat/7.0.32/apache-tomcat-7.0.32.zip</downloadUrl>
      </properties>
    </profile>

  </profiles>

  <dependencies>

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



    <!-- Atlassian dependencies -->
    <!-- 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-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-maven-embedder</artifactId>
    </dependency>

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

    <!-- Other dependencies -->
    <dependency>
      <groupId>hsqldb</groupId>
      <artifactId>hsqldb</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>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>
    </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>
    </dependency>

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

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

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</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>
        <exclusions>
          <exclusion>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
          </exclusion>
        </exclusions>
      </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>
              </excludes>
              <skip>false</skip>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <testSourceDirectory>src/it/java</testSourceDirectory>
  </build>
</project>
