<?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>org.operaton.bpm</groupId>
    <artifactId>operaton-external-task-client-root</artifactId>
    <version>1.1.0</version>
  </parent>
  <artifactId>operaton-external-task-client</artifactId>
  <name>Operaton - Java External Task Client - Client</name>
  <description>${project.name}</description>
  <properties>
    <engine.runtime>${project.build.directory}/operaton-tomcat</engine.runtime>
    <tomcat.runtime>${engine.runtime}/server/apache-tomcat-${version.tomcat}</tomcat.runtime>

    <!-- Do not declare any default values for
      `tomcat.connector.http.port` and `tomcat.connector.ajp.port`
      elsewhere these values will be used for Cargo regardless of the `reserve-network-port` run -->

    <cargo.timeout>240000</cargo.timeout>
    <cargo.deploy.timeout>60000</cargo.deploy.timeout>
    <cargo.start.jvmargs>-Dpolyglot.js.nashorn-compat=true</cargo.start.jvmargs>
  </properties>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.operaton.commons</groupId>
        <artifactId>operaton-commons-bom</artifactId>
        <version>${project.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>org.operaton.bpm</groupId>
        <artifactId>operaton-core-internal-dependencies</artifactId>
        <version>${project.version}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
      <dependency>
        <groupId>com.fasterxml.jackson</groupId>
        <artifactId>jackson-bom</artifactId>
        <version>${version.jackson}</version>
        <scope>import</scope>
        <type>pom</type>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <dependencies>
    <!-- mandatory dependencies -->
    <dependency>
      <groupId>org.operaton.commons</groupId>
      <artifactId>operaton-commons-logging</artifactId>
    </dependency>
    <dependency>
      <groupId>org.operaton.commons</groupId>
      <artifactId>operaton-commons-typed-values</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.operaton.bpm.model</groupId>
      <artifactId>operaton-bpmn-model</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.skyscreamer</groupId>
      <artifactId>jsonassert</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.operaton.bpm</groupId>
      <artifactId>operaton-engine</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.operaton.spin</groupId>
      <artifactId>operaton-spin-dataformat-all</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.xml.bind</groupId>
      <artifactId>jakarta.xml.bind-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>jakarta.activation</groupId>
      <artifactId>jakarta.activation-api</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-core</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.glassfish.jaxb</groupId>
      <artifactId>jaxb-runtime</artifactId>
      <scope>provided</scope>
    </dependency>
    <!-- dependency of org.glassfish.jaxb:jaxb-core -->
    <dependency>
      <groupId>com.sun.istack</groupId>
      <artifactId>istack-commons-runtime</artifactId>
      <version>4.2.0</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.4.0</version>
        <executions>
          <execution>
            <id>filter-properties</id>
            <phase>process-test-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <skip>${skipTests}</skip>
              <propertiesEncoding>ISO-8859-1</propertiesEncoding>
              <outputDirectory>target/test-classes/</outputDirectory>
              <resources>
                <resource>
                  <directory>src/it/resources</directory>
                  <filtering>true</filtering>
                  <includes>
                    <include>integration-rules.properties</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <trimStackTrace>false</trimStackTrace>
        </configuration>
      </plugin>
    </plugins>
    <testResources>
      <testResource>
        <directory>src/it/resources</directory>
      </testResource>
      <testResource>
        <directory>src/test/resources</directory>
      </testResource>
    </testResources>
  </build>
  <profiles>
    <profile>
      <id>debug-cargo</id>
      <properties>
        <cargo.start.jvmargs>-Xdebug
          -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5055
          -Xnoagent
          -Djava.compiler=NONE
          -Djava.awt.headless=true
        </cargo.start.jvmargs>
      </properties>
    </profile>
    <profile>
      <id>distro</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.operaton.bpm.qa</groupId>
          <artifactId>engine-variable-test</artifactId>
          <version>${project.version}</version>
          <classifier>classes</classifier>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.operaton.bpm</groupId>
          <artifactId>operaton-engine-rest</artifactId>
          <scope>test</scope>
          <type>war</type>
          <classifier>tomcat</classifier>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.operaton.bpm.qa</groupId>
          <artifactId>engine-variable-test</artifactId>
          <scope>test</scope>
          <type>war</type>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.operaton.bpm.tomcat</groupId>
          <artifactId>operaton-tomcat-assembly</artifactId>
          <version>${project.version}</version>
          <type>tar.gz</type>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <artifactId>slf4j-api</artifactId>
              <groupId>org.slf4j</groupId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>reserve-ports</id>
                <phase>initialize</phase>
                <goals>
                  <goal>reserve-network-port</goal>
                </goals>
                <configuration>
                  <skip>${skipTests}</skip>
                  <portNames>
                    <portName>tomcat.connector.http.port</portName>
                    <portName>tomcat.connector.ajp.port</portName>
                  </portNames>
                </configuration>
              </execution>
              <execution>
                <id>add-it-source</id>
                <phase>generate-test-sources</phase>
                <goals>
                  <goal>add-test-source</goal>
                </goals>
                <configuration>
                  <sources>
                    <source>src/it/java</source>
                  </sources>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <skip>${skipTests}</skip>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.operaton.bpm.tomcat</groupId>
                      <artifactId>operaton-tomcat-assembly</artifactId>
                      <version>${project.version}</version>
                      <type>tar.gz</type>
                      <outputDirectory>${engine.runtime}</outputDirectory>
                      <overWrite>true</overWrite>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <redirectTestOutputToFile>true</redirectTestOutputToFile>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>integration-test</goal>
                  <goal>verify</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven3-plugin</artifactId>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>start</goal>
                </goals>
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>post-integration-test</phase>
                <goals>
                  <goal>stop</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <skip>${skipTests}</skip>
              <!-- Container configuration -->
              <container>
                <type>installed</type>
                <containerId>tomcat11x</containerId>
                <append>false</append>
                <home>${tomcat.runtime}</home>
                <timeout>${cargo.timeout}</timeout>
                <log>${tomcat.runtime}/logs/catalina.out</log>
                <dependencies>
                  <dependency>
                    <group-id>jakarta.xml.bind</group-id>
                    <artifact-id>jakarta.xml.bind-api</artifact-id>
                    <type>jar</type>
                  </dependency>
                  <!-- required by PaSerializationIT -->
                  <dependency>
                    <groupId>jakarta.activation</groupId>
                    <artifactId>jakarta.activation-api</artifactId>
                    <type>jar</type>
                  </dependency>
                  <dependency>
                    <groupId>org.glassfish.jaxb</groupId>
                    <artifactId>jaxb-core</artifactId>
                    <type>jar</type>
                  </dependency>
                  <dependency>
                    <groupId>org.glassfish.jaxb</groupId>
                    <artifactId>jaxb-runtime</artifactId>
                    <type>jar</type>
                  </dependency>
                  <dependency>
                    <groupId>com.sun.istack</groupId>
                    <artifactId>istack-commons-runtime</artifactId>
                    <type>jar</type>
                  </dependency>
                  <!-- required by ClientIT -->
                  <dependency>
                    <groupId>org.graalvm.sdk</groupId>
                    <artifactId>nativeimage</artifactId>
                  </dependency>
                </dependencies>
              </container>
              <configuration>
                <type>standalone</type>
                <home>${project.build.directory}/cargo-config-tomcat</home>
                <properties>
                  <cargo.servlet.port>${tomcat.connector.http.port}</cargo.servlet.port>
                  <cargo.tomcat.ajp.port>${tomcat.connector.ajp.port}</cargo.tomcat.ajp.port>
                  <cargo.start.jvmargs>-Djava.security.egd=file:/dev/./urandom</cargo.start.jvmargs>
                  <cargo.start.jvmargs>${cargo.start.jvmargs}</cargo.start.jvmargs>
                </properties>
                <files>
                  <copy>
                    <configfile>true</configfile>
                    <file>${project.basedir}/src/it/resources/tomcat/bpm-platform.xml</file>
                    <tofile>conf/bpm-platform.xml</tofile>
                    <overwrite>true</overwrite>
                  </copy>
                </files>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>org.operaton.bpm</groupId>
                  <artifactId>operaton-engine-rest</artifactId>
                  <type>war</type>
                  <classifier>tomcat</classifier>
                  <pingURL>
                    http://localhost:${tomcat.connector.http.port}/engine-rest/engine/default/process-definition
                  </pingURL>
                  <pingTimeout>${cargo.deploy.timeout}</pingTimeout>
                  <properties>
                    <context>engine-rest</context>
                  </properties>
                </deployable>
                <deployable>
                  <groupId>org.operaton.bpm.qa</groupId>
                  <artifactId>engine-variable-test</artifactId>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
