<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>com.atlassian.pom</groupId>
        <artifactId>public-pom</artifactId>
        <version>5.0.21</version>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.atlassian.healthcheck</groupId>
    <artifactId>atlassian-healthcheck-parent</artifactId>
    <version>6.0.0</version>
    <modules>
        <module>healthcheck-spi</module>
        <module>healthcheck-plugin-check-api</module>
        <module>healthcheck-plugin</module>
        <module>healthcheck-test</module>
        <module>healthcheck-in-product-test-support</module>
    </modules>
    <packaging>pom</packaging>

    <name>Atlassian HealthCheck Parent Module</name>
    <url>http://www.atlassian.com/</url>
    <inceptionYear>2012</inceptionYear>


    <issueManagement>
        <system>Jira</system>
        <url>https://ecosystem.atlassian.net/browse/AHC</url>
    </issueManagement>

    <ciManagement>
        <system>Bamboo</system>
        <url>https://engservices-bamboo.internal.atlassian.com/browse/AHC</url>
    </ciManagement>

    <scm>
        <connection>scm:git:ssh://git@bitbucket.org/atlassian/atlassian-healthcheck.git</connection>
        <developerConnection>scm:git:ssh://git@bitbucket.org/atlassian/atlassian-healthcheck.git</developerConnection>
        <url>https://bitbucket.org/atlassian/atlassian-healthcheck/</url>
        <tag>atlassian-healthcheck-parent-6.0.0</tag>
    </scm>

    <licenses>
        <license>
            <name>BSD License</name>
            <url>http://opensource.org/licenses/BSD-3-Clause</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>rthomas</id>
            <name>Ryan Thomas</name>
            <organization>Atlassian</organization>
            <organizationUrl>http://www.atlassian.com/</organizationUrl>
            <timezone>+10</timezone>
            <roles>
                <role>Architect</role>
            </roles>
        </developer>
        <developer>
            <id>jbirch</id>
            <name>Jason Birch</name>
            <organization>Atlassian</organization>
            <organizationUrl>http://www.atlassian.com/</organizationUrl>
            <timezone>+10</timezone>
            <roles>
                <role>Maintainer</role>
            </roles>
        </developer>
    </developers>

    <organization>
        <name>Atlassian</name>
        <url>http://www.atlassian.com/</url>
    </organization>

    <properties>
        <amps.version>6.3.18</amps.version>
        <platform.version>5.0.0-m6</platform.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.atlassian.platform</groupId>
                <artifactId>platform</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>com.atlassian.platform</groupId>
                <artifactId>third-party</artifactId>
                <version>${platform.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>atlassian-healthcheck</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.atlassian.healthcheck</groupId>
                <artifactId>atlassian-healthcheck-spi</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>com.atlassian.healthcheck</groupId>
                <artifactId>atlassian-healthcheck-plugin-check-api</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>atlassian-healthcheck-in-product-test-support</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>healthcheck-reference-plugin</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>healthcheck-deliberately-broken-test-plugin</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>healthcheck-deliberately-not-loadable-test-plugin</artifactId>
                <version>${project.version}</version>
            </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>healthcheck-disabled-by-default-test-plugin</artifactId>
                <version>${project.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.atlassian.maven.plugins</groupId>
                    <artifactId>maven-amps-plugin</artifactId>
                    <version>${amps.version}</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>postgres84</id>
            <properties>
                <postgres.wait.condition>database system is ready to accept connections</postgres.wait.condition>
            </properties>
        </profile>
        <profile>
            <id>postgres95</id>
            <properties>
                <postgres.wait.condition>PostgreSQL init process complete; ready for start up.</postgres.wait.condition>
            </properties>
        </profile>
        <profile>
            <!-- Postgres-in-Docker config for JIRA Cloud, which is Postgres-only.
                 Use together with 'postgres84' or 'postgres95' profile. -->
            <id>jira-cloud</id>
            <properties>
                <!-- The pass-through port at which docker-maven-plugin will expose the real postgres, see below -->
                <postgres.port>15432</postgres.port>
                <postgres.dbname>jira</postgres.dbname>
                <postgres.user>jira</postgres.user>
                <postgres.password>jira</postgres.password>
                <postgres.jdbc.driver.version>9.2-1003-jdbc4</postgres.jdbc.driver.version>
                <!-- This may be set by Bamboo plans on JCBAC -->
                <postgres.docker.image>docker.atlassian.io/armata/postgres/8.4/jira/1000</postgres.docker.image>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>${postgres.jdbc.driver.version}</version>
                </dependency>
            </dependencies>
            <build>
                <pluginManagement>
                    <plugins>
                        <!-- Postgres running in docker, configured to start/stop with integration tests
                             where docker-maven-plugin is activated in submodules -->
                        <plugin>
                            <groupId>io.fabric8</groupId>
                            <artifactId>docker-maven-plugin</artifactId>
                            <version>0.14.2</version>

                            <configuration>
                                <images>
                                    <image>
                                        <alias>postgres-db</alias>
                                        <name>${postgres.docker.image}</name>
                                        <run>
                                            <env>
                                                <POSTGRES_USER>${postgres.user}</POSTGRES_USER>
                                                <POSTGRES_PASSWORD>${postgres.password}</POSTGRES_PASSWORD>
                                                <POSTGRES_DB>${postgres.dbname}</POSTGRES_DB>
                                                <POSTGRES_INITDB_ARGS>--encoding=UTF8</POSTGRES_INITDB_ARGS>
                                            </env>
                                            <ports>
                                                <port>${postgres.port}:5432</port>
                                            </ports>
                                            <wait>
                                                <log>${postgres.wait.condition}</log>
                                                <time>45000</time>
                                                <kill>5000</kill>
                                                <shutdown>2000</shutdown>
                                            </wait>
                                            <log>
                                                <prefix>postgres</prefix>
                                                <date>default</date>
                                                <color>cyan</color>
                                            </log>
                                        </run>
                                    </image>
                                </images>
                                <verbose>true</verbose>
                            </configuration>
                            <executions>
                                <execution>
                                    <id>start</id>
                                    <!-- TODO: This should be in "pre-integration-test" phase,
                                         but AMPS loads its systemPropertyVariables config in "test" phase,
                                         and we need the docker.host.address variable there,
                                         so unfortunately we're forced to start Docker before "test",
                                         hence this is the latest phase that works. Please change when AMPS is gone! -->
                                    <phase>process-test-classes</phase>
                                    <goals>
                                        <goal>start</goal>
                                    </goals>
                                </execution>
                                <execution>
                                    <id>stop</id>
                                    <phase>post-integration-test</phase>
                                    <goals>
                                        <goal>stop</goal>
                                    </goals>
                                </execution>
                            </executions>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>
    </profiles>
</project>
