<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2023 Commonwealth Scientific and Industrial Research
  ~ Organisation (CSIRO) ABN 41 687 119 230.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<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>au.csiro.pathling</groupId>
    <artifactId>pathling</artifactId>
    <version>7.2.0</version>
  </parent>
  <artifactId>fhir-server</artifactId>
  <packaging>jar</packaging>

  <name>Pathling Server</name>
  <description>A server that exposes Pathling functionality through a FHIR API.</description>

  <properties>
    <pathling.fhirServerDockerRepo>aehrc/pathling</pathling.fhirServerDockerRepo>
    <pathling.fhirServerDockerTag>latest</pathling.fhirServerDockerTag>
    <pathling.dockerArchitecture>arm64</pathling.dockerArchitecture>
    <jmh.version>1.37</jmh.version>
    <pathling.dockerBaseImage>amazoncorretto:17</pathling.dockerBaseImage>
    <pathling.benchmark.warehouseUrl>file://${project.basedir}/src/test/resources/test-data</pathling.benchmark.warehouseUrl>
    <pathling.benchmark.databaseName>parquet</pathling.benchmark.databaseName>
    <pathling.benchmark.warmupIterations>1</pathling.benchmark.warmupIterations>
    <pathling.benchmark.testIterations>5</pathling.benchmark.testIterations>
  </properties>

  <dependencies>
    <dependency>
      <groupId>au.csiro.pathling</groupId>
      <artifactId>terminology</artifactId>
    </dependency>
    <dependency>
      <groupId>au.csiro.pathling</groupId>
      <artifactId>fhirpath</artifactId>
    </dependency>

    <!-- Apache Spark -->
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-core_${pathling.scalaVersion}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-sql_${pathling.scalaVersion}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.spark</groupId>
      <artifactId>spark-kubernetes_${pathling.scalaVersion}</artifactId>
    </dependency>
    <dependency>
      <groupId>io.delta</groupId>
      <artifactId>delta-spark_${pathling.scalaVersion}</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-aws</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-core</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
    </dependency>

    <!-- HAPI FHIR -->
    <dependency>
      <groupId>ca.uhn.hapi.fhir</groupId>
      <artifactId>hapi-fhir-base</artifactId>
    </dependency>
    <dependency>
      <groupId>ca.uhn.hapi.fhir</groupId>
      <artifactId>hapi-fhir-structures-r4</artifactId>
    </dependency>
    <dependency>
      <groupId>ca.uhn.hapi.fhir</groupId>
      <artifactId>hapi-fhir-server</artifactId>
    </dependency>
    <dependency>
      <groupId>ca.uhn.hapi.fhir</groupId>
      <artifactId>hapi-fhir-client</artifactId>
    </dependency>
    <!-- Woodstox is used by HAPI for XML processing -->
    <dependency>
      <groupId>com.fasterxml.woodstox</groupId>
      <artifactId>woodstox-core</artifactId>
    </dependency>

    <!-- Spring Boot -->
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-configuration-processor</artifactId>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-aop</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-oauth2-resource-server</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-oauth2-jose</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-jetty</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework.security</groupId>
      <artifactId>spring-security-test</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- ANTLR -->
    <dependency>
      <groupId>org.antlr</groupId>
      <artifactId>antlr4</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.auth0</groupId>
      <artifactId>java-jwt</artifactId>
      <version>4.5.0</version>
    </dependency>
    <dependency>
      <groupId>com.auth0</groupId>
      <artifactId>jwks-rsa</artifactId>
      <version>0.22.1</version>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <dependency>
      <groupId>com.amazonaws</groupId>
      <artifactId>aws-java-sdk-bundle</artifactId>
    </dependency>
    <dependency>
      <groupId>io.sentry</groupId>
      <artifactId>sentry</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>io.micrometer</groupId>
      <artifactId>micrometer-registry-prometheus</artifactId>
      <version>1.14.4</version>
    </dependency>

    <!-- Testing -->
    <dependency>
      <groupId>au.csiro.pathling</groupId>
      <artifactId>utilities</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>au.csiro.pathling</groupId>
      <artifactId>terminology</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>au.csiro.pathling</groupId>
      <artifactId>fhirpath</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-test</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.junit.vintage</groupId>
          <artifactId>junit-vintage-engine</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.github.docker-java</groupId>
      <artifactId>docker-java</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.docker-java</groupId>
      <artifactId>docker-java-transport-okhttp</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.tomakehurst</groupId>
      <artifactId>wiremock-jre8-standalone</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Lombok -->
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
    </dependency>

    <!-- Misc -->
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.json</groupId>
      <artifactId>json</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
    </dependency>

    <!-- JMH libs for benchmarking-->
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-core</artifactId>
      <version>${jmh.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.openjdk.jmh</groupId>
      <artifactId>jmh-generator-annprocess</artifactId>
      <version>${jmh.version}</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-clean-plugin</artifactId>
        <configuration>
          <filesets>
            <fileset>
              <directory>${project.basedir}/src/test/resources/test-data/parquet</directory>
              <includes>
                <include>**/*</include>
              </includes>
            </fileset>
          </filesets>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <executions>
          <execution>
            <id>default-test</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <groups>UnitTest</groups>
              <systemPropertyVariables>
                <spring.profiles.active>unit-test</spring.profiles.active>
                <spark.logConf>true</spark.logConf>
                <pathling.storage.warehouseUrl>file://${project.basedir}/src/test/resources/test-data</pathling.storage.warehouseUrl>
                <pathling.storage.databaseName>parquet</pathling.storage.databaseName>
              </systemPropertyVariables>
            </configuration>
          </execution>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <groups>IntegrationTest</groups>
              <forkCount>1</forkCount>
              <systemPropertyVariables>
                <spring.profiles.active>core,server,integration-test</spring.profiles.active>
                <pathling.storage.warehouseUrl>
                  file://${project.basedir}/src/test/resources/test-data
                </pathling.storage.warehouseUrl>
                <pathling.storage.databaseName>parquet</pathling.storage.databaseName>
              </systemPropertyVariables>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>au/csiro/pathling/fhirpath/parser/generated/*</exclude>
            <exclude>au/csiro/pathling/terminology/mock/*</exclude>
          </excludes>
        </configuration>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.google.cloud.tools</groupId>
          <artifactId>jib-maven-plugin</artifactId>
          <version>3.4.4</version>
          <configuration>
            <from>
              <image>${pathling.dockerBaseImage}</image>
              <platforms>
                <platform>
                  <architecture>${pathling.dockerArchitecture}</architecture>
                  <os>linux</os>
                </platform>
              </platforms>
            </from>
            <to>
              <image>${pathling.fhirServerDockerRepo}</image>
              <tags>
                <tag>${pathling.fhirServerDockerTag}</tag>
                <tag>${project.version}</tag>
                <tag>${project.majorVersion}</tag>
                <tag>${git.commit.id}</tag>
              </tags>
            </to>
            <container>
              <environment>
                <PATHLING_VERSION>${project.version}</PATHLING_VERSION>
                <!-- The add-exports and add-opens flags are required for Java 17 -->
                <JAVA_TOOL_OPTIONS>-Xmx2g -XX:MaxMetaspaceSize=400m -XX:ReservedCodeCacheSize=240m -Xss1m -Duser.timezone=UTC --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/sun.nio.ch=ALL-UNNAMED</JAVA_TOOL_OPTIONS>
              </environment>
              <labels>
                <copyright>Copyright © 2018-2023, Commonwealth Scientific and Industrial Research Organisation (CSIRO) ABN 41 687 119 230. Licensed under the CSIRO Open Source Software Licence Agreement.</copyright>
                <author>John Grimes &lt;John.Grimes@csiro.au&gt;</author>
              </labels>
              <ports>
                <port>8080</port>
                <port>8081</port>
                <port>4040</port>
                <port>7077</port>
              </ports>
              <entrypoint>
                <command>/usr/bin/entrypoint.sh</command>
              </entrypoint>
            </container>
            <extraDirectories>
              <paths>src/main/jib</paths>
              <permissions>
                <permission>
                  <file>/usr/bin/entrypoint.sh</file>
                  <mode>755</mode>
                </permission>
              </permissions>
            </extraDirectories>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
  <repositories>
    <repository>
      <id>maven_central</id>
      <name>Maven Central</name>
      <url>https://repo.maven.apache.org/maven2/</url>
    </repository>
  </repositories>

  <profiles>
    <profile>
      <id>runBenchmark</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>run-benchmark</id>
                <phase>test</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>java</executable>
                  <arguments>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>-Xmx6g</argument>
                    <argument>-XX:MaxMetaspaceSize=400m</argument>
                    <argument>-XX:ReservedCodeCacheSize=240m</argument>
                    <argument>-Xss1m</argument>
                    <argument>-Duser.timezone=UTC</argument>
                    <argument>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argument>
                    <argument>--add-opens=java.base/java.net=ALL-UNNAMED</argument>
                    <argument>--add-opens=java.base/sun.nio.ch=ALL-UNNAMED</argument>
                    <argument>-Dspring.profiles.active=unit-test</argument>
                    <argument>-Dpathling.storage.warehouseUrl=${pathling.benchmark.warehouseUrl}</argument>
                    <argument>-Dpathling.storage.databaseName=${pathling.benchmark.databaseName}</argument>
                    <argument>-Dbenchmark.test.iterations=${pathling.benchmark.testIterations}</argument>
                    <argument>-Dbenchmark.warmup.iterations=${pathling.benchmark.warmupIterations}</argument>
                    <argument>au.csiro.pathling.test.benchmark.PathlingBenchmarkRunner</argument>
                    <argument>${project.build.directory}/benchmark</argument>
                  </arguments>
                  <classpathScope>test</classpathScope>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>importTestData</id>
      <activation>
        <property>
          <name>!skipTests</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>import-test-data</id>
                <phase>process-test-classes</phase>
                <goals>
                  <goal>exec</goal>
                </goals>
                <configuration>
                  <executable>java</executable>
                  <arguments>
                    <argument>-classpath</argument>
                    <classpath/>
                    <argument>-Xmx4g</argument>
                    <argument>-Duser.timezone=UTC</argument>
                    <argument>--add-exports=java.base/sun.nio.ch=ALL-UNNAMED</argument>
                    <argument>--add-opens=java.base/java.net=ALL-UNNAMED</argument>
                    <argument>--add-opens=java.base/sun.nio.ch=ALL-UNNAMED</argument>
                    <argument>-Dspring.profiles.active=spark,fhir,import,cli</argument>
                    <argument>-Dpathling.version=${project.version}</argument>
                    <argument>-Dpathling.terminology.enabled=false</argument>
                    <argument>-Dpathling.storage.warehouseUrl=file://${project.basedir}/src/test/resources/test-data</argument>
                    <argument>-Dpathling.storage.databaseName=parquet</argument>
                    <argument>-Dspark.master=local[1]</argument>
                    <argument>au.csiro.pathling.test.TestDataImporter</argument>
                    <argument>${project.basedir}/src/test/resources/test-data/fhir</argument>
                  </arguments>
                  <classpathScope>test</classpathScope>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>docker</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
              <execution>
                <id>system-test</id>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <classesDirectory>${project.build.outputDirectory}</classesDirectory>
              <includes>
                <include>**/*.java</include>
              </includes>
              <groups>SystemTest</groups>
              <systemPropertyVariables>
                <pathling.systemTest.version>${git.commit.id}</pathling.systemTest.version>
                <pathling.systemTest.auth.issuer>
                  https://auth.ontoserver.csiro.au/auth/realms/aehrc
                </pathling.systemTest.auth.issuer>
                <pathling.systemTest.auth.clientId>pathling-test</pathling.systemTest.auth.clientId>
                <pathling.systemTest.auth.requestedScope>
                  openid user/*.*
                </pathling.systemTest.auth.requestedScope>
                <pathling.systemTest.terminology.serverUrl>
                  https://tx.ontoserver.csiro.au/fhir
                </pathling.systemTest.terminology.serverUrl>
                <pathling.systemTest.dockerRepository>
                  ${pathling.fhirServerDockerRepo}
                </pathling.systemTest.dockerRepository>
                <spring.profiles.active>system-test</spring.profiles.active>
              </systemPropertyVariables>
            </configuration>
          </plugin>
          <plugin>
            <groupId>com.google.cloud.tools</groupId>
            <artifactId>jib-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>build</id>
                <phase>package</phase>
                <goals>
                  <goal>dockerBuild</goal>
                </goals>
              </execution>
              <execution>
                <id>deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <from>
                    <image>${pathling.dockerBaseImage}</image>
                    <platforms>
                      <platform>
                        <architecture>amd64</architecture>
                        <os>linux</os>
                      </platform>
                      <platform>
                        <architecture>arm64</architecture>
                        <os>linux</os>
                      </platform>
                    </platforms>
                  </from>
                  <to>
                    <image>${pathling.fhirServerDockerRepo}</image>
                    <tags>
                      <tag>${pathling.fhirServerDockerTag}</tag>
                      <tag>${project.version}</tag>
                      <tag>${project.majorVersion}</tag>
                    </tags>
                  </to>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>dockerPreRelease</id>
      <build>
        <plugins>
          <plugin>
            <groupId>com.google.cloud.tools</groupId>
            <artifactId>jib-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>deploy</id>
                <phase>deploy</phase>
                <goals>
                  <goal>build</goal>
                </goals>
                <configuration>
                  <from>
                    <image>${pathling.dockerBaseImage}</image>
                    <platforms>
                      <platform>
                        <architecture>amd64</architecture>
                        <os>linux</os>
                      </platform>
                      <platform>
                        <architecture>arm64</architecture>
                        <os>linux</os>
                      </platform>
                    </platforms>
                  </from>
                  <to combine.self="override">
                    <image>${pathling.fhirServerDockerRepo}:${pathling.fhirServerDockerTag}-develop</image>
                  </to>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>testTranche1</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>default-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>UnitTest &amp; Tranche1</groups>
                  <systemPropertyVariables>
                    <spring.profiles.active>unit-test</spring.profiles.active>
                    <spark.logConf>true</spark.logConf>
                  </systemPropertyVariables>
                </configuration>
              </execution>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>IntegrationTest &amp; Tranche1</groups>
                  <forkCount>1</forkCount>
                  <systemPropertyVariables>
                    <spring.profiles.active>core,server,integration-test</spring.profiles.active>
                    <pathling.storage.warehouseUrl>
                      file://${project.basedir}/src/test/resources/test-data
                    </pathling.storage.warehouseUrl>
                    <pathling.storage.databaseName>parquet</pathling.storage.databaseName>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>testTranche2</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>default-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>UnitTest &amp; Tranche2</groups>
                  <systemPropertyVariables>
                    <spring.profiles.active>unit-test</spring.profiles.active>
                    <spark.logConf>true</spark.logConf>
                  </systemPropertyVariables>
                </configuration>
              </execution>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>IntegrationTest &amp; Tranche2</groups>
                  <forkCount>1</forkCount>
                  <systemPropertyVariables>
                    <spring.profiles.active>core,server,integration-test</spring.profiles.active>
                    <pathling.storage.warehouseUrl>
                      file://${project.basedir}/src/test/resources/test-data
                    </pathling.storage.warehouseUrl>
                    <pathling.storage.databaseName>parquet</pathling.storage.databaseName>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>testTranche3</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
              <execution>
                <id>default-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>UnitTest &amp; !Tranche1 &amp; !Tranche2</groups>
                  <systemPropertyVariables>
                    <spring.profiles.active>unit-test</spring.profiles.active>
                    <spark.logConf>true</spark.logConf>
                  </systemPropertyVariables>
                </configuration>
              </execution>
              <execution>
                <id>integration-test</id>
                <goals>
                  <goal>test</goal>
                </goals>
                <configuration>
                  <groups>IntegrationTest &amp; !Tranche1 &amp; !Tranche2</groups>
                  <forkCount>1</forkCount>
                  <systemPropertyVariables>
                    <spring.profiles.active>core,server,integration-test</spring.profiles.active>
                    <pathling.storage.warehouseUrl>
                      file://${project.basedir}/src/test/resources/test-data
                    </pathling.storage.warehouseUrl>
                    <pathling.storage.databaseName>parquet</pathling.storage.databaseName>
                  </systemPropertyVariables>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
