<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-parent</artifactId>
    <version>7.23.0.Final</version>
  </parent>

  <artifactId>kie-server-tests</artifactId>
  <packaging>pom</packaging>

  <name>KIE :: Execution Server :: Tests</name>
  <description>KIE Execution Server Tests Parent</description>

  <!-- Properties shared between the different test modules -->
  <properties>
    <!-- This property needs to be overridden when running tests against different version of the WAR (e.g. running
         SNAPSHOT tests against Beta3 WAR) so the tests actually know what exact version of server is being tested -->
    <kie.server.version>${project.version}</kie.server.version>
    <!-- Following properties are used only for testing -->
    <container.hostname>localhost</container.hostname>
    <!-- <container.port/> can't define the default port value, because the build-helper-maven-plugin:reserve-network-port
         is not able to override the value of the property. The port number would then always be the same
         (the default one, unless changed from outside) -->
    <kie.server.context>kie-server-services</kie.server.context>
    <cargo.container.id>valid-id-needs-to-be-specified-in-appropriate-container-profile</cargo.container.id>
    <kie.server.controller.context>kie-server-controller-services</kie.server.controller.context>
    <kie.server.classifier>ee8</kie.server.classifier>
    <kie.server.controller.classifier>ee7</kie.server.controller.classifier>
    <!-- Path to Kie server WAR file. Used for referencing WAR file in on-demand deployment/undeployment. -->
    <kie.server.war.path>${org.kie.server:kie-server:war:ee8}</kie.server.war.path>
    <org.kie.server.controller.templatefile>${project.build.directory}/server-template-storage.xml</org.kie.server.controller.templatefile>
    <webservice.http.url>http://${container.hostname}:${container.port}/kie-server-test-web-service/AcmeDemoInterface?wsdl</webservice.http.url>
    <kie.server.base.http.url>http://${container.hostname}:${container.port}/${kie.server.context}/services/rest/server</kie.server.base.http.url>
    <kie.server.controller.base.http.url>http://${container.hostname}:${container.port}/${kie.server.controller.context}/rest/controller</kie.server.controller.base.http.url>
    <kie.server.testing.server.local.repo.dir>${project.build.directory}/kie-server-testing-server-local-repo</kie.server.testing.server.local.repo.dir>
    <kie.server.testing.remote.repo.dir>${project.build.directory}/kie-server-testing-remote-repo</kie.server.testing.remote.repo.dir>
    <!-- This property can be overridden when some other remote repo location should be used -->
    <kie.server.testing.remote.repo.url>file://${kie.server.testing.remote.repo.dir}</kie.server.testing.remote.repo.url>
    <!-- Custom settings.xml used when building the testing kjars. By default there is no additional configuration needed,
         but for testing e.g. stated builds it is necessary to pass additional repository with the staged artifacts. -->
    <kie.server.testing.kjars.build.settings.xml/>
    <kie.server.server.deployment.settings.xml>${project.build.testOutputDirectory}/kie-server-testing-server-custom-settings.xml</kie.server.server.deployment.settings.xml>
    <org.jbpm.document.storage>${project.build.directory}/docs</org.jbpm.document.storage>
    <kie.server.router.url>http://localhost:${router.port}</kie.server.router.url>
    <!-- This property can be overridden to exclude specific test category according to specific needs. -->
    <failsafe.excluded.groups/>
    <!-- Sybase driver leaks its Timestamp implementation. To correctly handle it we need to add driver as additional test classpath. -->
    <maven.jdbc.driver.jar/>
    <!-- Set to true if you want to skip JMS tests even for containers with available JMS. -->
    <jms.skip>false</jms.skip>

    <!-- Kie server datasource configuration. -->
    <!--  <org.kie.server.persistence.ds/> Defined in container profiles.-->
    <org.kie.server.persistence.dialect>org.hibernate.dialect.H2Dialect</org.kie.server.persistence.dialect>
    <org.kie.server.datasource.connection.url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</org.kie.server.datasource.connection.url>
    <org.kie.server.datasource.username>sa</org.kie.server.datasource.username>
    <org.kie.server.datasource.password>sa</org.kie.server.datasource.password>
    <org.kie.server.datasource.driver.class>org.h2.jdbcx.JdbcDataSource</org.kie.server.datasource.driver.class>
    <org.kie.server.mode.production>PRODUCTION</org.kie.server.mode.production>

    <!-- Springboot specific property which is overridden by production DBs profile -->
    <!-- By default we use bundled H2 database jar -->
    <springboot.jdbc.driver.jar/>

    <version.org.postgresql>42.1.1</version.org.postgresql>
    <!-- The EAP 7 binary can't be anonymously downloaded because of the license. It can be downloaded manually
         and for free (e.g. from http://jbossas.jboss.org/downloads.html) and the zip location needs to be specified
         here or via system property when running the build (don't forget to use the `file://` prefix when
         referencing the zip from local filesystem). -->
    <eap7.download.url>valid-url-for-eap-7-needs-to-be-specified-here-or-via-cmd-line</eap7.download.url>
  </properties>

  <modules>
    <module>kie-server-test-web-service</module>
    <module>kie-server-integ-tests-common</module>
    <module>kie-server-integ-tests-drools</module>
    <module>kie-server-integ-tests-jbpm</module>
    <module>kie-server-integ-tests-optaplanner</module>
    <module>kie-server-integ-tests-all</module>
    <module>kie-server-integ-tests-controller</module>
    <module>kie-server-integ-tests-policy</module>
    <module>kie-server-integ-tests-router</module>
    <module>kie-server-integ-tests-case-id-generator</module>
    <module>kie-server-integ-tests-dmn</module>
    <module>kie-server-integ-tests-custom-extension</module>    
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-common</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-drools</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-jbpm</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-optaplanner</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-dmn</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-controller</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-policy</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-router</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-case-id-generator</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-all</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-jbpm-search</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-custom-extension-rest</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-custom-extension-services</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-integ-tests-custom-extension-client</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-core-uberjar</artifactId>
        <version>${version.org.codehaus.cargo}</version>
      </dependency>
      <dependency>
        <groupId>org.kie</groupId>
        <artifactId>kie-tomcat-integration</artifactId>
        <version>${version.org.kie}</version>
      </dependency>
      <dependency>
        <groupId>org.kie.server</groupId>
        <artifactId>kie-server-test-web-service</artifactId>
        <version>${version.org.kie}</version>
        <type>war</type>
      </dependency>
      <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${version.org.postgresql}</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-enforcer-plugin</artifactId>
          <executions>
            <execution>
              <id>ban-duplicated-classes</id>
              <goals>
                <goal>enforce</goal>
              </goals>
              <configuration>
                <rules>
                  <banDuplicateClasses>
                    <dependencies>
                      <!-- kie-server-router-proxy is an uberjar as it seems to be expected to work like that. -->
                      <dependency>
                        <groupId>org.kie.server</groupId>
                        <artifactId>kie-server-router-proxy</artifactId>
                        <ignoreClasses>
                          <ignoreClass>*</ignoreClass>
                        </ignoreClasses>
                      </dependency>
                    </dependencies>
                  </banDuplicateClasses>
                </rules>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>cargo-maven2-plugin</artifactId>
          <configuration>
            <container>
              <containerId>${cargo.container.id}</containerId>
              <systemProperties>
                <kie.maven.settings.custom>${kie.server.server.deployment.settings.xml}</kie.maven.settings.custom>
                <!-- Fixes issue when Tomcat hangs during deployment due to insufficient amount of entropy.
                     The property specifies less secure source of entropy, which is fine for testing.
                     See https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source for more info -->
                <java.security.egd>file:/dev/./urandom</java.security.egd>
                <org.jbpm.document.storage>${org.jbpm.document.storage}</org.jbpm.document.storage>
                <kie.server.base.http.url>${kie.server.base.http.url}</kie.server.base.http.url>
                <!-- Persistence configuration -->
                <org.kie.server.persistence.ds>${org.kie.server.persistence.ds}</org.kie.server.persistence.ds>
                <org.kie.server.persistence.dialect>${org.kie.server.persistence.dialect}</org.kie.server.persistence.dialect>
                <org.kie.server.mode>${org.kie.server.mode.production}</org.kie.server.mode>
              </systemProperties>
            </container>
            <deployables>
              <deployable>
                <groupId>${project.groupId}</groupId>
                <artifactId>kie-server</artifactId>
                <!-- 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>
            </deployables>
            <configuration>
              <users>
                <!-- kie-server role for REST tests; guest for JMS tests -->
                <user>
                  <name>yoda</name>
                  <password>usetheforce123@</password>
                  <roles>
                    <role>kie-server</role>
                    <role>guest</role>
                  </roles>
                </user>
                <user>
                  <name>Administrator</name>
                  <password>usetheforce123@</password>
                  <roles>
                    <role>kie-server</role>
                    <role>guest</role>
                    <role>Administrators</role>
                  </roles>
                </user>
                <user>
                  <name>john</name>
                  <password>usetheforce123@</password>
                  <roles>
                    <role>kie-server</role>
                    <role>guest</role>
                    <role>engineering</role>
                    <role>HR</role>
                    <role>IT</role>
                    <role>Accounting</role>
                  </roles>
                </user>
                <user>
                  <name>mary</name>
                  <password>usetheforce123@</password>
                  <roles>
                    <role>kie-server</role>
                    <role>guest</role>
                    <role>engineering</role>
                    <role>HR</role>
                    <role>IT</role>
                    <role>Accounting</role>
                  </roles>
                </user>
              </users>
              <properties>
                <cargo.servlet.port>${container.port}</cargo.servlet.port>
              </properties>
            </configuration>
          </configuration>
          <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>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>integration-test</goal>
                <goal>verify</goal>
              </goals>
              <configuration>
                <excludedGroups>${failsafe.excluded.groups}</excludedGroups>
                <additionalClasspathElements combine.children="append">
                  <additionalClasspathElement>${maven.jdbc.driver.jar}</additionalClasspathElement>
                </additionalClasspathElements>
                <systemPropertyVariables>
                  <kie.server.server.deployment.settings.xml>${kie.server.server.deployment.settings.xml}</kie.server.server.deployment.settings.xml>
                  <jms.skip>${jms.skip}</jms.skip>
                  <kie.server.testing.server.local.repo.dir>${kie.server.testing.server.local.repo.dir}</kie.server.testing.server.local.repo.dir>
                  <kie.server.testing.remote.repo.dir>${kie.server.testing.remote.repo.dir}</kie.server.testing.remote.repo.dir>
                </systemPropertyVariables>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>set-properties-for-dependencies</id>
            <phase>initialize</phase>
            <goals>
              <goal>properties</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>reserve-network-port</id>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <portNames>
                <portName>container.port</portName>
              </portNames>
            </configuration>
          </execution>
          <execution>
            <id>reserve-network-port-router</id>
            <goals>
              <goal>reserve-network-port</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <portNames>
                <portName>router.port</portName>
              </portNames>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>create-custom-maven-repo-dir</id>
            <phase>pre-integration-test</phase>
            <configuration>
              <target>
                <mkdir dir="${kie.server.testing.server.local.repo.dir}"/>
                <mkdir dir="${kie.server.testing.remote.repo.dir}"/>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>mysql</id>
      <properties>
        <org.kie.server.persistence.dialect>org.hibernate.dialect.MySQL5InnoDBDialect</org.kie.server.persistence.dialect>
        <org.kie.server.datasource.driver.class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</org.kie.server.datasource.driver.class>
        <!-- Connection URL, format example: jdbc:mysql://localhost:3306/mydb -->
        <org.kie.server.datasource.connection.url>specify-mysql-connection-url-in-org.kie.server.datasource.connection.url</org.kie.server.datasource.connection.url>
        <springboot.jdbc.driver.jar>${mysql:mysql-connector-java:jar}</springboot.jdbc.driver.jar>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <dependencies combine.children="append">
                    <dependency>
                      <groupId>mysql</groupId>
                      <artifactId>mysql-connector-java</artifactId>
                    </dependency>
                  </dependencies>
                </container>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>postgresql</id>
      <properties>
        <org.kie.server.persistence.dialect>org.hibernate.dialect.PostgreSQL82Dialect</org.kie.server.persistence.dialect>
        <org.kie.server.datasource.driver.class>org.postgresql.xa.PGXADataSource</org.kie.server.datasource.driver.class>
        <!-- Connection URL, format example: jdbc:postgresql://localhost:5432/mydb -->
        <org.kie.server.datasource.connection.url>specify-postgresql-connection-url-in-org.kie.server.datasource.connection.url</org.kie.server.datasource.connection.url>
        <springboot.jdbc.driver.jar>${org.postgresql:postgresql:jar}</springboot.jdbc.driver.jar>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <dependencies combine.children="append">
                    <dependency>
                      <groupId>org.postgresql</groupId>
                      <artifactId>postgresql</artifactId>
                    </dependency>
                  </dependencies>
                </container>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <dependency>
          <groupId>org.postgresql</groupId>
          <artifactId>postgresql</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>oracle</id>
      <properties>
        <org.kie.server.persistence.dialect>org.hibernate.dialect.Oracle12cDialect</org.kie.server.persistence.dialect>
        <org.kie.server.datasource.driver.class>oracle.jdbc.xa.client.OracleXADataSource</org.kie.server.datasource.driver.class>
        <!-- Connection URL, format example: jdbc:oracle:thin:@localhost:1521:mydb  -->
        <org.kie.server.datasource.connection.url>specify-oracle-connection-url-in-org.kie.server.datasource.connection.url</org.kie.server.datasource.connection.url>
        <org.kie.server.datasource.driver.path>specify-oracle-driver-path-in-org.kie.server.datasource.driver.path</org.kie.server.datasource.driver.path>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <dependencies combine.children="append">
                    <dependency>
                      <location>${org.kie.server.datasource.driver.path}</location>
                    </dependency>
                  </dependencies>
                </container>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>cargo-debug-container</id>
      <activation>
        <property>
          <name>debug</name>
        </property>
      </activation>
      <properties>
        <!-- Default debug port is 8787. -->
        <debug.port>8787</debug.port>
        <container.suspend>y</container.suspend>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <configuration>
                  <properties>
                    <cargo.start.jvmargs>
                      -Xdebug
                      -Xrunjdwp:transport=dt_socket,server=y,suspend=${container.suspend},address=${debug.port}
                      -Xnoagent
                    </cargo.start.jvmargs>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <id>tomcat9</id>
      <properties>
        <org.kie.server.persistence.ds>java:comp/env/jbpmDs</org.kie.server.persistence.ds>
        <kie.server.classifier>webc</kie.server.classifier>
        <kie.server.war.path>${org.kie.server:kie-server:war:webc}</kie.server.war.path>
        <cargo.container.id>tomcat9x</cargo.container.id>
        <failsafe.excluded.groups>org.kie.server.integrationtests.category.JEEOnly,org.kie.server.integrationtests.category.JMSOnly,org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.RemotelyControlled</failsafe.excluded.groups>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <artifactInstaller>
                    <groupId>org.apache.tomcat</groupId>
                    <artifactId>tomcat</artifactId>
                    <version>${version.tomcat9}</version>
                  </artifactInstaller>
                  <systemProperties>
                    <tomcat.home>${project.build.directory}/cargo/configurations/tomcat9x</tomcat.home>
                    <conf.directory>${project.build.testOutputDirectory}</conf.directory>
                    <tmp.directory>${project.build.directory}</tmp.directory>
                    <jbpm.tsr.jndi.lookup>java:comp/env/TransactionSynchronizationRegistry</jbpm.tsr.jndi.lookup>
                    <jbpm.tm.jndi.lookup>java:comp/env/TransactionManager</jbpm.tm.jndi.lookup>
                    <org.kie.server.persistence.tm>JBossTS</org.kie.server.persistence.tm>
                    <org.jboss.logging.provider>jdk</org.jboss.logging.provider>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                    <hibernate.connection.handling_mode>DELAYED_ACQUISITION_AND_RELEASE_AFTER_TRANSACTION</hibernate.connection.handling_mode>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.slf4j</groupId>
                      <artifactId>slf4j-api</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.security.jacc</groupId>
                      <artifactId>jboss-jacc-api_1.5_spec</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.kie</groupId>
                      <artifactId>kie-tomcat-integration</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.transaction</groupId>
                      <artifactId>jboss-transaction-api_1.2_spec</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.integration</groupId>
                      <artifactId>narayana-tomcat</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.narayana.jta</groupId>
                      <artifactId>narayana-jta</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss</groupId>
                      <artifactId>jboss-transaction-spi</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.logging</groupId>
                      <artifactId>jboss-logging</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <properties>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                    <cargo.tomcat.valve.jaas>
                      className=org.kie.integration.tomcat.JACCValve
                    </cargo.tomcat.valve.jaas>
                    <cargo.tomcat.valve.sso>
                      className=org.apache.catalina.authenticator.SingleSignOn
                    </cargo.tomcat.valve.sso>
                  </properties>
                  <resources>
                    <resource>
                      <name>sharedDataSource</name>
                      <type>org.h2.jdbcx.JdbcDataSource</type>
                      <parameters>
                        <user>sa</user>
                        <password>sa</password>
                        <url>jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;MVCC=TRUE</url>
                        <description>H2 Data Source</description>
                        <loginTimeout>0</loginTimeout>
                        <testOnBorrow>false</testOnBorrow>
                        <factory>org.h2.jdbcx.JdbcDataSourceFactory</factory>
                      </parameters>
                    </resource>
                    <resource>
                      <name>jbpmDs</name>
                      <type>javax.sql.XADataSource</type>
                      <parameters>
                        <uniqueName>jbpmDs</uniqueName>
                        <factory>org.jboss.narayana.tomcat.jta.TransactionalDataSourceFactory</factory>
                        <transactionSynchronizationRegistry>TransactionSynchronizationRegistry</transactionSynchronizationRegistry>
                        <username>sa</username>
                        <password>sa</password>
                        <transactionManager>TransactionManager</transactionManager>
                        <xaDataSource>sharedDataSource</xaDataSource>
                        <initialSize>10</initialSize>
                        <testOnBorrow>true</testOnBorrow>
                        <maxAge>30000</maxAge>
                        <description>Transactional Driver Data Source</description>
                        <removeAbandoned>true</removeAbandoned>
                        <remoteAbandonedTimeout>60</remoteAbandonedTimeout>
                        <logAbandoned>true</logAbandoned>
                      </parameters>
                    </resource>
                  </resources>
                </configuration>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <!-- Deps needed by Tomcat 9 -->
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.spec.javax.transaction</groupId>
          <artifactId>jboss-transaction-api_1.2_spec</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.spec.javax.security.jacc</groupId>
          <artifactId>jboss-jacc-api_1.5_spec</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-tomcat-integration</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.integration</groupId>
          <artifactId>narayana-tomcat</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.narayana.jta</groupId>
          <artifactId>narayana-jta</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss</groupId>
          <artifactId>jboss-transaction-spi</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.jboss.logging</groupId>
          <artifactId>jboss-logging</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>    
    <profile>
      <id>wildfly</id>
      <properties>        
        <kie.server.remoting.url>http-remoting://${container.hostname}:${container.port}</kie.server.remoting.url>
        <kie.server.context.factory>org.wildfly.naming.client.WildFlyInitialContextFactory</kie.server.context.factory>
        <org.kie.server.persistence.ds>java:/jdbc/jbpm</org.kie.server.persistence.ds>
        <cargo.container.id>wildfly14x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <artifactInstaller>
                    <groupId>org.wildfly</groupId>
                    <artifactId>wildfly-dist</artifactId>
                    <version>${version.org.wildfly}</version>
                  </artifactInstaller>
                  <systemProperties>
                    <!-- disable JMS support for executor to use same tests for all containers for jbpm executor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                    <org.kie.mail.session>java:/mail/Session</org.kie.mail.session>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <properties>
                    <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                    <cargo.resource.resource.mail>
                       cargo.resource.name=mail/Session|
                       cargo.resource.type=javax.mail.Session|
                       cargo.resource.id=mail|
                       cargo.resource.parameters=mail.smtp.host=localhost;mail.smtp.port=2525;mail.smtp.from=kie-server-test@domain.com
                    </cargo.resource.resource.mail>
                  </properties>
                  <datasources>
                    <datasource>
                      <jndiName>${org.kie.server.persistence.ds}</jndiName>
                      <driverClass>${org.kie.server.datasource.driver.class}</driverClass>
                      <url>${org.kie.server.datasource.connection.url}</url>
                      <username>${org.kie.server.datasource.username}</username>
                      <password>${org.kie.server.datasource.password}</password>
                      <transactionSupport>XA_TRANSACTION</transactionSupport>
                    </datasource>
                  </datasources>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <systemPropertyVariables>
                  <!-- Reuse yoda user for deploying and undeploying Kie server from within the test -->
                  <cargo.remote.username>yoda</cargo.remote.username>
                  <cargo.remote.password>usetheforce123@</cargo.remote.password>
                </systemPropertyVariables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
        <dependencies>
          <!-- This is far from ideal, as it is not designed as BOM. However, 
            there is nothing like wildfly-bom, so this is the closest thing I could find. 
            Important: this overrides lots of the versions coming from kie-p-w-d -->
          <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-parent</artifactId>
            <version>${version.org.wildfly}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-jms-client-bom</artifactId>
          <type>pom</type>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>eap7</id>
      <properties>
        <kie.server.remoting.url>http-remoting://${container.hostname}:${container.port}</kie.server.remoting.url>
        <org.kie.server.persistence.ds>java:jboss/datasources/ExampleDS</org.kie.server.persistence.ds>
        <!-- eap7 is basically wildfly14; until there is a EAP 7 specific containerId, 'wildfly14x' should work just fine -->
        <cargo.container.id>wildfly14x</cargo.container.id>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <zipUrlInstaller>
                    <url>${eap7.download.url}</url>
                  </zipUrlInstaller>
                  <systemProperties>
                    <!-- disable JMS support for executor to use same tests for all containers for jbpm executor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                    <org.kie.mail.session>java:/mail/Session</org.kie.mail.session>
                  </systemProperties>
                </container>
                <configuration>
                  <properties>
                    <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                    <cargo.jvmargs>-Xmx1024m</cargo.jvmargs>
                    <cargo.resource.resource.mail>
                       cargo.resource.name=mail/Session|
                       cargo.resource.type=javax.mail.Session|
                       cargo.resource.id=mail|
                       cargo.resource.parameters=mail.smtp.host=localhost;mail.smtp.port=2525;mail.smtp.from=kie-server-test@domain.com
                    </cargo.resource.resource.mail>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <systemPropertyVariables>
                  <!-- Reuse yoda user for deploying and undeploying Kie server from within the test -->
                  <cargo.remote.username>yoda</cargo.remote.username>
                  <cargo.remote.password>usetheforce123@</cargo.remote.password>
                </systemPropertyVariables>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
       <dependencies>
          <!-- This is far from ideal, as it is not designed as BOM. However, 
            there is nothing like wildfly-bom, so this is the closest thing I could find. 
            Important: this overrides lots of the versions coming from kie-p-w-d -->
          <dependency>
            <groupId>org.wildfly</groupId>
            <artifactId>wildfly-parent</artifactId>
            <version>${version.org.wildfly}</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.wildfly</groupId>
          <artifactId>wildfly-jms-client-bom</artifactId>
          <type>pom</type>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>oracle-wls-12</id>
      <properties>
        <kie.server.remoting.url>t3://${container.hostname}:${container.port}</kie.server.remoting.url>
        <kie.server.context.factory>weblogic.jndi.WLInitialContextFactory</kie.server.context.factory>
        <kie.server.jndi.request.queue>jms/KIE.SERVER.REQUEST</kie.server.jndi.request.queue>
        <kie.server.jndi.response.queue>jms/KIE.SERVER.RESPONSE</kie.server.jndi.response.queue>
        <kie.server.connection.factory>jms/cf/KIE.SERVER.REQUEST</kie.server.connection.factory>
        <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
        <cargo.container.id>weblogic122x</cargo.container.id>
        <failsafe.excluded.groups>org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.Transactional</failsafe.excluded.groups>
        <kie.server.classifier>ee7</kie.server.classifier>
        <kie.server.war.path>${org.kie.server:kie-server:war:ee7}</kie.server.war.path>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <home>${weblogic.home}/wlserver</home>
                  <systemProperties>
                    <org.kie.server.persistence.tm>Weblogic</org.kie.server.persistence.tm>
                    <org.kie.server.domain>OracleDefaultLoginConfiguration</org.kie.server.domain>
                    <org.kie.executor.jms.cf>jms/cf/KIE.SERVER.EXECUTOR</org.kie.executor.jms.cf>
                    <org.kie.executor.jms.queue>jms/KIE.SERVER.EXECUTOR</org.kie.executor.jms.queue>
                    <org.kie.server.controller.connect>50000</org.kie.server.controller.connect>
                    <!-- disable JMS support for executor touse same tests for all containers for jbpm excutor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>false</org.kie.server.sync.deploy>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>xerces</groupId>
                      <artifactId>xercesImpl</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <type>standalone</type>
                  <properties>
                    <cargo.jvmargs>-Xmx1024m -Dkie.server.jms.queues.response=jms/KIE.SERVER.RESPONSE</cargo.jvmargs>
                    <!-- CFs -->
                    <cargo.resource.resource.jms.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.cf.request>
                    <cargo.resource.resource.jms.cf.response>
                      cargo.resource.name=jms/cf/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.cf.response>
                    <cargo.resource.resource.jms.executor.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.cf.request>
                    <!-- Qs -->
                    <cargo.resource.resource.jms.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.queue.request>
                    <cargo.resource.resource.jms.queue.response>
                      cargo.resource.name=jms/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.queue.response>
                    <cargo.resource.resource.jms.executor.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.queue.request>
                    <!-- Datasource -->
                    <cargo.datasource.datasource.h2>
                      cargo.datasource.driver=org.h2.Driver|
                      cargo.datasource.url=jdbc:h2:mem:test-db|
                      cargo.datasource.jndi=jdbc/jbpm|
                      cargo.datasource.username=sa|
                      cargo.datasource.password=|
                      cargo.datasource.transactionsupport=XA_TRANSACTION
                    </cargo.datasource.datasource.h2>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <additionalClasspathElements>
                  <additionalClasspathElement>${weblogic.home}/wlserver/server/lib/wljmsclient.jar</additionalClasspathElement>
                </additionalClasspathElements>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>xerces</groupId>
          <artifactId>xercesImpl</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>websphere9</id>
      <properties>
        <container.port>9080</container.port>
        <kie.server.remoting.url>iiop://${container.hostname}:2809</kie.server.remoting.url>
        <kie.server.context.factory>com.ibm.websphere.naming.WsnInitialContextFactory</kie.server.context.factory>
        <kie.server.jndi.request.queue>jms/KIE.SERVER.REQUEST</kie.server.jndi.request.queue>
        <kie.server.jndi.response.queue>jms/KIE.SERVER.RESPONSE</kie.server.jndi.response.queue>
        <kie.server.connection.factory>jms/cf/KIE.SERVER.REQUEST</kie.server.connection.factory>
        <org.kie.server.persistence.ds>jdbc/jbpm</org.kie.server.persistence.ds>
        <kie.server.classifier>ee7</kie.server.classifier>
        <cargo.container.id>websphere85x</cargo.container.id>
        <failsafe.excluded.groups>org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.RemotelyControlled,org.kie.server.integrationtests.category.Transactional</failsafe.excluded.groups>
        <kie.server.war.path>${org.kie.server:kie-server:war:ee7}</kie.server.war.path>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <type>installed</type>
                  <home>${websphere.home}</home>
                  <timeout>240000</timeout>
                  <systemProperties>
                    <org.kie.server.persistence.tm>WebSphere</org.kie.server.persistence.tm>
                    <org.kie.server.domain>WSLogin</org.kie.server.domain>
                    <org.kie.executor.jms.cf>jms/cf/KIE.SERVER.EXECUTOR</org.kie.executor.jms.cf>
                    <org.kie.executor.jms.queue>jms/KIE.SERVER.EXECUTOR</org.kie.executor.jms.queue>
                    <kie.server.jms.queues.response>jms/KIE.SERVER.RESPONSE</kie.server.jms.queues.response>
                    <!-- disable JMS support for executor to use same tests for all containers for jbpm excutor -->
                    <org.kie.executor.jms>false</org.kie.executor.jms>
                    <org.kie.server.sync.deploy>true</org.kie.server.sync.deploy>
                    <!-- Disable CDI to speed up Kie server startup -->
                    <com.ibm.ws.cdi.enableImplicitBeanArchives>false</com.ibm.ws.cdi.enableImplicitBeanArchives>
                    <com.ibm.ws.cdi.enableCDI>false</com.ibm.ws.cdi.enableCDI>
                    <!-- Needed by WebSphere to trust JBoss Nexus -->
                    <javax.net.ssl.trustStore>${java.home}/lib/security/cacerts</javax.net.ssl.trustStore>
                    <javax.net.ssl.trustStorePassword>changeit</javax.net.ssl.trustStorePassword>
                    <javax.net.ssl.trustStoreType>JKS</javax.net.ssl.trustStoreType>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <type>standalone</type>
                  <properties>
                    <cargo.websphere.profile>${project.artifactId}</cargo.websphere.profile>
                    <cargo.jvmargs>-Xms1g -Xmx2g</cargo.jvmargs>
                    <cargo.websphere.classloader.mode>PARENT_LAST</cargo.websphere.classloader.mode>
                    <cargo.websphere.war.classloader.policy>SINGLE</cargo.websphere.war.classloader.policy>
                    <!-- CFs -->
                    <cargo.resource.resource.jms.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.cf.request>
                    <cargo.resource.resource.jms.cf.response>
                      cargo.resource.name=jms/cf/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.cf.response>
                    <cargo.resource.resource.jms.executor.cf.request>
                      cargo.resource.name=jms/cf/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.ConnectionFactory|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.cf.request>
                    <!-- Qs -->
                    <cargo.resource.resource.jms.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.REQUEST|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.REQUEST
                    </cargo.resource.resource.jms.queue.request>
                    <cargo.resource.resource.jms.queue.response>
                      cargo.resource.name=jms/KIE.SERVER.RESPONSE|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.RESPONSE
                    </cargo.resource.resource.jms.queue.response>
                    <cargo.resource.resource.jms.executor.queue.request>
                      cargo.resource.name=jms/KIE.SERVER.EXECUTOR|
                      cargo.resource.type=javax.jms.Queue|
                      cargo.resource.id=KIE.SERVER.EXECUTOR
                    </cargo.resource.resource.jms.executor.queue.request>
                    <!-- Datasource -->
                    <cargo.datasource.datasource.h2>
                      cargo.datasource.driver=org.h2.jdbcx.JdbcDataSource|
                      cargo.datasource.url=jdbc:h2:mem:test-db|
                      cargo.datasource.jndi=jdbc/jbpm|
                      cargo.datasource.username=sa|
                      cargo.datasource.password=|
                      cargo.datasource.transactionsupport=XA_TRANSACTION
                    </cargo.datasource.datasource.h2>
                    <!-- Binding -->
                    <cargo.websphere.ejb.act.binding>
                      kie-server-services:KieServerMDB:jms/KIE.SERVER.REQUEST|
                      kie-server-services:KieExecutorMDB:jms/KIE.SERVER.EXECUTOR
                    </cargo.websphere.ejb.act.binding>
                    <cargo.websphere.ejb.res.binding>
                      kie-server-services:KieServerMDB:org.kie.server.jms.KieServerMDB/factory:jms/cf/KIE.SERVER.REQUEST
                    </cargo.websphere.ejb.res.binding>
                  </properties>
                </configuration>
              </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <additionalClasspathElements>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.ejb.thinclient_9.0.jar</additionalClasspathElement>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.sib.client.thin.jms_9.0.jar</additionalClasspathElement>
                  <additionalClasspathElement>${websphere.home}/runtimes/com.ibm.ws.orb_9.0.jar</additionalClasspathElement>
                </additionalClasspathElements>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
      <dependencyManagement>
        <dependencies>
          <!-- Need to raise H2 version because of bug in H2 usage for WAS. -->
          <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
            <version>1.3.176</version>
          </dependency>
        </dependencies>
      </dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>com.h2database</groupId>
          <artifactId>h2</artifactId>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>springboot</id>
      <properties>
        <!-- By default disable everything, enable what is needed in child POMs-->
        <kieserver.drools.enabled>false</kieserver.drools.enabled>
        <kieserver.dmn.enabled>false</kieserver.dmn.enabled>
        <kieserver.jbpm.enabled>false</kieserver.jbpm.enabled>
        <kieserver.jbpmui.enabled>false</kieserver.jbpmui.enabled>
        <kieserver.casemgmt.enabled>false</kieserver.casemgmt.enabled>
        <kieserver.optaplanner.enabled>false</kieserver.optaplanner.enabled>
        <kieserver.swagger.enabled>false</kieserver.swagger.enabled>
        <jbpm.executor.enabled>false</jbpm.executor.enabled>
        <kieserver.prometheus.enabled>false</kieserver.prometheus.enabled>
        <!-- Springboot GAV -->
        <springboot.app.group.id>org.kie</springboot.app.group.id>
        <springboot.app.artifact.id>kie-server-spring-boot-integ-tests-sample</springboot.app.artifact.id>
        <springboot.app.version>${project.version}</springboot.app.version>
        <springboot.app.jar.name>${springboot.app.artifact.id}-${springboot.app.version}.jar</springboot.app.jar.name>
        <!-- Dummy data source for QueryDataServiceIntegrationTest, they expect it to be set -->
        <org.kie.server.persistence.ds>dummyDataSource</org.kie.server.persistence.ds>
        <!-- Same groups as for Tomcat -->
        <failsafe.excluded.groups>org.kie.server.integrationtests.category.JEEOnly,org.kie.server.integrationtests.category.JMSOnly,org.kie.server.integrationtests.category.Email,org.kie.server.integrationtests.category.RemotelyControlled</failsafe.excluded.groups>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <executions>
                <execution>
                  <id>unpack-spring-boot-integ-tests-sample</id>
                  <phase>process-resources</phase>
                  <goals>
                    <goal>copy</goal>
                  </goals>
                  <configuration>
                    <artifactItems>
                      <artifactItem>
                        <groupId>${springboot.app.group.id}</groupId>
                        <artifactId>${springboot.app.artifact.id}</artifactId>
                        <version>${springboot.app.version}</version>
                        <type>jar</type>
                        <outputDirectory>${project.build.directory}</outputDirectory>
                      </artifactItem>
                    </artifactItems>
                    <!-- Always produce the -SNAPSHOT suffix instead of a timestamp -->
                    <useBaseVersion>true</useBaseVersion>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <!-- Turn off cargo completely as we don't need it -->
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <skip>true</skip>
              </configuration>
            </plugin>
            <plugin>
              <groupId>com.bazaarvoice.maven.plugins</groupId>
              <artifactId>process-exec-maven-plugin</artifactId>
              <version>0.7</version>
              <executions>
                <execution>
                  <id>start-springboot</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                    <goal>start</goal>
                  </goals>
                  <configuration>
                    <name>SpringBoot</name>
                    <waitForInterrupt>false</waitForInterrupt>
                    <healthcheckUrl>${kie.server.base.http.url}/readycheck</healthcheckUrl>
                    <waitAfterLaunch>300</waitAfterLaunch>
                    <processLogFile>${project.build.directory}/springboot.log</processLogFile>
                    <arguments>
                      <argument>java</argument>
                      <argument>-cp</argument>
                      <argument>${springboot.app.jar.name}:${springboot.jdbc.driver.jar}</argument>
                      <argument>-Dspring.config.location=${project.build.testOutputDirectory}/application.properties</argument>
                      <argument>-Dkie.maven.settings.custom=${kie.server.server.deployment.settings.xml}</argument>
                      <argument>-Dorg.kie.server.persistence.ds=${org.kie.server.persistence.ds}</argument>
                      <argument>-Dorg.jbpm.document.storage=${org.jbpm.document.storage}</argument>
                      <argument>-Dkie.server.base.http.url=${kie.server.base.http.url}</argument>
                      <argument>-Dorg.kie.server.mode=${org.kie.server.mode.production}</argument>
                      <argument>org.springframework.boot.loader.JarLauncher</argument>
                    </arguments>
                  </configuration>
                </execution>
                <!-- Stop all processes in reverse order, in this case only SpringBoot process -->
                <execution>
                  <id>stop-springboot</id>
                  <phase>post-integration-test</phase>
                  <goals>
                    <goal>stop-all</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <!-- This profile basically disables any cargo related execution. It can be used when the tests should run on
         a container that has already been started and it is not managed by cargo. It can also be used when doing
         a "no-test" build, as the container should not be used in that case. -->
    <profile>
      <id>custom-container</id>
      <activation>
        <!-- The tests are not executed unless specific container profile is used. Disable cargo by default. -->
        <activeByDefault>true</activeByDefault>
        <property>
          <name>custom-container</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <executions>
              <execution>
                <id>start-container</id>
                <phase>none</phase>
                <goals/>
                <!-- do nothing, container is not managed by cargo -->
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>none</phase>
                <goals/>
                <!-- do nothing, container is not managed by cargo -->
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Run just smoke tests to check basic functionality. -->
      <id>smoke</id>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <groups>org.kie.server.integrationtests.category.Smoke</groups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!-- Skip unstable tests on Jenkins PR builder. -->
      <id>jenkins-pr-builder</id>
      <activation>
        <property>
          <name>ghprbGhRepository</name>
        </property>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <excludedGroups>org.kie.server.integrationtests.category.UnstableOnJenkinsPrBuilder</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!-- Integration tests are skipped by default. They are activated when specific container profile is used. -->
      <id>skipITs-by-default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <skipITs>true</skipITs>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
    <profile>
      <!-- Full downstream build disables active profiles because of ghprbGhRepository property, which means Cargo would stay enabled.
           This profile disables Cargo when full downstream build is run (its invocation contains -DskipTests property). -->
      <id>skipCargoInFDB</id>
      <activation>
        <property>
          <name>skipTests</name>
        </property>
      </activation>
      <properties>
        <cargo.maven.skip>true</cargo.maven.skip>
      </properties>
    </profile>
  </profiles>
</project>
