<?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">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.java.dev.activeobjects</groupId>
        <artifactId>activeobjects-parent</artifactId>
        <version>3.6.5</version>
    </parent>

    <artifactId>activeobjects-integration-profiles</artifactId>
    <packaging>pom</packaging>

    <name>Active Objects - Integration Profiles</name>

    <properties>
        <hsqldb.version>1.8.1.1</hsqldb.version>
        <!-- HSQL 2.x: use hsqldb.groupid = 'org.hsqldb' -->
        <hsqldb.groupid>hsqldb</hsqldb.groupid>
        <postgres.version>42.2.24</postgres.version>
        <oracle.driver.group>com.oracle.ojdbc</oracle.driver.group>
        <oracle.driver.artifact>ojdbc8</oracle.driver.artifact>
        <oracle.driver.version>19.3.0.0</oracle.driver.version>
        <nuodb.version>2.6.1</nuodb.version>
        <sqljdbc.version>7.4.1.jre8</sqljdbc.version>
        <sqljdbc.artifactId>mssql-jdbc</sqljdbc.artifactId>
        <db.skip>false</db.skip>
        <db.host>localhost</db.host>
        <db.name>ao_test</db.name>
        <db.username>ao_user</db.username>
        <db.password>ao_password</db.password>
        <db.schema>ao_schema</db.schema>
    </properties>

    <profiles>
        <profile>
            <id>hsql</id>
            <properties>
                <ao.test.database>hsql</ao.test.database>
                <db.skip>true</db.skip>
                <db.name />
                <db.username />
                <db.password />
                <db.schema />
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>${hsqldb.groupid}</groupId>
                    <artifactId>hsqldb</artifactId>
                    <version>${hsqldb.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>h2-memory</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <ao.test.database>h2-memory</ao.test.database>
                <db.skip>true</db.skip>
                <db.name />
                <db.username />
                <db.password />
                <db.schema />
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                    <version>${h2.version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>com.mchange</groupId>
                    <artifactId>c3p0</artifactId>
                    <version>${c3p0.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>h2-file</id>
            <properties>
                <ao.test.database>h2-file</ao.test.database>
                <db.skip>true</db.skip>
                <db.name />
                <db.username />
                <db.password />
                <db.schema />
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                    <version>${h2.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>h2-server</id>
            <properties>
                <ao.test.database>h2-server</ao.test.database>
                <db.skip>true</db.skip>
                <db.name />
                <db.username />
                <db.password />
                <db.schema />
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                    <version>${h2.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>nuodb</id>
            <properties>
                <ao.test.database>nuodb</ao.test.database>
                <db.skip>true</db.skip>
                <db.name />
                <db.username />
                <db.password />
                <db.schema />
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.nuodb.jdbc</groupId>
                    <artifactId>nuodb-jdbc</artifactId>
                    <version>${nuodb.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>mysql</id>
            <properties>
                <db.port>3306</db.port>
                <db.url>jdbc:mysql://localhost:${db.port}/${db.name}?autoReconnect=true</db.url>
                <db.system.username>root</db.system.username>
                <db.system.password>root</db.system.password>
                <ao.test.database>mysql</ao.test.database>
                <docker.image>mysql:5.5</docker.image>
                <docker.wait.log>(?s)starting as process 1\b.*ready for connections</docker.wait.log>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>${mysql.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image}</name>
                                    <run>
                                        <ports>
                                            <port>db.port:3306</port>
                                        </ports>
                                        <cmd>--character-set-server=utf8 --collation-server=utf8_bin --bind-address=0.0.0.0</cmd>
                                        <env>
                                            <MYSQL_DATABASE>${db.name}</MYSQL_DATABASE>
                                            <MYSQL_USER>${db.username}</MYSQL_USER>
                                            <MYSQL_PASSWORD>${db.password}</MYSQL_PASSWORD>
                                            <MYSQL_ROOT_PASSWORD>${db.system.password}</MYSQL_ROOT_PASSWORD>
                                        </env>
                                        <wait>
                                            <log>${docker.wait.log}</log>
                                            <time>120000</time>
                                            <tcp>
                                                <host>localhost</host>
                                                <ports>
                                                    <port>3306</port>
                                                </ports>
                                            </tcp>
                                        </wait>
                                        <log>
                                            <prefix>mysql</prefix>
                                        </log>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>postgres</id>
            <properties>
                <ao.test.database>postgres</ao.test.database>
                <db.schema>public</db.schema>
                <db.url>jdbc:postgresql://localhost:${db.port}/${db.name}</db.url>

                <docker.image>postgres:9.2</docker.image>
                <docker.wait.log>PostgreSQL init process complete</docker.wait.log>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>${postgres.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image}</name>

                                    <run>
                                        <ports>
                                            <port>db.port:5432</port>
                                        </ports>
                                        <env>
                                            <POSTGRES_DB>${db.name}</POSTGRES_DB>
                                            <POSTGRES_USER>${db.username}</POSTGRES_USER>
                                            <POSTGRES_PASSWORD>${db.password}</POSTGRES_PASSWORD>
                                        </env>
                                        <wait>
                                            <log>${docker.wait.log}</log>
                                            <time>1200000</time>
                                        </wait>
                                        <log>
                                            <prefix>postgres</prefix>
                                        </log>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>oracle</id>
            <properties>
                <ao.test.database>oracle</ao.test.database>
                <db.sid>JIRADB</db.sid>
                <db.port>1521</db.port>
                <db.schema>ao_user</db.schema>
                <db.url>jdbc:oracle:thin:@localhost:${db.port}:${db.sid}</db.url>
                <docker.image>docker.atl-paas.net/atlassian/jira/server/oracle-database:19.3.0-se2-1.2.0-warm-1.1.0</docker.image>
                <docker.wait.log>(?s).*DATABASE IS READY TO USE.*</docker.wait.log>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>${oracle.driver.group}</groupId>
                    <artifactId>${oracle.driver.artifact}</artifactId>
                    <version>${oracle.driver.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.fabric8</groupId>
                        <artifactId>docker-maven-plugin</artifactId>
                        <configuration>
                            <images>
                                <image>
                                    <name>${docker.image}</name>
                                    <alias>oracle</alias>
                                    <run>
                                        <ports>
                                            <port>db.port:1521</port>
                                        </ports>
                                        <wait>
                                            <log>${docker.wait.log}</log>
                                            <time>600000</time>
                                        </wait>
                                        <log>
                                            <prefix>oracle:</prefix>
                                        </log>
                                    </run>
                                </image>
                            </images>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>sql-maven-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>${oracle.driver.group}</groupId>
                                <artifactId>${oracle.driver.artifact}</artifactId>
                                <version>${oracle.driver.version}</version>
                            </dependency>
                        </dependencies>

                        <configuration>
                            <username>SYS AS SYSDBA</username>
                            <password>oracle</password>
                            <url>${db.url}</url>
                            <driver>oracle.jdbc.OracleDriver</driver>
                            <skip>${skipTests}</skip>
                        </configuration>

                        <executions>
                            <execution>
                                <id>create-db</id>
                                <configuration>
                                    <autocommit>true</autocommit>
                                    <sqlCommand>
                                        DROP USER ao_user CASCADE;
                                        CREATE USER ao_user IDENTIFIED BY ao_password DEFAULT TABLESPACE USERS QUOTA UNLIMITED ON USERS;
                                        GRANT ALL PRIVILEGES TO ao_user WITH ADMIN OPTION;
                                        GRANT CONNECT TO ao_user;
                                    </sqlCommand>
                                    <onError>continue</onError>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.NuoDBIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest,
                                net.java.ao.test.junit.SqlServerIntegrationTest
                            </excludedGroups>
                            <trimStackTrace>false</trimStackTrace>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>sqlserver</id>
            <properties>
                <ao.test.database>sqlserver</ao.test.database>
                <db.system.username>sa</db.system.username>
                <db.system.password>password</db.system.password>
                <docker.skip>true</docker.skip>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>com.microsoft.sqlserver</groupId>
                    <artifactId>${sqljdbc.artifactId}</artifactId>
                    <version>${sqljdbc.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.leberrigaud.maven.plugins</groupId>
                        <artifactId>database-maven-plugin</artifactId>
                        <dependencies>
                            <dependency>
                                <groupId>com.microsoft.sqlserver</groupId>
                                <artifactId>${sqljdbc.artifactId}</artifactId>
                                <version>${sqljdbc.version}</version>
                                <scope>runtime</scope>
                            </dependency>
                        </dependencies>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <excludedGroups>
                                net.java.ao.test.junit.H2IntegrationTest,
                                net.java.ao.test.junit.HsqlIntegrationTest,
                                net.java.ao.test.junit.DerbyIntegrationTest,
                                net.java.ao.test.junit.MySqlIntegrationTest,
                                net.java.ao.test.junit.OracleIntegrationTest,
                                net.java.ao.test.junit.PostgresIntegrationTest
                            </excludedGroups>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>commons-dbcp</id>
            <dependencies>
                <dependency>
                    <groupId>commons-dbcp</groupId>
                    <artifactId>commons-dbcp</artifactId>
                    <version>${dbcp.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>commons-dbcp2</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.commons</groupId>
                    <artifactId>commons-dbcp2</artifactId>
                    <version>${dbcp2.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>tomcat-dbcp</id>
            <dependencies>
                <dependency>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat-dbcp</artifactId>
                    <version>${tomcat-dbcp.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>c3p0</id>
            <dependencies>
                <dependency>
                    <groupId>com.mchange</groupId>
                    <artifactId>c3p0</artifactId>
                    <version>${c3p0.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>proxool</id>
            <dependencies>
                <dependency>
                    <groupId>proxool</groupId>
                    <artifactId>proxool</artifactId>
                    <version>${proxool.version}</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
        <profile>
            <id>snaq.db</id>
            <dependencies>
                <dependency>
                    <groupId>snaq.db.dbpool</groupId>
                    <artifactId>dbpool</artifactId>
                    <version>4.9.3-jdbc3</version>
                    <scope>runtime</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
