<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <modelVersion>4.0.0</modelVersion>

   <parent>
      <groupId>org.infinispan</groupId>
      <artifactId>infinispan-server-integration</artifactId>
      <version>13.0.0.Dev02</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-wildfly-module-integrationtests</artifactId>
   <name>Integration tests - WildFly Module Integration Tests</name>
   <description>Integration tests - WildFly Module Integration Tests</description>

   <properties>
      <ispnserver.project.dir>${basedir}/../../../server/runtime</ispnserver.project.dir>
      <ispn.config.file>${basedir}/../server-integration-commons/src/test/resources/infinispan-custom.xml</ispn.config.file>
      <resources.dir>${basedir}/src/test/resources</resources.dir>
      <serverMemoryJvmArgs>-Xmx300m</serverMemoryJvmArgs>
      <jvm.x64.args />
      <!-- infinispan-custom.xml ignores the infinispan.cluster.stack system property and uses the test-tcp stack -->
      <transport.stack/>
      <jvm.ip.stack>-Djava.net.preferIPv4Stack=true</jvm.ip.stack>
      <mcast.ip>234.99.54.14</mcast.ip>
      <jvm.ip.stack>-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Djboss.default.multicast.address=${mcast.ip}</jvm.ip.stack>
      <server.jvm>${env.JAVA_HOME}</server.jvm>
      <server.jvm.args>${testjvm.commonArgs} ${testjvm.jdkSpecificArgs} ${testjvm.extraArgs} ${jvm.ip.stack} ${serverMemoryJvmArgs} ${transport.stack} ${jvm.x64.args}</server.jvm.args>
      <log4j.configurationFile>log4j2.xml</log4j.configurationFile>
      <infinispan.server.integration.data-source>java:jboss/datasources/ExampleDS</infinispan.server.integration.data-source>
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.infinispan.protostream</groupId>
         <artifactId>protostream-processor</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cdi-embedded</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
         <scope>test</scope>
         <type>test-jar</type>
      </dependency>
      <dependency>
         <groupId>org.eclipse.microprofile.config</groupId>
         <artifactId>microprofile-config-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-client-hotrod</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-server-runtime</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan.protostream</groupId>
         <artifactId>protostream</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-commons-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-jcache</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.arquillian.junit</groupId>
         <artifactId>arquillian-junit-container</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.shrinkwrap.resolver</groupId>
         <artifactId>shrinkwrap-resolver-depchain</artifactId>
         <type>pom</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.jboss.shrinkwrap.descriptors</groupId>
         <artifactId>shrinkwrap-descriptors-impl-javaee</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.wildfly.arquillian</groupId>
         <artifactId>wildfly-arquillian-container-managed</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>javax.cache</groupId>
         <artifactId>cache-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-feature-pack</artifactId>
         <version>${project.version}</version>
         <type>zip</type>
         <scope>test</scope>
      </dependency>

      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-server-integrationtests-commons</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>

   </dependencies>

   <build>
      <testResources>
         <testResource>
            <filtering>true</filtering>
            <directory>src/test/resources</directory>
         </testResource>
      </testResources>

      <plugins>
         <plugin>
            <groupId>org.jboss.galleon</groupId>
            <artifactId>galleon-maven-plugin</artifactId>
            <configuration>
               <skip>${skipTests}</skip>
            </configuration>
            <executions>
               <execution>
                  <id>server-provisioning-node1</id>
                  <goals>
                     <goal>provision</goal>
                  </goals>
                  <phase>prepare-package</phase>
                  <configuration>
                     <install-dir>${project.build.directory}/node1</install-dir>
                     <record-state>false</record-state>
                     <!-- true: uses local m2 cache only -->
                     <offline>false</offline>
                     <feature-packs>
                        <!-- full server -->
                        <feature-pack>
                           <groupId>${appserver.groupId}</groupId>
                           <artifactId>wildfly-galleon-pack</artifactId>
                           <version>${appserver.version}</version>
                        </feature-pack>
                        <!-- Infinispan modules -->
                        <feature-pack>
                           <groupId>${project.groupId}</groupId>
                           <artifactId>infinispan-feature-pack</artifactId>
                           <version>${project.version}</version>
                        </feature-pack>
                     </feature-packs>
                     <configurations>
                        <config>
                           <model>standalone</model>
                           <name>standalone.xml</name>
                        </config>
                     </configurations>
                     <plugin-options>
                        <!--
                        when true, the module.xml files only contains the maven coordinates of the jars to download when the server starts
                        when false, the plugin downloads the jars at build time
                         -->
                        <jboss-maven-dist>false</jboss-maven-dist>
                     </plugin-options>
                  </configuration>
               </execution>
               <execution>
                  <id>server-provisioning-node2</id>
                  <goals>
                     <goal>provision</goal>
                  </goals>
                  <phase>prepare-package</phase>
                  <configuration>
                     <install-dir>${project.build.directory}/node2</install-dir>
                     <record-state>false</record-state>
                     <!-- true: uses local m2 cache only -->
                     <offline>false</offline>
                     <feature-packs>
                        <!-- full server -->
                        <feature-pack>
                           <groupId>${appserver.groupId}</groupId>
                           <artifactId>wildfly-galleon-pack</artifactId>
                           <version>${appserver.version}</version>
                        </feature-pack>
                        <!-- Infinispan modules -->
                        <feature-pack>
                           <groupId>${project.groupId}</groupId>
                           <artifactId>infinispan-feature-pack</artifactId>
                           <version>${project.version}</version>
                        </feature-pack>
                     </feature-packs>
                     <configurations>
                        <config>
                           <model>standalone</model>
                           <name>standalone.xml</name>
                        </config>
                     </configurations>
                     <plugin-options>
                        <!--
                        when true, the module.xml files only contains the maven coordinates of the jars to download when the server starts
                        when false, the plugin downloads the jars at build time
                         -->
                        <jboss-maven-dist>false</jboss-maven-dist>
                     </plugin-options>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <configuration>
               <skip>${skipTests}</skip>
            </configuration>
            <executions>
               <!-- Copy the AS configuration files so we can use our custom configurations -->
               <execution>
                  <id>configure-as-node1</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                     <skip>${skipTests}</skip>
                     <outputDirectory>${project.build.directory}/node2</outputDirectory>
                     <overwrite>true</overwrite>
                     <resources>
                        <resource>
                           <directory>${project.build.testOutputDirectory}/as-config</directory>
                        </resource>
                     </resources>
                  </configuration>
               </execution>
               <execution>
                  <id>configure-as-node2</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                     <goal>copy-resources</goal>
                  </goals>
                  <configuration>
                     <skip>${skipTests}</skip>
                     <outputDirectory>${project.build.directory}/node1</outputDirectory>
                     <overwrite>true</overwrite>
                     <resources>
                        <resource>
                           <directory>${project.build.testOutputDirectory}/as-config</directory>
                        </resource>
                     </resources>
                  </configuration>
               </execution>

            </executions>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <profile>
         <id>nexus-staging</id>
         <activation>
            <property><name>!skipNexusStaging</name></property>
         </activation>
         <build>
            <plugins>
               <plugin>
                  <artifactId>maven-deploy-plugin</artifactId>
                  <configuration>
                     <skip>true</skip>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>smoke</id>
         <properties>
            <skipTests>true</skipTests>
         </properties>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <configuration>
                     <skipITs>${skipTests}</skipITs>
                     <systemPropertyVariables>
                        <infinispan.server.integration.data-source>${infinispan.server.integration.data-source}</infinispan.server.integration.data-source>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>java8-test</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <server.jvm>${env.JAVA8_HOME}</server.jvm>
            <server.jvm.args>${testjvm.commonArgs} ${testjvm.jdkSpecificArgs} ${testjvm.extraArgs} ${jvm.ip.stack} ${serverMemoryJvmArgs} ${transport.stack} ${jvm.x64.args}</server.jvm.args>
         </properties>
      </profile>
   </profiles>
</project>
