<?xml version="1.0" encoding="UTF-8"?>
<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">
  <parent>
    <artifactId>camel-container-tests</artifactId>
    <groupId>org.drools</groupId>
    <version>7.14.0.Final</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>camel-container-integration-tests</artifactId>

  <name>Container tests for Camel integration</name>
  <description>
    Container tests for Camel integration
  </description>

  <dependencies>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-rs-client</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>woodstox-core</artifactId>
          <groupId>com.fasterxml.woodstox</groupId>
        </exclusion>
      </exclusions>
      <scope>runtime</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http-hc</artifactId>
      <scope>runtime</scope>
      <exclusions>
        <exclusion>
          <artifactId>woodstox-core</artifactId>
          <groupId>com.fasterxml.woodstox</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>camel-container-tests-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-ci</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
    </dependency>

    <dependency>
      <groupId>org.drools</groupId>
      <artifactId>camel-container-tests-module</artifactId>
      <type>war</type>
      <scope>provided</scope>
    </dependency>

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

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration combine.children="append">
          <systemProperties>
            <org.apache.cxf.stax.allowInsecureParser>1</org.apache.cxf.stax.allowInsecureParser>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>wildfly</id>
      <activation>
        <property>
          <name>!eap.url</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.wildfly</groupId>
                      <artifactId>wildfly-dist</artifactId>
                      <version>${version.org.wildfly}</version>
                      <type>zip</type>
                      <outputDirectory>${project.build.directory}/application-server</outputDirectory>
                    </artifactItem>
                    <artifactItem>
                      <groupId>org.wildfly.camel</groupId>
                      <artifactId>wildfly-camel-patch</artifactId>
                      <version>${version.org.wildfly.camel}</version>
                      <type>tar.gz</type>
                      <outputDirectory>${project.build.directory}/application-server/wildfly-${version.org.wildfly}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>wildfly14x</containerId>
                <home>${project.build.directory}/application-server/wildfly-${version.org.wildfly}</home>
                <type>installed</type>
              </container>
              <deployables>
                <deployable>
                  <groupId>org.drools</groupId>
                  <artifactId>camel-container-tests-module</artifactId>
                  <type>war</type>
                </deployable>
              </deployables>
              <configuration>
                <properties>
                  <cargo.jboss.configuration>standalone-camel</cargo.jboss.configuration>
                </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>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>eap</id>
      <activation>
        <property>
          <name>eap.url</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <target>
                    <get src="${eap.url}" dest="${project.build.directory}/eap.zip" />
                    <unzip src="${project.build.directory}/eap.zip" dest="${project.build.directory}/application-server">
                      <cutdirsmapper dirs="1" />
                    </unzip>
                    <get src="${fuse.on.eap.url}" dest="${project.build.directory}/fuse-on-eap.jar"/>
                    <java jar="${project.build.directory}/fuse-on-eap.jar" fork="true" dir="${project.build.directory}/application-server" />
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <configuration>
              <container>
                <containerId>wildfly14x</containerId>
                <home>${project.build.directory}/application-server</home>
                <type>installed</type>
              </container>
              <deployables>
                <deployable>
                  <groupId>org.drools</groupId>
                  <artifactId>camel-container-tests-module</artifactId>
                  <type>war</type>
                </deployable>
              </deployables>
              <configuration>
                <properties>
                  <cargo.jboss.configuration>standalone-full</cargo.jboss.configuration>
                </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>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
