<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-integ-tests-custom-extension</artifactId>
    <version>7.28.0.Final</version>
  </parent>

  <artifactId>kie-server-integ-tests-custom-extension-test</artifactId>

  <name>KIE :: Execution Server :: Tests :: Custom extension :: 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.custom.extension.test</java.module.name>
    <org.drools.server.ext.disabled>false</org.drools.server.ext.disabled>
    <org.kie.prometheus.server.ext.disabled>false</org.kie.prometheus.server.ext.disabled>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-common</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-custom-extension-rest</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-custom-extension-services</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-custom-extension-prometheus</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.server</groupId>
      <artifactId>kie-server-integ-tests-custom-extension-client</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>

    <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>
  </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>
                <target>
                  <unzip src="${maven.dependency.org.kie.server.kie-server.ee7.war.path}" dest="${project.build.directory}/unzipped-kie-server"/>
                  <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-services.jar.path}" todir="${project.build.directory}/unzipped-kie-server/WEB-INF/lib"/>
                  <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-prometheus.jar.path}" todir="${project.build.directory}/unzipped-kie-server/WEB-INF/lib"/>
                  <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-rest.jar.path}" 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 -->
              <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>true</org.jbpm.server.ext.disabled>
              <org.drools.server.ext.disabled>${org.drools.server.ext.disabled}</org.drools.server.ext.disabled>
              <org.optaplanner.server.ext.disabled>true</org.optaplanner.server.ext.disabled>
              <org.kie.prometheus.server.ext.disabled>${org.kie.prometheus.server.ext.disabled}</org.kie.prometheus.server.ext.disabled>
              <kie.server.testing.kjars.build.settings.xml>${kie.server.testing.kjars.build.settings.xml}</kie.server.testing.kjars.build.settings.xml>
            </systemPropertyVariables>
          </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>
    </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.jbpm.server.ext.disabled>true</org.jbpm.server.ext.disabled>
              <org.drools.server.ext.disabled>${org.drools.server.ext.disabled}</org.drools.server.ext.disabled>
              <org.optaplanner.server.ext.disabled>true</org.optaplanner.server.ext.disabled>
              <org.kie.prometheus.server.ext.disabled>${org.kie.prometheus.server.ext.disabled}</org.kie.prometheus.server.ext.disabled>
            </systemProperties>
          </container>
          <deployables>
            <deployable>
              <location>${project.build.directory}/kie-server.war</location>
            </deployable>
          </deployables>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>tomcat9</id>
      <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>
                    <target>
                      <unzip src="${maven.dependency.org.kie.server.kie-server.webc.war.path}" dest="${project.build.directory}/unzipped-kie-server"/>
                      <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-services.jar.path}" todir="${project.build.directory}/unzipped-kie-server/WEB-INF/lib"/>
                      <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-prometheus.jar.path}" todir="${project.build.directory}/unzipped-kie-server/WEB-INF/lib"/>
                      <copy file="${maven.dependency.org.kie.server.kie-server-integ-tests-custom-extension-rest.jar.path}" 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>
          </plugins>
        </pluginManagement>
      </build>
    </profile>
  </profiles>
</project>
