<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>9.0.2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>atlassian-bamboo-user-management-test</artifactId>
  <packaging>atlassian-plugin</packaging>

  <name>Atlassian Bamboo User Management Test Module</name>

  <properties>
    <bamboo.test.version>${project.version}</bamboo.test.version>
    <crowd.test.version>${crowd.version}</crowd.test.version>
    <crowd.test.amps.containerId>tomcat85x</crowd.test.amps.containerId>
    <license.scope>test</license.scope>
    <bamboo.allowMutativeGetInStrictXsrfMode />
    <data.directory>${project.basedir}/test-data</data.directory>
  </properties>

  <profiles>
    <profile>
      <id>mssql</id>
      <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
      </properties>
    </profile>
    <profile>
      <id>mysql</id>
      <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
      </properties>
    </profile>
    <profile>
      <id>mysql-ec2</id>
      <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
      </properties>
    </profile>
    <profile>
      <id>oracle</id>
      <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
      </properties>
    </profile>
    <profile>
      <id>pgsql</id>
      <properties>
        <maven.test.it.skip>true</maven.test.it.skip>
      </properties>
    </profile>
  </profiles>

  <build>
    <plugins>
      <plugin>
        <!-- Added as a local testing environment only. There's a problem when using it with integration-test/verify goals
        where container is not properly cleaned up. Bamboo uses DockerTask to set up LDAP container properly -->
        <groupId>io.fabric8</groupId>
        <artifactId>docker-maven-plugin</artifactId>
        <configuration>
          <images>
            <image>
              <!-- stored in https://stash.atlassian.com/projects/BAM/repos/test-ldap-docker/browse -->
              <name>docker.atlassian.io/bamboo/test-ldap:latest</name>
              <alias>bamboo-test-ldap-server</alias>
              <run>
                <ports>10389:389</ports>
                <env>
                  <TEST_CONFIG_NUMBER_OF_USERS>25</TEST_CONFIG_NUMBER_OF_USERS>
                  <TEST_CONFIG_NUMBER_OF_USERS_IN_GROUP>2</TEST_CONFIG_NUMBER_OF_USERS_IN_GROUP>
                  <TEST_CONFIG_NUMBER_OF_GROUPS>5</TEST_CONFIG_NUMBER_OF_GROUPS>
                  <TEST_CONFIG_INCLUDE_ADMIN_ACCOUNT>true</TEST_CONFIG_INCLUDE_ADMIN_ACCOUNT>
                </env>
              </run>
            </image>
          </images>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.atlassian.maven.plugins</groupId>
        <artifactId>amps-maven-plugin</artifactId>
        <extensions>true</extensions>
        <configuration>
          <products>
            <product>
              <id>bamboo</id>
              <instanceId>bamboo-recovery-mode</instanceId>
              <version>${bamboo.test.version}</version>
              <dataVersion>${project.version}</dataVersion>
              <containerId>${amps.containerId}</containerId>
              <jvmDebugPort>5005</jvmDebugPort>
              <systemPropertyVariables>
                <bamboo.allowMutativeGetInStrictXsrfMode>${bamboo.allowMutativeGetInStrictXsrfMode}</bamboo.allowMutativeGetInStrictXsrfMode>
                <!-- Keep in sync with RecoveryAdminModeTest.RECOVERY_ADMIN -->
                <atlassian.recovery.password>secret_password_dont_share_it</atlassian.recovery.password>
                <atlassian.feature.discovery.dialog.enabled>false</atlassian.feature.discovery.dialog.enabled>
              </systemPropertyVariables>
              <pluginArtifacts>
                <pluginArtifact>
                  <groupId>com.atlassian.bamboo.plugins</groupId>
                  <artifactId>atlassian-bamboo-plugin-test-utils</artifactId>
                </pluginArtifact>
              </pluginArtifacts>
            </product>
            <product>
              <id>bamboo</id>
              <instanceId>bamboo-crowd</instanceId>
              <version>${bamboo.test.version}</version>
              <dataPath>${data.directory}/amps/bamboo-user-management-test/bamboo-6.6-crowd-data-resources.zip</dataPath>
              <containerId>${amps.containerId}</containerId>
              <jvmDebugPort>5005</jvmDebugPort>
              <systemPropertyVariables>
                <bamboo.allowMutativeGetInStrictXsrfMode>${bamboo.allowMutativeGetInStrictXsrfMode}</bamboo.allowMutativeGetInStrictXsrfMode>
                <atlassian.feature.discovery.dialog.enabled>false</atlassian.feature.discovery.dialog.enabled>
              </systemPropertyVariables>
              <pluginArtifacts>
                <pluginArtifact>
                  <groupId>com.atlassian.bamboo.plugins</groupId>
                  <artifactId>atlassian-bamboo-plugin-test-utils</artifactId>
                </pluginArtifact>
              </pluginArtifacts>
            </product>
            <product>
              <id>bamboo</id>
              <instanceId>bamboo-ldap-local-groups</instanceId>
              <version>${bamboo.test.version}</version>
              <dataPath>
                ${data.directory}/amps/bamboo-user-management-test/bamboo-6.6-ldap-local-groups-data-resources.zip
              </dataPath>
              <containerId>${amps.containerId}</containerId>
              <jvmDebugPort>5005</jvmDebugPort>
              <systemPropertyVariables>
                <bamboo.allowMutativeGetInStrictXsrfMode>
                  ${bamboo.allowMutativeGetInStrictXsrfMode}
                </bamboo.allowMutativeGetInStrictXsrfMode>
                <atlassian.feature.discovery.dialog.enabled>false</atlassian.feature.discovery.dialog.enabled>
              </systemPropertyVariables>
              <pluginArtifacts>
                <pluginArtifact>
                  <groupId>com.atlassian.bamboo.plugins</groupId>
                  <artifactId>atlassian-bamboo-plugin-test-utils</artifactId>
                </pluginArtifact>
              </pluginArtifacts>
            </product>
            <product>
              <id>crowd</id>
              <instanceId>crowd4bamboo_custom</instanceId>
              <version>${crowd.test.version}</version>
              <dataPath>${data.directory}/amps/bamboo-user-management-test/crowd-plugin-test-resources.zip</dataPath>
              <containerId>${crowd.test.amps.containerId}</containerId>
              <jvmDebugPort>5006</jvmDebugPort>
              <ajpPort>8010</ajpPort>
              <enableDevToolbox>false</enableDevToolbox>
            </product>
          </products>

          <testGroups>
            <testGroup>
              <id>bamboo-with-crowd</id>
              <productIds>
                <productId>crowd4bamboo_custom</productId>
                <productId>bamboo-crowd</productId>
              </productIds>
              <includes>
                <include>it/**/webdriver/user/readonly/crowd/**/*.java</include>
              </includes>
            </testGroup>
            <testGroup>
              <id>bamboo-with-ldap</id>
              <productIds>
                <productId>bamboo-ldap-local-groups</productId>
              </productIds>
              <includes>
                <include>it/**/webdriver/user/readonly/ldap/**/*.java</include>
              </includes>
            </testGroup>
            <testGroup>
              <id>bamboo-with-recovery-mode</id>
              <productIds>
                <productId>bamboo-recovery-mode</productId>
              </productIds>
              <includes>
                <include>it/**/webdriver/user/recovery/**/*.java</include>
              </includes>
            </testGroup>
          </testGroups>

        </configuration>
      </plugin>

    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-pageobjects</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.crowd</groupId>
      <artifactId>crowd-integration-client-rest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-core</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- For the tests to be able to assert resource keys-->
    <dependency>
      <groupId>com.atlassian.bamboo</groupId>
      <artifactId>atlassian-bamboo-language</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
