<?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-jcache-parent</artifactId>
      <version>15.2.6.Final</version>
      <relativePath>../pom.xml</relativePath>
   </parent>

   <artifactId>infinispan-jcache-tck-runner-remote</artifactId>
   <packaging>jar</packaging>
   <name>Infinispan JCACHE (JSR-107) TCK Runner Remote</name>
   <description>JCACHE (JSR-107) TCK runner for Infinispan implementations</description>

   <properties>
      <tck.mbean.builder>org.infinispan.jcache.tck.TckMbeanServerBuilder</tck.mbean.builder>
      <tck.mbean.server>TckMbeanServer</tck.mbean.server>

      <remote.CacheManagerImpl>org.infinispan.jcache.remote.JCacheManager</remote.CacheManagerImpl>
      <remote.CacheImpl>org.infinispan.jcache.remote.JCache</remote.CacheImpl>
      <remote.CacheEntryImpl>org.infinispan.jcache.JCacheEntry</remote.CacheEntryImpl>
      <remote.CacheInvocationContextImpl>org.infinispan.jcache.annotation.CacheKeyInvocationContextImpl</remote.CacheInvocationContextImpl>

      <ispnserver.project.dir>${basedir}/../../server/runtime</ispnserver.project.dir>
      <server.build.dist>${ispnserver.project.dir}/target/${infinispan.brand.prefix}-server-${infinispan.brand.version}</server.build.dist>
      <ispnserver.dist>${basedir}/target/infinispan-server</ispnserver.dist>
      <ispnserver.config.file>${project.build.testOutputDirectory}/infinispan.xml</ispnserver.config.file>
      <server.dir.parent>${project.build.directory}</server.dir.parent>
      <server.dir.name>infinispan-server-${project.version}</server.dir.name>
      <server.dir>${server.dir.parent}/${server.dir.name}</server.dir>
      <mcast.ip>234.99.54.14</mcast.ip>
      <server.jvm>${env.JAVA_HOME}</server.jvm>
      <server.jvm.args>${testjvm.commonArgs} ${testjvm.jdkSpecificArgs} ${testjvm.extraArgs} ${jvm.ip.stack} ${serverMemoryJvmArgs}</server.jvm.args>
      <jvm.ip.stack>-Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Djboss.default.multicast.address=${mcast.ip}</jvm.ip.stack>
      <serverMemoryJvmArgs>-Xmx500m</serverMemoryJvmArgs>

      <!-- infinispan.xml ignores the infinispan.cluster.stack system property and uses the test-tcp stack -->
      <transport.stack/>
      <jvm.x64.args />
   </properties>

   <dependencies>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-jcache-remote</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-jcache-commons</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-jcache-commons</artifactId>
         <type>test-jar</type>
         <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-commons-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-server-runtime</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.hamcrest</groupId>
         <artifactId>hamcrest-library</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>javax.cache</groupId>
         <artifactId>cache-tests</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>javax.cache</groupId>
         <artifactId>cache-tests</artifactId>
         <classifier>tests</classifier>
         <scope>test</scope>
      </dependency>
   </dependencies>

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

      <plugins>
         <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <id>generate-distros-and-configs</id>
                  <goals>
                     <goal>run</goal>
                  </goals>
                  <phase>process-test-resources</phase>
                  <configuration>
                     <skip>${skipTests}</skip>
                     <target>
                        <ant antfile="${basedir}/../../server/runtime/src/main/ant/infinispan-server.xml" target="create-distro">
                           <property name="server.build.dist" value="${server.build.dist}" />
                           <property name="server.dist" value="${ispnserver.dist}" />
                        </ant>
                        <copy file="${ispnserver.config.file}" todir="${ispnserver.dist}/server/conf" overwrite="true" />
                     </target>
                  </configuration>
               </execution>
               <execution>
                  <id>infinispan-server-startup</id>
                  <phase>pre-integration-test</phase>
                  <goals>
                     <goal>run</goal>
                  </goals>
                  <configuration>
                     <skip>${skipTests}</skip>
                     <target>
                        <ant antfile="${basedir}/../../server/runtime/src/main/ant/infinispan-server.xml" target="kill-server">
                           <property name="hotrod.port" value="11222" />
                        </ant>
                        <ant antfile="${basedir}/../../server/runtime/src/main/ant/infinispan-server.xml" target="start-server">
                           <property name="server.dist" value="${ispnserver.dist}" />
                           <property name="port.offset" value="0" />
                           <property name="hotrod.port" value="11222" />
                           <property name="jboss.node.name" value="ispn-server" />
                           <property name="jboss.config.file" value="infinispan.xml" />
                           <property name="server.jvm.args" value="${server.jvm.args}" />
                        </ant>
                     </target>
                  </configuration>
               </execution>
               <execution>
                  <id>infinispan-server-shutdown</id>
                  <phase>post-integration-test</phase>
                  <goals>
                     <goal>run</goal>
                  </goals>
                  <configuration>
                     <skip>${skipTests}</skip>
                     <target>
                        <ant antfile="${basedir}/../../server/runtime/src/main/ant/infinispan-server.xml" target="kill-server">
                           <property name="hotrod.port" value="11222" />
                        </ant>
                     </target>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <!-- TODO Remove? -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
               <execution>
                  <id>copy-agent</id>
                  <phase>process-test-resources</phase>
                  <goals>
                     <goal>copy</goal>
                  </goals>
                  <configuration>
                     <outputDirectory>${ispnserver.dist}/server/lib</outputDirectory>
                     <artifactItems>
                        <artifactItem>
                           <groupId>org.infinispan</groupId>
                           <artifactId>infinispan-jcache-commons</artifactId>
                           <classifier>tests</classifier>
                        </artifactItem>
                        <artifactItem>
                           <groupId>javax.cache</groupId>
                           <artifactId>cache-tests</artifactId>
                        </artifactItem>
                     </artifactItems>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
               <execution>
                  <id>default-test</id>
                  <phase>none</phase>
               </execution>
            </executions>
         </plugin>

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
               <execution>
                  <goals>
                     <goal>integration-test</goal>
                     <goal>verify</goal>
                  </goals>
               </execution>
            </executions>
            <configuration>
               <dependenciesToScan>
                  <!-- TCK tests -->
                  <dependency>javax.cache:cache-tests</dependency>
               </dependenciesToScan>
               <disableXmlReport>false</disableXmlReport>
               <!-- TODO  Remove? -->
               <includes>
                  <include>**/Test*.java</include>
                  <include>**/*Test.java</include>
                  <include>**/*TestCase.java</include>
               </includes>
               <disableXmlReport>false</disableXmlReport>
               <systemPropertyVariables>
                  <ExcludeList>ExcludeList_remote</ExcludeList>
                  <javax.cache.CacheManager>${remote.CacheManagerImpl}</javax.cache.CacheManager>
                  <javax.cache.Cache>${remote.CacheImpl}</javax.cache.Cache>
                  <javax.cache.Cache.Entry>${remote.CacheEntryImpl}</javax.cache.Cache.Entry>
                  <jgroups.join_timeout>2000</jgroups.join_timeout>

                  <javax.management.builder.initial>${tck.mbean.builder}</javax.management.builder.initial>
                  <org.jsr107.tck.management.agentId>${tck.mbean.server}</org.jsr107.tck.management.agentId>
                  <java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
                  <jgroups.join_timeout>2000</jgroups.join_timeout>
                  <infinispan.test.checkThreadLeaks>false</infinispan.test.checkThreadLeaks>

                  <log4j.configurationFile>${log4j.configurationFile}</log4j.configurationFile>
                  <log4j2.contextSelector>org.apache.logging.log4j.core.selector.BasicContextSelector</log4j2.contextSelector>
                  <java.util.logging.manager>org.apache.logging.log4j.jul.LogManager</java.util.logging.manager>
                  <!-- this is picked up in log4j2.xml, which adds it to each module's log file name-->
                  <infinispan.module-suffix>${infinispan.module-suffix}</infinispan.module-suffix>
                  <ansi.strip>${ansi.strip}</ansi.strip>
               </systemPropertyVariables>
               <argLine>${forkJvmArgs} ${testjvm.jdkSpecificArgs}</argLine>
               <properties>
                  <listener>${junitListener}</listener>
               </properties>
            </configuration>
            <dependencies>
               <dependency>
                  <groupId>org.apache.maven.surefire</groupId>
                  <artifactId>surefire-junit47</artifactId>
                  <version>${version.maven.surefire}</version>
               </dependency>
            </dependencies>
         </plugin>
      </plugins>
   </build>

   <profiles>
      <profile>
         <id>test-basic-cache</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <configuration>
                     <excludes>
                        <exclude>**/interceptor/*Test.java</exclude>
                     </excludes>
                     <systemPropertyVariables>
                        <jgroups.join_timeout>2000</jgroups.join_timeout>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>test-optional-cache</id>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <configuration>
                     <includes>
                        <include>**/interceptor/*Test.java</include>
                     </includes>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>

      <profile>
         <id>smoke</id>
         <properties>
            <skipTests>true</skipTests>
         </properties>
      </profile>

      <profile>
         <id>java-alt-test</id>
         <activation>
            <activeByDefault>false</activeByDefault>
         </activation>
         <properties>
            <server.jvm>${env.JAVA_ALT_HOME}</server.jvm>
            <server.jvm.args>${testjvm.extraArgs} ${jvm.ip.stack} ${serverMemoryJvmArgs} ${transport.stack} ${jvm.x64.args}</server.jvm.args>
         </properties>
      </profile>

   </profiles>
</project>
