<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.remote</groupId>
    <artifactId>kie-remote</artifactId>
    <version>6.0.0.Beta3</version>
  </parent>

  <artifactId>kie-services-remote</artifactId>
  <name>KIE Remote Services :: Services</name>

  <licenses>
    <license>
      <name>The Apache Software License, Version 2.0</name>
      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <properties>
    <arquillian.launch>jboss</arquillian.launch>
    
    <jboss.version>7.1.1.Final</jboss.version>
    <jboss.server.name>jboss-as-${jboss.version}</jboss.server.name>
    <jboss.server.version>7.1.1.Final</jboss.server.version>
    <!-- 2.2.14+ is incompatible with 7.1.1.Final : HORNETQ-1035 -->
    <hornetq.version>2.2.13.Final</hornetq.version>
    
    <!-- eap integration
    <jboss.version>7.2.0.Final</jboss.version> 
    <jboss.server.version>7.2.0.Final-redhat-8</jboss.server.version> 
    <jboss.server.name>jboss-eap-6.1</jboss.server.name>
    <hornetq.version>2.3.0.Final</hornetq.version>
     -->
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.kie.remote</groupId>
      <artifactId>kie-services-client</artifactId>
    </dependency>

    <!-- jbpm (graph func)-->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-audit</artifactId>
      <scope>compile</scope>
    </dependency>
    
    <!-- kie -->
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-kie-services</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.jbpm</groupId>
          <artifactId>jbpm-form-services</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>btm</artifactId>
          <groupId>org.codehaus.btm</groupId>
        </exclusion>
        <exclusion>
          <artifactId>weld-core</artifactId>
          <groupId>org.jboss.weld</groupId>
        </exclusion>
        <exclusion>
          <artifactId>kie-ci</artifactId>
          <groupId>org.kie</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-internal</artifactId>
    </dependency>

    <!-- jms -->
    <dependency>
        <!-- remove when integrating with EAP -->
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-jms-client-bom</artifactId>
        <version>7.1.1.Final</version>
        <type>pom</type>
    </dependency>
    <dependency>
      <groupId>javax.jms</groupId>
      <artifactId>jms</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hornetq</groupId>
      <artifactId>hornetq-core-client</artifactId>
    </dependency>
    <dependency>
      <groupId>org.hornetq</groupId>
      <artifactId>hornetq-jms-client</artifactId>
    </dependency>

    <!-- Rest -->
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxrs</artifactId>
      <scope>provided</scope> <!-- for AS 7 -->
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>jaxrs-api</artifactId>
    </dependency>

    <!-- general -->
    <dependency>
      <groupId>org.jboss.spec.javax.ejb</groupId>
      <artifactId>jboss-ejb-api_3.1_spec</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.inject</groupId>
      <artifactId>javax.inject</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.enterprise</groupId>
      <artifactId>cdi-api</artifactId>
    </dependency>
    <dependency>
      <groupId>javax.annotation</groupId>
      <artifactId>jsr250-api</artifactId>
      <version>1.0</version>
    </dependency>

    <!-- persistence -->
    <dependency>
      <groupId>org.hibernate.javax.persistence</groupId>
      <artifactId>hibernate-jpa-2.0-api</artifactId>
    </dependency>

    <!-- logging -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- TEST -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <scope>test</scope>
    </dependency>
    
    <!-- arquillian -->
    <dependency>
      <groupId>org.jboss.arquillian.junit</groupId>
      <artifactId>arquillian-junit-container</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.shrinkwrap</groupId>
      <artifactId>shrinkwrap-api</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.jboss.as</groupId>
      <artifactId>jboss-as-arquillian-container-managed</artifactId>
      <version>${jboss.version}</version>
      <scope>test</scope>
    </dependency>
    <!-- necessary when using hornetq 2.2.x -->
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty</artifactId>
      <version>3.6.2.Final</version>
      <scope>test</scope>
    </dependency>

    <!-- libs needed for (test) war integration -->
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-jaxb-provider</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jboss.resteasy</groupId>
      <artifactId>resteasy-cdi</artifactId>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>org.jboss.resteasy</groupId>
          <artifactId>resteasy-jaxrs</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.jboss.solder</groupId>
      <artifactId>solder-impl</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-persistence-jpa</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-runtime-manager</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kie.commons</groupId>
      <artifactId>kie-nio2-fs</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.jbpm</groupId>
      <artifactId>jbpm-shared-services</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <testResources>
      <testResource>
        <directory>src/test/resources</directory>
        <filtering>true</filtering>
      </testResource>
      <testResource>
        <directory>src/test/resources-jbossas-7</directory>
        <filtering>false</filtering>
      </testResource>
    </testResources>

    <plugins>
      <!-- testing -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*IntegrationTest.java</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <argLine>-Xms512m -Xmx1024m -XX:MaxPermSize=512m</argLine>
          <includes>
            <include>**/*IntegrationTest.java</include>
          </includes>
        </configuration>
      </plugin>
    </plugins>

  </build>

  <profiles>

    <!-- testing with jboss AS 7 -->
    <profile>
      <id>arquillian-jboss7-managed</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <build>
        <plugins>
          <!-- install server in the build/target dir -->
          <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>unpack</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.jboss.as</groupId>
                      <artifactId>jboss-as-dist</artifactId>
                      <version>${jboss.server.version}</version>
                      <type>zip</type>
                      <overWrite>false</overWrite>
                      <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- install files with user/password information in the server dir -->
          <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-user-config</id>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/${jboss.server.name}/standalone/configuration</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/test/resources-jbossas-7/config</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                  <overwrite>true</overwrite>
                </configuration>
              </execution>
              <execution>
                <id>copy-bpmn2-repo</id>
                <phase>process-test-resources</phase>
                <goals>
                  <goal>copy-resources</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/${jboss.server.name}/bin/repo</outputDirectory>
                  <resources>
                    <resource>
                      <directory>src/test/resources/repo</directory>
                      <filtering>false</filtering>
                    </resource>
                  </resources>
                  <overwrite>true</overwrite>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- modify server configuration -->
          <plugin>
            <groupId>com.google.code.maven-replacer-plugin</groupId>
            <artifactId>replacer</artifactId>
            <version>1.5.2</version>
            <executions>
              <execution>
                <phase>pre-integration-test</phase>
                <goals>
                  <goal>replace</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <file>${project.build.directory}/${jboss.server.name}/standalone/configuration/standalone-full.xml</file>
              <outputFile>${project.build.directory}/${jboss.server.name}/standalone/configuration/standalone-full.xml</outputFile>
              <replacements>
                <!-- allow jms queue creation via arquillian server task -->
                <replacement>
                  <token>&lt;persistence-enabled&gt;true&lt;/persistence-enabled&gt;\n\s*&lt;journal</token>
                  <value>&lt;persistence-enabled&gt;true&lt;/persistence-enabled&gt;
                    &lt;jmx-management-enabled&gt;true&lt;/jmx-management-enabled&gt;
                    &lt;journal</value>
                </replacement>
                <replacement>
                  <!-- variable for DynamicQueueCreationBean -->
                  <token>&lt;subsystem xmlns="urn:jboss:domain:naming:1.(\d)"&gt;</token>
                  <value>
                    &lt;subsystem xmlns="urn:jboss:domain:naming:1.$1"&gt;
                    &lt;bindings&gt;
                    &lt;simple
                    name="java:jboss/jbpm/console/createDynamicQueues" type="java.lang.Boolean" value="true" /&gt;
                    &lt;/bindings&gt;</value>
                </replacement>
                <replacement>
                  <!-- Service jboss.pojo."org.jboss.netty.internal.LoggerConfigurator".DESCRIBED is already registered -->
                  <token>&lt;extension module="org.jboss.as.pojo"/&gt;</token>
                  <value></value>
                </replacement>
                <replacement>
                  <token>&lt;subsystem xmlns="urn:jboss:domain:pojo:1.0"/&gt;</token>
                  <value></value>
                </replacement>
                <!-- @formatter: on -->
              </replacements>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>

