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

   <artifactId>integrationtests-osgi</artifactId>
   <name>Integration tests - OSGi/Karaf</name>
   <packaging>bundle</packaging>
   <description>Integration tests for Infinispan running in OSGi/Karaf</description>

   <profiles>
      <profile>
         <id>smoke</id>
         <properties>
            <skipOSGiTests>true</skipOSGiTests>
         </properties>
      </profile>
   </profiles>

   <dependencies>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-slf4j-impl</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-commons</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-commons-test</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-core</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jdbc</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jdbc</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-embedded</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-remote</artifactId>
         <version>${project.version}</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-osgi</artifactId>
         <version>${version.hibernate.core}</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jpa</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-jpa</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-rocksdb</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-server-hotrod</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-server-hotrod</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-cachestore-remote</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-osgi</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.mchange</groupId>
         <artifactId>c3p0</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.zaxxer</groupId>
         <artifactId>HikariCP</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.h2database</groupId>
         <artifactId>h2</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-client-hotrod</artifactId>
         <type>test-jar</type>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.exam</groupId>
         <artifactId>pax-exam-container-karaf</artifactId>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.exam</groupId>
         <artifactId>pax-exam-junit4</artifactId>
         <exclusions>
            <exclusion>
               <artifactId>bndlib</artifactId>
               <groupId>biz.aQute.bnd</groupId>
            </exclusion>
         </exclusions>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.exam</groupId>
         <artifactId>pax-exam</artifactId>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.exam</groupId>
         <artifactId>pax-exam-inject</artifactId>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.url</groupId>
         <artifactId>pax-url-aether</artifactId>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.url</groupId>
         <artifactId>pax-url-assembly</artifactId>
      </dependency>
      <dependency>
         <groupId>org.ops4j.pax.url</groupId>
         <artifactId>pax-url-wrap</artifactId>
      </dependency>
      <dependency>
         <groupId>org.apache.karaf.features</groupId>
         <artifactId>org.apache.karaf.features.core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <scope>test</scope>
      </dependency>
      <!-- Uncomment to debug surefire and the test container -->
      <!--<dependency>-->
         <!--<groupId>org.apache.maven.surefire</groupId>-->
         <!--<artifactId>surefire-api</artifactId>-->
         <!--<version>${version.maven.surefire}</version>-->
         <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
         <!--<groupId>org.apache.maven.surefire</groupId>-->
         <!--<artifactId>maven-surefire-common</artifactId>-->
         <!--<version>${version.maven.surefire}</version>-->
         <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
         <!--<groupId>org.apache.maven.surefire</groupId>-->
         <!--<artifactId>surefire-junit47</artifactId>-->
         <!--<version>${version.maven.surefire}</version>-->
         <!--<scope>provided</scope>-->
      <!--</dependency>-->
      <!--<dependency>-->
         <!--<groupId>org.ops4j.pax.exam</groupId>-->
         <!--<artifactId>pax-exam-invoker-junit</artifactId>-->
         <!--<version>${version.pax.exam}</version>-->
      <!--</dependency>-->
   </dependencies>

   <properties>
      <defaultTestGroup />
      <defaultExcludedTestGroup />
      <infinispan.test.parallel.threads>1</infinispan.test.parallel.threads>
      <infinispan.test.jgroups.protocol>tcp</infinispan.test.jgroups.protocol>
      <forkJvmArgs>-Xmx500m -XX:HeapDumpPath=${user.dir}</forkJvmArgs>
      <target.tmp.dir>${project.build.directory}/tmp/</target.tmp.dir>
      <skipOSGiTests>${skipTests}</skipOSGiTests>
      <verbose.karaf>false</verbose.karaf>
   </properties>

   <build>
      <testResources>
         <testResource>
            <directory>${project.basedir}/src/test/resources</directory>
            <filtering>true</filtering>
            <includes>
               <include>**/*</include>
            </includes>
         </testResource>
      </testResources>
      <plugins>
         <!-- IMPORTANT: generates META-INF/maven/dependencies.properties
              required by PAX-EXAM framework -->
         <plugin>
            <groupId>org.apache.servicemix.tooling</groupId>
            <artifactId>depends-maven-plugin</artifactId>
            <executions>
               <execution>
                  <id>generate-depends-file</id>
                  <goals>
                     <goal>generate-depends-file</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
               <execution>
                  <id>generate-tmp-dir</id>
                  <phase>generate-test-resources</phase>
                  <configuration>
                     <target>
                        <mkdir dir="${target.tmp.dir}" />
                     </target>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
               <execution>
                  <id>stop-karaf-test-containers</id>
                  <phase>prepare-package</phase>
                  <configuration>
                     <target xmlns:if="ant:if">
                        <condition property="kill-argument-prefix" value="/PID ">
                           <os family="windows"/>
                        </condition>
                        <property name="kill-argument-prefix" value=" "/>
                        <loadfile property="karaf.pids">
                           <concat fixlastline="true">
                              <fileset dir="${project.build.directory}" includes="**/karaf.pid"/>
                              <filterchain>
                                 <filterreader classname="org.apache.tools.ant.filters.PrefixLines">
                                    <param name="prefix" value="${kill-argument-prefix}"/>
                                 </filterreader>
                                 <filterreader classname="org.apache.tools.ant.filters.StripLineBreaks"/>
                              </filterchain>
                           </concat>
                        </loadfile>
                        <echo>Found Karaf pids: ${karaf.pids}</echo>
                        <exec osfamily="windows" executable="taskkill">
                           <arg line="/F /T ${karaf.pids}"/>
                        </exec>
                        <exec executable="kill" osfamily="unix">
                           <arg line="-9 ${karaf.pids}"/>
                        </exec>
                     </target>
                  </configuration>
                  <goals>
                     <goal>run</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <threadCount>1</threadCount>
               <parallel>classes</parallel>
               <groups combine.self="override"></groups>
               <excludedGroups combine.self="override"></excludedGroups>
               <systemPropertyVariables>
                  <java.io.tmpdir>${target.tmp.dir}</java.io.tmpdir>
                  <verbose.karaf>${verbose.karaf}</verbose.karaf>
               </systemPropertyVariables>
               <runOrder>alphabetical</runOrder>
               <skipTests>${skipOSGiTests}</skipTests>
               <failIfNoTests>false</failIfNoTests>
               <testNGArtifactName>none:none</testNGArtifactName>
               <disableXmlReport>false</disableXmlReport>
               <runOrder>alphabetical</runOrder>
               <properties>
                  <property>
                     <name>listener</name>
                     <value>${junitListener}</value>
                  </property>
               </properties>
               <argLine>${forkJvmArgs} ${testjvm.jigsawArgs}</argLine>
            </configuration>
            <dependencies>
               <dependency>
                  <groupId>org.apache.maven.surefire</groupId>
                  <artifactId>surefire-junit47</artifactId>
                  <version>${version.maven.surefire}</version>
               </dependency>
            </dependencies>
            <executions>
               <!--
               Make sure two containers are not started at the same time by separating the
               PerSuite reactor tests from PerClass/PerMethod(default).

               Note: @Category(PerSuite.class) needs to be specified in addition to the
               @PaxExamReactor(PerSuite.class) annotation.
               -->
               <execution>
                  <id>default-test</id>
                  <phase>test</phase>
                  <goals>
                     <goal>test</goal>
                  </goals>
                  <configuration>
                     <!-- Include the tests that can reuse a single Karaf container -->
                     <groups>org.ops4j.pax.exam.spi.reactors.PerSuite</groups>
                  </configuration>
               </execution>
               <execution>
                  <id>new-container</id>
                  <phase>test</phase>
                  <goals>
                     <goal>test</goal>
                  </goals>
                  <configuration>
                     <!-- Include the tests that need a separate container for each test/method -->
                     <groups>org.ops4j.pax.exam.spi.reactors.PerClass,org.ops4j.pax.exam.spi.reactors.PerMethod</groups>
                     <excludedGroups>org.ops4j.pax.exam.spi.reactors.PerSuite</excludedGroups>
                  </configuration>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
</project>
