<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.kie.server</groupId>
    <artifactId>kie-server-tests</artifactId>
    <version>7.56.0.Final</version>
  </parent>

  <artifactId>kie-server-integ-tests-jbpm</artifactId>

  <name>KIE :: Execution Server :: Tests :: jBPM Integration Tests</name>
  <description>KIE Execution Server Integration Tests (REST, JMS) with configuration to run on different supported containers.</description>

  <properties>
    <java.module.name>org.kie.server.itests.jbpm.core</java.module.name>
    <org.jbpm.server.ext.disabled>false</org.jbpm.server.ext.disabled>
    <skip-prepare-kie-server>true</skip-prepare-kie-server>
  </properties>

  <dependencies>
    <!-- Common Kie server test classes -->
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-common</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- kie server deps -->
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-client</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Needed for DBExternalResource -->
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-test-util</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Used in DocumentServiceIntegrationTest -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-document</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- Used in RuntimeDataServiceIntegrationTest -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-services-api</artifactId>
    </dependency>

    <!-- Used for instantiation of CorrelationKeyFactory -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-jpa</artifactId>
      <scope>test</scope>
    </dependency>
    
    <!-- Used for CustomNotificationListener -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-human-task-core</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.activation</groupId>
          <artifactId>activation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Used as an email client in UserTaskEscalationIntegrationTest -->
    <dependency>
      <groupId>org.subethamail</groupId>
      <artifactId>subethasmtp-wiser</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <!-- Deployments for application servers -->
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server</artifactId>
      <classifier>webc</classifier>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server</artifactId>
      <classifier>ee7</classifier>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server</artifactId>
      <classifier>ee8</classifier>
      <type>war</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-test-web-service</artifactId>
      <type>war</type>
      <scope>test</scope>
    </dependency>

    <!-- This is an artificial dependency to make sure the kie-server-tests 
      modules are executed one at a time during parallel build (otherwise the tests 
      fail because of conflicting port binding) -->
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-drools</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <id>prepare-kie-server</id>
              <phase>pre-integration-test</phase>
              <configuration>
                <skip>${skip-prepare-kie-server}</skip>
                <target>
                  <unzip src="${kie-server.war.path}"
                         dest="${project.build.directory}/unzipped-kie-server" />
                  <copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
                        todir="${project.build.directory}/unzipped-kie-server/WEB-INF/lib" />
                  <zip destfile="${project.build.directory}/kie-server.war"
                       basedir="${project.build.directory}/unzipped-kie-server" />
                </target>
              </configuration>
              <goals>
                <goal>run</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <systemPropertyVariables>
              <!-- Values are supplied by specific profiles -->
              <org.kie.server.bypass.auth.user>true</org.kie.server.bypass.auth.user>
              <cargo.container.id>${cargo.container.id}</cargo.container.id>
              <cargo.servlet.port>${container.port}</cargo.servlet.port>
              <kie.server.context>${kie.server.context}</kie.server.context>
              <kie.server.war.path>${kie.server.war.path}</kie.server.war.path>
              <weblogic.home>${weblogic.home}</weblogic.home>
              <kie.server.remoting.url>${kie.server.remoting.url}</kie.server.remoting.url>
              <webservice.http.url>${webservice.http.url}</webservice.http.url>
              <kie.server.base.http.url>${kie.server.base.http.url}</kie.server.base.http.url>
              <kie.server.context.factory>${kie.server.context.factory}</kie.server.context.factory>
              <kie.server.connection.factory>${kie.server.connection.factory}</kie.server.connection.factory>
              <kie.server.jndi.request.queue>${kie.server.jndi.request.queue}</kie.server.jndi.request.queue>
              <kie.server.jndi.response.queue>${kie.server.jndi.response.queue}</kie.server.jndi.response.queue>
              <org.jbpm.server.ext.disabled>${org.jbpm.server.ext.disabled}</org.jbpm.server.ext.disabled>
              <org.drools.server.ext.disabled>true</org.drools.server.ext.disabled>
              <org.jbpm.ui.server.ext.disabled>true</org.jbpm.ui.server.ext.disabled>
              <org.optaplanner.server.ext.disabled>true</org.optaplanner.server.ext.disabled>
              <org.jbpm.case.server.ext.disabled>true</org.jbpm.case.server.ext.disabled>
              <kie.server.testing.kjars.build.settings.xml>${kie.server.testing.kjars.build.settings.xml}</kie.server.testing.kjars.build.settings.xml>
              <org.kie.server.persistence.ds>${org.kie.server.persistence.ds}</org.kie.server.persistence.ds>
              <!-- Some tests need to know which DB they are currently run 
                with -->
              <org.kie.server.datasource.driver.class>${org.kie.server.datasource.driver.class}</org.kie.server.datasource.driver.class>
              <org.jbpm.document.storage>${org.jbpm.document.storage}</org.jbpm.document.storage>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <configuration>
            <nonFilteredFileExtensions>
              <nonFilteredFileExtension>xls</nonFilteredFileExtension>
            </nonFilteredFileExtensions>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
      <testResource>
        <directory>../src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <configuration>
          <container>
            <systemProperties>
              <org.kie.server.bypass.auth.user>true</org.kie.server.bypass.auth.user>
              <org.jbpm.server.ext.disabled>${org.jbpm.server.ext.disabled}</org.jbpm.server.ext.disabled>
              <org.jbpm.ui.server.ext.disabled>true</org.jbpm.ui.server.ext.disabled>
              <org.optaplanner.server.ext.disabled>true</org.optaplanner.server.ext.disabled>
              <org.jbpm.case.server.ext.disabled>true</org.jbpm.case.server.ext.disabled>
              <org.drools.server.ext.disabled>true</org.drools.server.ext.disabled>
              <!-- UserInfo properties for UserTaskEscalationIntegrationTest -->
              <org.jbpm.ht.userinfo>props</org.jbpm.ht.userinfo>
              <jbpm.user.info.properties>file://${project.build.testOutputDirectory}/userinfo.properties</jbpm.user.info.properties>
            </systemProperties>
          </container>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>local-test-run</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-services-common</artifactId>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <!-- Classes from this dependency already packaged in 'xml-apis:xml-apis' -->
              <groupId>javax.xml.stream</groupId>
              <artifactId>stax-api</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-services-jbpm</artifactId>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>org.codehaus.woodstox</groupId>
              <artifactId>woodstox-core-asl</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-rest-common</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-rest-jbpm</artifactId>
          <scope>test</scope>
        </dependency>

        <!-- Needed for ORM mapping file processing -->
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-case-mgmt-impl</artifactId>
          <scope>test</scope>
        </dependency>

        <!-- Needed for jBPM persistence -->
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <!-- Contains org.jbpm.test.util.CloseSafeMemoryContextFactory used as a context factory for local tests -->
        <dependency>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-test-util</artifactId>
          <scope>test</scope>
        </dependency>
        <!-- Excluding javax.activation-api as it collides with javax.activation:activation -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-core</artifactId>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>javax.activation</groupId>
              <artifactId>javax.activation-api</artifactId>
            </exclusion>
            <!-- collides with com.sun.xml.bind:jaxb-impl:jar:2.3.0 and com.sun.xml.bind:jaxb-impl:jar:2.3.0 -->
            <exclusion>
              <groupId>org.glassfish.jaxb</groupId>
              <artifactId>jaxb-runtime</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>tomcat9</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>tomcat9</value>
        </property>
      </activation>
      <properties>
        <kie-server.war.path>${maven.dependency.org.kie.server.kie-server.webc.war.path}</kie-server.war.path>
        <skip-prepare-kie-server>false</skip-prepare-kie-server>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <deployables>
                  <deployable>
                    <location>${project.build.directory}/kie-server.war</location>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>wildfly</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>wildfly</value>
        </property>
      </activation>
      <properties>
        <kie-server.war.path>${maven.dependency.org.kie.server.kie-server.ee8.war.path}</kie-server.war.path>
        <skip-prepare-kie-server>false</skip-prepare-kie-server>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <deployables>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server</artifactId>
                    <location>${project.build.directory}/kie-server.war</location>
                    <!-- default, may be overridden in container specific 
                      profiles -->
                    <classifier>${kie.server.classifier}</classifier>
                    <type>war</type>
                    <properties>
                      <context>${kie.server.context}</context>
                    </properties>
                    <pingURL>${kie.server.base.http.url}</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server-test-web-service</artifactId>                    
                    <type>war</type>
                    <properties>
                      <context>kie-server-test-web-service</context>
                    </properties>
                    <pingURL>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface?wsdl</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>eap7</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>eap7</value>
        </property>
      </activation>
      <properties>
        <kie-server.war.path>${maven.dependency.org.kie.server.kie-server.ee8.war.path}</kie-server.war.path>
        <skip-prepare-kie-server>false</skip-prepare-kie-server>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <deployables>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server</artifactId>
                    <location>${project.build.directory}/kie-server.war</location>
                    <!-- default, may be overridden in container specific 
                      profiles -->
                    <classifier>${kie.server.classifier}</classifier>
                    <type>war</type>
                    <properties>
                      <context>${kie.server.context}</context>
                    </properties>
                    <pingURL>${kie.server.base.http.url}</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server-test-web-service</artifactId>                    
                    <type>war</type>
                    <properties>
                      <context>kie-server-test-web-service</context>
                    </properties>
                    <pingURL>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface?wsdl</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>oracle-wls-12</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>oracle-wls-12</value>
        </property>
      </activation>
      <properties>
        <kie-server.war.path>${maven.dependency.org.kie.server.kie-server.ee7.war.path}</kie-server.war.path>
        <skip-prepare-kie-server>false</skip-prepare-kie-server>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <deployables>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server</artifactId>
                    <location>${project.build.directory}/kie-server.war</location>
                    <!-- default, may be overridden in container specific 
                      profiles -->
                    <classifier>${kie.server.classifier}</classifier>
                    <type>war</type>
                    <properties>
                      <context>${kie.server.context}</context>
                    </properties>
                    <pingURL>${kie.server.base.http.url}</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server-test-web-service</artifactId>                    
                    <type>war</type>
                    <properties>
                      <context>kie-server-test-web-service</context>
                    </properties>
                    <pingURL>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface?wsdl</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>      
    </profile>
    <profile>
      <id>websphere9</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>websphere9</value>
        </property>
      </activation>
      <properties>
        <kie-server.war.path>${maven.dependency.org.kie.server.kie-server.ee7.war.path}</kie-server.war.path>
        <skip-prepare-kie-server>false</skip-prepare-kie-server>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <webservice.http.url>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface/AcmeDemoService.wsdl</webservice.http.url>
              </systemPropertyVariables>
            </configuration>
          </plugin>
          <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <deployables>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server</artifactId>
                    <location>${project.build.directory}/kie-server.war</location>
                    <!-- default, may be overridden in container specific 
                      profiles -->
                    <classifier>${kie.server.classifier}</classifier>
                    <type>war</type>
                    <properties>
                      <context>${kie.server.context}</context>
                    </properties>
                    <pingURL>${kie.server.base.http.url}</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                  <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>kie-server-test-web-service</artifactId>                    
                    <type>war</type>
                    <properties>
                      <context>kie-server-test-web-service</context>
                    </properties>
                    <pingURL>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface/AcmeDemoService.wsdl</pingURL>
                    <pingTimeout>60000</pingTimeout>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>springboot</id>
      <activation>
        <property>
          <name>container.profile</name>
          <value>springboot</value>
        </property>
      </activation>
      <properties>
        <kieserver.jbpm.enabled>true</kieserver.jbpm.enabled>
        <jbpm.executor.enabled>true</jbpm.executor.enabled>
        <org.kie.server.bypass.auth.user>true</org.kie.server.bypass.auth.user>
      </properties>
    </profile>
  </profiles>
</project>
