<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>net.java.dev.activeobjects</groupId>
        <artifactId>activeobjects-integration-profiles</artifactId>
        <version>1.2.5</version>
        <relativePath>../activeobjects-integration-profiles</relativePath>
    </parent>

    <artifactId>activeobjects-integration-test</artifactId>
    <name>Active Objects - Integration testing</name>
    <description>This is where the integration testing of the Active Objects library is done!</description>

    <profiles>
        <profile> <!-- create then drop test DB; not used with docker -->
            <id>createDB</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.leberrigaud.maven.plugins</groupId>
                        <artifactId>database-maven-plugin</artifactId>
                        <configuration>
                            <skip>${db.skip}</skip>
                            <database>${ao.test.database}</database>
                            <schema>${db.schema}</schema>
                            <name>${db.name}</name>
                            <host>${db.host}</host>
                            <url>${db.plugin.url}${db.url}</url> <!-- use db.plugin.url if the URL is only for this plugin, db.url otherwise -->
                            <username>${db.username}</username>
                            <password>${db.password}</password>
                            <rootUsername>${db.system.username}</rootUsername>
                            <rootPassword>${db.system.password}</rootPassword>
                        </configuration>
                        <executions>
                            <execution>
                                <id>create-db</id>
                                <goals>
                                    <goal>create</goal>
                                </goals>
                                <phase>pre-integration-test</phase>
                            </execution>
                            <execution>
                                <id>drop-db</id>
                                <goals>
                                    <goal>drop</goal>
                                </goals>
                                <phase>post-integration-test</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
</profiles>

<build>
    <plugins>
        <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>docker-maven-plugin</artifactId>
            <configuration>
                <skip>${docker.skip}</skip>
            </configuration>
            <executions>
                <execution>
                    <id>start</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop</id>
                    <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                </execution>
            </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>**</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>

                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <systemPropertyVariables>
                        <ao.test.database>${ao.test.database}</ao.test.database>
                        <db.username>${db.username}</db.username>
                        <db.password>${db.password}</db.password>
                        <db.name>${db.name}</db.name>
                        <db.schema>${db.schema}</db.schema>
                        <db.url>${db.url}</db.url>
                        <ao.test.tablenameconverter>${ao.test.tablenameconverter}</ao.test.tablenameconverter>
                        <ao.test.fieldnameconverter>${ao.test.fieldnameconverter}</ao.test.fieldnameconverter>
                    </systemPropertyVariables>
                    <includes>
                        <include>**/*Test.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>net.java.dev.activeobjects</groupId>
            <artifactId>activeobjects-core</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.java.dev.activeobjects</groupId>
            <artifactId>activeobjects-test</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>net.java.dev.activeobjects</groupId>
            <artifactId>activeobjects-integration-test-model</artifactId>
            <version>${project.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.lucene</groupId>
            <artifactId>lucene-core</artifactId>
            <version>2.2.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>1.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-library</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <properties>
        <ao.test.tablenameconverter>atlassian</ao.test.tablenameconverter>
        <ao.test.fieldnameconverter>atlassian</ao.test.fieldnameconverter>
    </properties>
</project>
