<?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 -->
  <parent>
    <groupId>io.stargate</groupId>
    <artifactId>stargate</artifactId>
    <version>2.0.51</version>
  </parent>
  <!-- Artifact properties -->
  <groupId>io.stargate.it</groupId>
  <artifactId>testing</artifactId>
  <name>Stargate - Coordinator - Testing</name>
  <properties>
    <airline.version>2.7.0</airline.version>
    <jmh.version>1.36</jmh.version>
    <kotlin.version>1.3.72</kotlin.version>
    <code.coverage.project.folder>${basedir}/../</code.coverage.project.folder>
    <code.coverage.overall.data.folder>${basedir}/../target/</code.coverage.overall.data.folder>
  </properties>
  <dependencies>
    <!-- Stargate component dependencies -->
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-test</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.db</groupId>
      <artifactId>persistence-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.auth.api</groupId>
      <artifactId>auth-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.web</groupId>
      <artifactId>restapi</artifactId>
      <version>${project.version}</version>
      <scope>provided</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>io.stargate.grpc</groupId>
      <artifactId>grpc-proto</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.grpc</groupId>
      <artifactId>bridge-proto</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.cql</groupId>
      <artifactId>cql</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.starter</groupId>
      <artifactId>stargate-starter</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>io.stargate.it</groupId>
      <artifactId>testing-services</artifactId>
      <version>${project.version}</version>
    </dependency>
    <!-- Cassandra/DataStax -->
    <dependency>
      <groupId>com.datastax.oss</groupId>
      <artifactId>java-driver-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.datastax.oss</groupId>
      <artifactId>java-driver-query-builder</artifactId>
    </dependency>
    <!-- 3rd party dependencies -->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-exec</artifactId>
      <version>1.3</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.18.0</version>
    </dependency>
    <!-- Other dependencies, note that these are not in the test scope -->
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty-shaded</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-protobuf</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
    </dependency>
    <dependency>
      <groupId>com.apollographql.apollo</groupId>
      <artifactId>apollo-runtime</artifactId>
      <version>2.2.3</version>
    </dependency>
    <!-- Optional, needed only for ANNOTATED nullable type-->
    <dependency>
      <groupId>jakarta.validation</groupId>
      <artifactId>jakarta.validation-api</artifactId>
      <version>3.0.2</version>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-reflect</artifactId>
      <version>1.3.72</version>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.objenesis</groupId>
      <artifactId>objenesis</artifactId>
      <version>3.1</version>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.framework</artifactId>
      <version>6.0.2</version>
    </dependency>
    <dependency>
      <groupId>com.github.rvesse</groupId>
      <artifactId>airline</artifactId>
      <version>${airline.version}</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okhttp3</groupId>
      <artifactId>okhttp</artifactId>
      <version>4.10.0</version>
    </dependency>
    <dependency>
      <groupId>com.squareup.okio</groupId>
      <artifactId>okio-jvm</artifactId>
      <version>3.4.0</version>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-junit-jupiter</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpcore</artifactId>
      <version>4.4.11</version>
    </dependency>
    <dependency>
      <groupId>com.datastax.oss</groupId>
      <artifactId>java-driver-shaded-guava</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
    </dependency>
    <dependency>
      <groupId>org.lz4</groupId>
      <artifactId>lz4-java</artifactId>
      <version>1.8.1</version>
    </dependency>
    <dependency>
      <groupId>org.xerial.snappy</groupId>
      <artifactId>snappy-java</artifactId>
    </dependency>
    <dependency>
      <groupId>org.immutables</groupId>
      <artifactId>value</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-all</artifactId>
      <version>${netty.version}</version>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>testcontainers</artifactId>
      <version>1.19.5</version>
    </dependency>
    <dependency>
      <groupId>org.testcontainers</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>1.19.5</version>
    </dependency>
    <dependency>
      <groupId>com.jayway.jsonpath</groupId>
      <artifactId>json-path</artifactId>
      <version>2.9.0</version>
    </dependency>
    <dependency>
      <groupId>io.projectreactor</groupId>
      <artifactId>reactor-test</artifactId>
      <version>3.4.13</version>
      <scope>compile</scope>
    </dependency>
    <!-- Dependencies for JMH benchmark -->
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-core</artifactId>
      <version>${jmh.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>io.stargate.auth</groupId>
      <artifactId>authnz</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skipTests>true</skipTests>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <dependencies>
          <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
          </dependency>
        </dependencies>
        <configuration>
          <testSourceDirectory>src/main/java</testSourceDirectory>
          <testClassesDirectory>${project.build.directory}/classes</testClassesDirectory>
          <parallel>suites</parallel>
          <threadCountSuites>1</threadCountSuites>
          <reuseForks>true</reuseForks>
          <forkCount>1</forkCount>
          <systemPropertyVariables>
            <stargate.libdir>${basedir}/../stargate-lib</stargate.libdir>
            <stargate.rest.libdir>${basedir}/../stargate-lib/rest</stargate.rest.libdir>
            <jacoco-agent.destfile>${project.build.directory}/jacoco-it.exec</jacoco-agent.destfile>
            <jacoco-agent.args>${failsafe.jacoco.args}</jacoco-agent.args>
            <junit.jupiter.testclass.order.default>org.junit.jupiter.api.ClassOrderer$OrderAnnotation</junit.jupiter.testclass.order.default>
          </systemPropertyVariables>
          <argLine>${failsafe.jacoco.args}</argLine>
          <includes>
            <include>io.stargate.it.**</include>
          </includes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>report-aggregate</id>
            <phase>verify</phase>
            <goals>
              <goal>report-aggregate</goal>
            </goals>
          </execution>
          <execution>
            <id>merge-results</id>
            <phase>verify</phase>
            <goals>
              <goal>merge</goal>
            </goals>
            <configuration>
              <fileSets>
                <fileSet>
                  <directory>${code.coverage.project.folder}</directory>
                  <includes>
                    <include>**/target/*.exec</include>
                  </includes>
                </fileSet>
              </fileSets>
              <destFile>${code.coverage.overall.data.folder}/aggregate.exec</destFile>
            </configuration>
          </execution>
          <execution>
            <id>post-merge-report</id>
            <phase>verify</phase>
            <goals>
              <goal>report</goal>
            </goals>
            <configuration>
              <includes>
                <include/>
              </includes>
              <dataFile>${code.coverage.overall.data.folder}/aggregate.exec</dataFile>
              <outputDirectory>${code.coverage.overall.data.folder}/jacoco</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <!-- Unpack all classes for all stargate dependencies, otherwise jacoco ignores classes it cant find in this module -->
          <execution>
            <id>unpack</id>
            <phase>package</phase>
            <goals>
              <goal>unpack-dependencies</goal>
            </goals>
            <configuration>
              <includes>**/io/stargate/**/*.class</includes>
              <excludes>**/*.properties</excludes>
              <outputDirectory>${project.build.directory}/classes</outputDirectory>
              <overWriteReleases>false</overWriteReleases>
              <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
          </execution>
          <!-- Add the testing-services bundle for integration tests -->
          <execution>
            <id>copy-testing-services</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>io.stargate.it</groupId>
                  <artifactId>testing-services</artifactId>
                  <version>${project.version}</version>
                </artifactItem>
              </artifactItems>
              <outputDirectory>${project.basedir}/../stargate-lib</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>pw.krejci</groupId>
        <artifactId>jmh-maven-plugin</artifactId>
        <version>0.2.2</version>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>it-cassandra-3.11</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>cassandra-3.11</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <ccm.version>3.11.19</ccm.version>
                    <stargate.test.nodes>1</stargate.test.nodes>
                  </systemPropertyVariables>
                  <failIfNoTests>true</failIfNoTests>
                  <reportsDirectory>target/failsafe-reports/cassandra-3.11</reportsDirectory>
                  <summaryFile>target/failsafe-reports/summary-cassandra-3.11.xml</summaryFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>it-cassandra-4.0</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>cassandra-4.0</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <ccm.version>4.0.18</ccm.version>
                    <stargate.test.nodes>1</stargate.test.nodes>
                  </systemPropertyVariables>
                  <failIfNoTests>true</failIfNoTests>
                  <reportsDirectory>target/failsafe-reports/cassandra-4.0</reportsDirectory>
                  <summaryFile>target/failsafe-reports/summary-cassandra-4.0.xml</summaryFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>it-dse-6.8</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>dse-6.8</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <ccm.dse>true</ccm.dse>
                    <ccm.version>6.8.64</ccm.version>
                    <stargate.test.nodes>1</stargate.test.nodes>
                    <stargate.enable.dsev2>true</stargate.enable.dsev2>
                  </systemPropertyVariables>
                  <failIfNoTests>true</failIfNoTests>
                  <reportsDirectory>target/failsafe-reports/dse-6.8</reportsDirectory>
                  <summaryFile>target/failsafe-reports/summary-dse-6.8.xml</summaryFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>it-dse-v4-6.8</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>dse-6.8</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
                <configuration>
                  <systemPropertyVariables>
                    <ccm.dse>true</ccm.dse>
                    <ccm.version>6.8.64</ccm.version>
                    <stargate.test.nodes>1</stargate.test.nodes>
                    <stargate.enable.dsev2>false</stargate.enable.dsev2>
                  </systemPropertyVariables>
                  <failIfNoTests>true</failIfNoTests>
                  <reportsDirectory>target/failsafe-reports/dse-6.8</reportsDirectory>
                  <summaryFile>target/failsafe-reports/summary-dse-6.8.xml</summaryFile>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
