<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>ch.so.agi.gretl</groupId>
    <artifactId>gretl-runtime-parent</artifactId>
    <version>0.1.0-SNAPSHOT</version>
  </parent>
  <artifactId>gretl-integration-tests</artifactId>
  <packaging>jar</packaging>
  <name>GRETL Runtime Backing-Service Integration Tests</name>
  <description>Artifact job tests; service scenarios are enabled with backing-services.</description>

  <dependencies>
    <!-- Direct product edges include sources and all test-JVM contributions in coverage aggregation. -->
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-runner</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-groovy</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-i18n</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-logging</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-packager</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-job-runtime</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- Reactor edge: packaging jobs always uses this candidate's distribution. -->
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-dist</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-cli</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-database-tasks</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-io-tasks</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-ilivalidator</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.so.agi.gretl</groupId>
      <artifactId>gretl-interlis-tasks</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>testcontainers</artifactId>
      <version>${testcontainers.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>postgresql</artifactId>
      <version>${testcontainers.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>${postgresql.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-net</groupId>
      <artifactId>commons-net</artifactId>
      <version>${commons-net.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.floci</groupId>
      <artifactId>testcontainers-floci</artifactId>
      <version>${testcontainers-floci.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>s3</artifactId>
      <version>${aws-sdk.version}</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>software.amazon.awssdk</groupId>
          <artifactId>netty-nio-client</artifactId>
        </exclusion>
        <exclusion>
          <groupId>software.amazon.awssdk</groupId>
          <artifactId>apache-client</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>software.amazon.awssdk</groupId>
      <artifactId>url-connection-client</artifactId>
      <version>${aws-sdk.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco.version}</version>
        <executions>
          <execution>
            <id>coverage-aggregate</id>
            <phase>verify</phase>
            <goals><goal>report-aggregate</goal></goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <junit.jupiter.extensions.autodetection.enabled>true</junit.jupiter.extensions.autodetection.enabled>
            <gretl.test.runId>${gretl.test.runId}</gretl.test.runId>
            <gretl.test.executionMode>${gretl.test.executionMode}</gretl.test.executionMode>
            <gretl.test.imageMetadata>${maven.multiModuleProjectDirectory}/gretl-dist/target/image/candidate.json</gretl.test.imageMetadata>
          </systemPropertyVariables>
        </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>
          <includes><include>${gretl.test.includes}</include></includes>
          <excludes><exclude>**/ImageRuntimeIT.java</exclude></excludes>
          <systemPropertyVariables>
            <junit.jupiter.extensions.autodetection.enabled>true</junit.jupiter.extensions.autodetection.enabled>
            <gretl.test.runId>${gretl.test.runId}</gretl.test.runId>
            <gretl.test.executionMode>${gretl.test.executionMode}</gretl.test.executionMode>
            <gretl.test.imageMetadata>${maven.multiModuleProjectDirectory}/gretl-dist/target/image/candidate.json</gretl.test.imageMetadata>
            <gretl.test.reactorDistribution>${maven.multiModuleProjectDirectory}/gretl-dist/target/dist</gretl.test.reactorDistribution>
            <gretl.test.distributionArchive>${maven.multiModuleProjectDirectory}/gretl-dist/target/gretl-runtime-${project.version}-bin.zip</gretl.test.distributionArchive>
          </systemPropertyVariables>
          <forkCount>1</forkCount>
          <reuseForks>true</reuseForks>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <profiles><profile><id>job-image</id><build><plugins><plugin>
    <groupId>org.apache.maven.plugins</groupId><artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
      <includes combine.self="override"><include>${gretl.test.includes}</include><include>**/ImageRuntimeIT.java</include></includes>
      <excludes combine.self="override"/>
    </configuration>
  </plugin></plugins></build></profile></profiles>
</project>
