<?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>de.arbeitsagentur.opdt</groupId>
        <artifactId>keycloak-cassandra-extension-parent</artifactId>
        <version>0.4.5-20.0.2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>keycloak-cassandra-model-tests</artifactId>
    <packaging>jar</packaging>

    <properties>
        <!-- Surefire Settings -->
        <surefire.memory.Xms>512m</surefire.memory.Xms>
        <surefire.memory.Xmx>2048m</surefire.memory.Xmx>
        <surefire.memory.metaspace>96m</surefire.memory.metaspace>
        <surefire.memory.metaspace.max>512m</surefire.memory.metaspace.max>
        <surefire.memory.settings>-Xms${surefire.memory.Xms} -Xmx${surefire.memory.Xmx} -XX:MetaspaceSize=${surefire.memory.metaspace} -XX:MaxMetaspaceSize=${surefire.memory.metaspace.max}</surefire.memory.settings>
        <surefire.system.args></surefire.system.args>
    </properties>

    <dependencies>
        <dependency>
            <groupId>io.quarkus</groupId>
            <artifactId>quarkus-arc</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest</artifactId>
            <version>2.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-services</artifactId>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-spi-private</artifactId>
        </dependency>
        <dependency>
            <groupId>org.keycloak</groupId>
            <artifactId>keycloak-server-spi</artifactId>
        </dependency>

        <dependency>
            <groupId>de.arbeitsagentur.opdt</groupId>
            <artifactId>keycloak-cassandra-extension</artifactId>
            <version>${project.version}</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>

        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>testcontainers</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.testcontainers</groupId>
            <artifactId>cassandra</artifactId>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <append>true</append>
                            <includes>
                                <include>de/arbeitsagentur/**/*</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M7</version>
                <configuration>
                    <forkMode>once</forkMode>
                    <argLine>@{argLine}</argLine>
                    <runOrder>alphabetical</runOrder>
                    <failIfNoSpecifiedTests>false</failIfNoSpecifiedTests>
                    <systemPropertyVariables>
                        <!-- keycloak.model.parameters lists parameter classes from
                             org.keycloak.model.parameters package and determine enabled providers -->
                        <keycloak.model.parameters>Map,CassandraMapStorage</keycloak.model.parameters>
                        <log4j.configuration>file:${project.build.directory}/test-classes/log4j.properties</log4j.configuration> <!-- for the logging to properly work with tests in the 'other' module -->
                        <keycloak.profile.feature.map_storage>enabled</keycloak.profile.feature.map_storage>
                        <java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
                        <org.jboss.logging.provider>log4j</org.jboss.logging.provider>
                        <argLine>-Djava.awt.headless=true ${surefire.memory.settings} ${surefire.system.args} -Duser.language=en -Duser.region=US</argLine>
                    </systemPropertyVariables>
                    <properties>
                        <property>
                            <name>listener</name>
                            <value>de.arbeitsagentur.opdt.keycloak.cassandra.testsuite.AfterSuiteListener</value>
                        </property>
                    </properties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>process-test-resources</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <delete>
                                    <fileset dir="${project.build.directory}" includes="map-*.json"/>
                                    <fileset dir="${project.build.directory}" includes="map/**/*.json"/>
                                </delete>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
