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

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

  <name>KIE :: Execution Server :: Tests :: Policies 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.policy</java.module.name>
    <org.drools.server.ext.disabled>false</org.drools.server.ext.disabled>
    <org.jbpm.server.ext.disabled>false</org.jbpm.server.ext.disabled>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-common</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>javax.activation</groupId>
          <artifactId>activation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    
    <!-- core deps -->
    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>drools-compiler</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-ci</artifactId>
      <scope>test</scope>
    </dependency>
    
    <!-- kie server deps -->
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-api</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>javax.activation</groupId>
          <artifactId>activation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

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

    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-case-mgmt-impl</artifactId>
      <scope>test</scope>
    </dependency>

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

    <!-- REST --> 
    <dependency>
      <groupId>org.jboss.spec.javax.servlet</groupId>
      <artifactId>jboss-servlet-api_3.1_spec</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>tjws</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

   <!--  Stay with httpcomponents: it will save us pain (as opposed to changing from resteasy to cxf to cxf 3.0, etc. --> 
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpcore</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>fluent-hc</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <!-- Replacement for the above excluded 'commons-logging:commons-logging' -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- persistence --> 
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>xml-apis</groupId>
          <artifactId>xml-apis</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.narayana.jta</groupId>
      <artifactId>narayana-jta</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-test-util</artifactId>
      <scope>test</scope>
    </dependency>
    
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-embedder</artifactId>
      <scope>test</scope>
    </dependency>

    <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>

    <!-- 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-controller</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>*</groupId>
          <artifactId>*</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-failsafe-plugin</artifactId>
          <configuration>
            <systemPropertyVariables>
              <!-- Values are supplied by specific profiles -->
              <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>
              <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>${org.drools.server.ext.disabled}</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>
              <org.jbpm.document.storage>${org.jbpm.document.storage}</org.jbpm.document.storage>
              <!-- policy based configuration -->
              <org.kie.server.policy.activate>KeepLatestOnly</org.kie.server.policy.activate>
              <policy.klo.interval>5000</policy.klo.interval>
            </systemPropertyVariables>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
        </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.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <configuration>
          <container>
            <systemProperties>
              <org.jbpm.server.ext.disabled>${org.jbpm.server.ext.disabled}</org.jbpm.server.ext.disabled>
              <org.drools.server.ext.disabled>${org.drools.server.ext.disabled}</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>
              <!-- policy based configuration -->
              <org.kie.server.policy.activate>KeepLatestOnly</org.kie.server.policy.activate>
              <policy.klo.interval>5000</policy.klo.interval>
            </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>
              <groupId>javax.xml.stream</groupId>
              <artifactId>stax-api</artifactId>
            </exclusion>
            <exclusion>
              <groupId>javax.activation</groupId>
              <artifactId>activation</artifactId>
            </exclusion>
          </exclusions>
        </dependency>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-services-drools</artifactId>
          <scope>test</scope>
          <exclusions>
            <exclusion>
              <groupId>javax.activation</groupId>
              <artifactId>activation</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-drools</artifactId>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.kie.server</groupId>
          <artifactId>kie-server-rest-jbpm</artifactId>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
    <profile>
      <id>tomcat9</id>
    </profile>
    <profile>
      <id>wildfly</id>
    </profile>
    <profile>
      <id>eap7</id>
    </profile>
    <profile>
      <id>oracle-wls-12</id>
    </profile>
    <profile>
      <id>websphere9</id>
    </profile>
    <profile>
      <id>springboot</id>
      <properties>
        <kieserver.drools.enabled>true</kieserver.drools.enabled>
        <kieserver.jbpm.enabled>true</kieserver.jbpm.enabled>
        <org.kie.server.policy.activate>KeepLatestOnly</org.kie.server.policy.activate>
        <policy.klo.interval>5000</policy.klo.interval>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>com.bazaarvoice.maven.plugins</groupId>
              <artifactId>process-exec-maven-plugin</artifactId>
              <executions>
                <execution>
                  <id>start-springboot</id>
                  <configuration>
                    <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>
                      <!-- Policy based configuration -->
                      <argument>-Dorg.kie.server.policy.activate=${org.kie.server.policy.activate}</argument>
                      <argument>-Dpolicy.klo.interval=${policy.klo.interval}</argument>
                      <argument>org.springframework.boot.loader.JarLauncher</argument>
                    </arguments>
                  </configuration>
                </execution>
              </executions>
            </plugin>
          </plugins>
        </pluginManagement>
        <plugins>
          <plugin>
            <groupId>com.bazaarvoice.maven.plugins</groupId>
            <artifactId>process-exec-maven-plugin</artifactId>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
