<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ GRAKN.AI - THE KNOWLEDGE GRAPH
  ~ Copyright (C) 2018 Grakn Labs Ltd
  ~
  ~ This program is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU Affero General Public License as
  ~ published by the Free Software Foundation, either version 3 of the
  ~ License, or (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License
  ~ along with this program.  If not, see <https://www.gnu.org/licenses/>.
  -->

<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.4.3</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>grakn-factory</artifactId>
                    <scope>test</scope>
                </dependency>
            </dependencies>
        </profile>
    </profiles>
</project>
