<?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>
        <artifactId>grakn</artifactId>
        <groupId>ai.grakn</groupId>
        <version>1.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>grakn-test-profiles</artifactId>

    <packaging>pom</packaging>

    <dependencies>
        <dependency>
            <groupId>ai.grakn</groupId>
            <artifactId>grakn-test-tools</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>

                <configuration>
                    <systemPropertyVariables>
                        <grakn.conf>${user.dir}/conf/test/${grakn.test-profile}/grakn.properties</grakn.conf>
                        <grakn.test-profile>${grakn.test-profile}</grakn.test-profile>
                        <logback.configurationFile>${user.dir}/conf/test/logback-test.xml</logback.configurationFile>
                        <main.basedir>${user.dir}</main.basedir>
                    </systemPropertyVariables>
                    <!-- uncomment the following to be able to run only specific packages with
                        for example -DtestGroup=ai/grakn/test/migration/sql
    				<includes>
                    	<include>**/${testGroup}/*Test.java</include>
                	</includes>
                -->
                    <!-- This is important for otherwise surefire reports or the console
                    don't contain stack traces! -->
                    <trimStackTrace>false</trimStackTrace>
                    <argLine>-XX:+HeapDumpOnOutOfMemoryError</argLine>

                    <!-- Added this config to try and help sort out flaky tests -->
                    <runOrder>random</runOrder>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-failsafe-plugin</artifactId>

                <configuration>
                    <systemPropertyVariables>
                        <grakn.conf>${user.dir}/conf/test/${grakn.test-profile}/grakn.properties</grakn.conf>
                        <grakn.test-profile>${grakn.test-profile}</grakn.test-profile>
                        <logback.configurationFile>${user.dir}/conf/test/logback-test.xml</logback.configurationFile>
                        <main.basedir>${user.dir}</main.basedir>
                    </systemPropertyVariables>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>tinker</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <grakn.test-profile>tinker</grakn.test-profile>
            </properties>
        </profile>

        <profile>
            <id>janus</id>
            <properties>
                <grakn.test-profile>janus</grakn.test-profile>
            </properties>
            <dependencies>
                <dependency>
                    <groupId>ai.grakn</groupId>
                    <artifactId>janus-factory</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
