<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</groupId>
    <artifactId>kie-wb-distributions</artifactId>
    <version>6.2.0.CR4</version>
  </parent>

  <groupId>org.kie.smoke</groupId>
  <artifactId>kie-wb-smoke-tests</artifactId>

  <name>KIE Workbench and KIE Drools Workbench Smoke Tests</name>
  <description>Integration smoke tests for KIE Workbench and KIE Drools Workbench</description>

  <properties>
    <version.tomcat7>7.0.55</version.tomcat7>
    <version.tomcat8>8.0.14</version.tomcat8>
    <version.jbossas7>7.1.1.Final</version.jbossas7>
    <version.wildfly8>8.1.0.Final</version.wildfly8>

    <!-- The default setup (if not overidden by specific profile) will execute kie-wb smoke tests on EAP 6.3.x -->
    <!-- These properties are overriden in profiles kie-drools-wb and kie-wb -->
    <deployable.groupId>org.kie</deployable.groupId>
    <deployable.artifactId>kie-wb-distribution-wars</deployable.artifactId>
    <deployable.version>${project.version}</deployable.version>
    <deployable.context>kie-wb</deployable.context>
    <container.host>localhost</container.host>
    <container.port>8080</container.port>
    <container.startstop.timeout.millis>120000</container.startstop.timeout.millis>
    <deployable.base.uri>http://${container.host}:${container.port}/${deployable.context}/</deployable.base.uri>
    <deployment.timeout.millis>120000</deployment.timeout.millis>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.guvnor</groupId>
      <artifactId>guvnor-rest-client</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-kie-services</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>kie-ci</artifactId>
          <groupId>org.kie</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.kie.remote</groupId>
      <artifactId>kie-remote-client</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.hornetq</groupId>
          <artifactId>hornetq-jms-client</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxb-provider</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jackson-provider</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>commons-net</groupId>
      <artifactId>commons-net</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>

    <!-- deps needed by Tomcat 7x and Tomcat 8x -->
    <dependency>
      <groupId>org.codehaus.btm</groupId>
      <artifactId>btm</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.codehaus.btm</groupId>
      <artifactId>btm-tomcat55-lifecycle</artifactId>
      <scope>test</scope>
    </dependency>
    <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.1_spec</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-tomcat-integration</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.spec.javax.security.jacc</groupId>
      <artifactId>jboss-jacc-api_1.4_spec</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>false</filtering>
      </testResource>
      <testResource>
        <directory>src/test/filtered-resources</directory>
        <filtering>true</filtering>
      </testResource>
    </testResources>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.cargo</groupId>
          <artifactId>cargo-maven2-plugin</artifactId>
          <configuration>
            <container>
              <timeout>${container.startstop.timeout.millis}</timeout>
            </container>
            <configuration>
              <properties>
                <cargo.jvmargs>-Xmx1g -XX:MaxPermSize=512m</cargo.jvmargs>
              </properties>
            </configuration>
            <deployables>
              <deployable>
                <properties>
                  <context>${deployable.context}</context>
                </properties>
                <pingURL>${deployable.base.uri}</pingURL>
                <pingTimeout>${deployment.timeout.millis}</pingTimeout>
              </deployable>
            </deployables>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <executions>
          <execution>
            <id>start-container</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
          <execution>
            <id>stop-container</id>
            <phase>post-integration-test</phase>
            <goals>
              <goal>stop</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- Common configuration for both kie-wb and kie-drools-wb and all supported containers -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <deployable.base.uri>${deployable.base.uri}</deployable.base.uri>
          </systemPropertyVariables>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>kie-drools-wb</id>
      <properties>
        <deployable.groupId>org.kie</deployable.groupId>
        <deployable.artifactId>kie-drools-wb-distribution-wars</deployable.artifactId>
        <deployable.context>kie-drools-wb</deployable.context>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-drools-wb-distribution-wars</artifactId>
          <classifier>eap6_3</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-drools-wb-distribution-wars</artifactId>
          <classifier>jboss-as7</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-drools-wb-distribution-wars</artifactId>
          <classifier>tomcat7</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-drools-wb-distribution-wars</artifactId>
          <classifier>wildfly8</classifier>
          <type>war</type>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <groups>org.kie.smoke.wb.category.KieDroolsWbSmoke</groups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>kie-wb</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <deployable.groupId>org.kie</deployable.groupId>
        <deployable.artifactId>kie-wb-distribution-wars</deployable.artifactId>
        <deployable.context>kie-wb</deployable.context>
      </properties>
      <dependencies>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-distribution-wars</artifactId>
          <classifier>eap6_3</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-distribution-wars</artifactId>
          <classifier>jboss-as7</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-distribution-wars</artifactId>
          <classifier>tomcat7</classifier>
          <type>war</type>
        </dependency>
        <dependency>
          <groupId>org.kie</groupId>
          <artifactId>kie-wb-distribution-wars</artifactId>
          <classifier>wildfly8</classifier>
          <type>war</type>
        </dependency>
      </dependencies>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <groups>org.kie.smoke.wb.category.KieWbSmoke</groups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>eap63x</id>
      <properties>
        <!-- The EAP 6.3.x binary can't be anonymously downloaded due to license issues. 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). -->
        <eap63x.download.url>valid-url-for-eap-6.3.x-needs-to-be-specified-here-or-via-cmd-line</eap63x.download.url>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>jboss74x</containerId>
                <type>installed</type>
                <zipUrlInstaller>
                  <url>${eap63x.download.url}</url>
                </zipUrlInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                </properties>
                <configfiles>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/eap-jbossas-wildfly-shared/config</file>
                    <todir>configuration</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/ssl/server</file>
                    <todir>configuration/ssl</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                </configfiles>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>${deployable.groupId}</groupId>
                  <artifactId>${deployable.artifactId}</artifactId>
                  <classifier>eap6_3</classifier>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>jbossas7x</id>
      <properties>
        <jbossas7x.download.url>http://download.jboss.org/jbossas/7.1/jboss-as-${version.jbossas7}/jboss-as-${version.jbossas7}.zip</jbossas7x.download.url>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>jboss71x</containerId>
                <type>installed</type>
                <zipUrlInstaller>
                  <url>${jbossas7x.download.url}</url>
                </zipUrlInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                </properties>
                <configfiles>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/eap-jbossas-wildfly-shared/config</file>
                    <todir>configuration</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/ssl/server</file>
                    <todir>configuration/ssl</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                </configfiles>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>${deployable.groupId}</groupId>
                  <artifactId>${deployable.artifactId}</artifactId>
                  <classifier>jboss-as7</classifier>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>tomcat7x</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <tomcat7x.download.url>https://archive.apache.org/dist/tomcat/tomcat-7/v${version.tomcat7}/bin/apache-tomcat-${version.tomcat7}.zip</tomcat7x.download.url>
      </properties>
      <build>
        <pluginManagement>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>tomcat7x</containerId>
                <type>installed</type>
                <zipUrlInstaller>
                  <url>${tomcat7x.download.url}</url>
                </zipUrlInstaller>
                <systemProperties>
                  <tomcat.home>${project.build.directory}/cargo/configurations/tomcat7x</tomcat.home>
                  <bitronix.tm.configuration>
                    ${project.build.directory}/cargo/configurations/tomcat7x/conf/btm-config.properties
                  </bitronix.tm.configuration>
                  <jbpm.tsr.jndi.lookup>java:comp/env/TransactionSynchronizationRegistry</jbpm.tsr.jndi.lookup>
                </systemProperties>
                <dependencies>
                  <dependency>
                    <groupId>org.codehaus.btm</groupId>
                    <artifactId>btm</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.codehaus.btm</groupId>
                    <artifactId>btm-tomcat55-lifecycle</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>com.h2database</groupId>
                    <artifactId>h2</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.jboss.spec.javax.transaction</groupId>
                    <artifactId>jboss-transaction-api_1.1_spec</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-api</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.kie</groupId>
                    <artifactId>kie-tomcat-integration</artifactId>
                  </dependency>
                  <dependency>
                    <groupId>org.jboss.spec.javax.security.jacc</groupId>
                    <artifactId>jboss-jacc-api_1.4_spec</artifactId>
                  </dependency>
                </dependencies>
              </container>
              <configuration>
                <configfiles>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/tomcat-shared/config</file>
                    <todir>conf</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/tomcat7/config</file>
                    <todir>conf</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                </configfiles>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>${deployable.groupId}</groupId>
                  <artifactId>${deployable.artifactId}</artifactId>
                  <classifier>tomcat7</classifier>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
          <plugin>
            <!-- Tomcat is not (yet?) configured with JMS, so exclude the JMS tests. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <configuration>
              <excludedGroups>org.kie.smoke.wb.category.JMSSmoke</excludedGroups>
            </configuration>
          </plugin>
        </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>tomcat8x</id>
      <properties>
        <tomcat8x.download.url>https://archive.apache.org/dist/tomcat/tomcat-8/v${version.tomcat8}/bin/apache-tomcat-${version.tomcat8}.zip</tomcat8x.download.url>
      </properties>
      <build>
        <pluginManagement>
          <plugins>
            <plugin>
              <groupId>org.codehaus.cargo</groupId>
              <artifactId>cargo-maven2-plugin</artifactId>
              <configuration>
                <container>
                  <containerId>tomcat8x</containerId>
                  <type>installed</type>
                  <zipUrlInstaller>
                    <url>${tomcat8x.download.url}</url>
                  </zipUrlInstaller>
                  <systemProperties>
                    <tomcat.home>${project.build.directory}/cargo/configurations/tomcat8x</tomcat.home>
                    <bitronix.tm.configuration>
                      ${project.build.directory}/cargo/configurations/tomcat8x/conf/btm-config.properties
                    </bitronix.tm.configuration>
                    <jbpm.tsr.jndi.lookup>java:comp/env/TransactionSynchronizationRegistry</jbpm.tsr.jndi.lookup>
                  </systemProperties>
                  <dependencies>
                    <dependency>
                      <groupId>org.codehaus.btm</groupId>
                      <artifactId>btm</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.codehaus.btm</groupId>
                      <artifactId>btm-tomcat55-lifecycle</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>com.h2database</groupId>
                      <artifactId>h2</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.transaction</groupId>
                      <artifactId>jboss-transaction-api_1.1_spec</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.slf4j</groupId>
                      <artifactId>slf4j-api</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.kie</groupId>
                      <artifactId>kie-tomcat-integration</artifactId>
                    </dependency>
                    <dependency>
                      <groupId>org.jboss.spec.javax.security.jacc</groupId>
                      <artifactId>jboss-jacc-api_1.4_spec</artifactId>
                    </dependency>
                  </dependencies>
                </container>
                <configuration>
                  <configfiles>
                    <configfile>
                      <file>${project.build.testOutputDirectory}/tomcat-shared/config</file>
                      <todir>conf</todir>
                      <overwrite>true</overwrite>
                    </configfile>
                    <configfile>
                      <file>${project.build.testOutputDirectory}/tomcat8/config</file>
                      <todir>conf</todir>
                      <overwrite>true</overwrite>
                    </configfile>
                  </configfiles>
                </configuration>
                <deployables>
                  <deployable>
                    <groupId>${deployable.groupId}</groupId>
                    <artifactId>${deployable.artifactId}</artifactId>
                    <classifier>tomcat7</classifier> <!-- No Tomcat8 specific deployable needed (yet) -->
                    <type>war</type>
                  </deployable>
                </deployables>
              </configuration>
            </plugin>
            <plugin>
              <!-- Tomcat is not (yet?) configured with JMS, so exclude the JMS tests. -->
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-failsafe-plugin</artifactId>
              <configuration>
                <excludedGroups>org.kie.smoke.wb.category.JMSSmoke</excludedGroups>
              </configuration>
            </plugin>
          </plugins>
        </pluginManagement>
      </build>
    </profile>

    <profile>
      <id>wildfly8x</id>
      <properties>
        <wildfly8x.download.url>http://download.jboss.org/wildfly/${version.wildfly8}/wildfly-${version.wildfly8}.zip</wildfly8x.download.url>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>wildfly8x</containerId>
                <type>installed</type>
                <zipUrlInstaller>
                  <url>${wildfly8x.download.url}</url>
                </zipUrlInstaller>
              </container>
              <configuration>
                <properties>
                  <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                </properties>
                <configfiles>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/eap-jbossas-wildfly-shared/config</file>
                    <todir>configuration</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                  <configfile>
                    <file>${project.build.testOutputDirectory}/ssl/server</file>
                    <todir>configuration/ssl</todir>
                    <overwrite>true</overwrite>
                  </configfile>
                </configfiles>
              </configuration>
              <deployables>
                <deployable>
                  <groupId>${deployable.groupId}</groupId>
                  <artifactId>${deployable.artifactId}</artifactId>
                  <classifier>wildfly8</classifier>
                  <type>war</type>
                </deployable>
              </deployables>
            </configuration>
          </plugin>
        </plugins>
      </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>
        <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>
                <!-- do nothing, container is not managed by cargo! -->
                <goals/>
              </execution>
              <execution>
                <id>stop-container</id>
                <phase>none</phase>
                <!-- do nothing, container is not managed by cargo! -->
                <goals/>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
