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

   <artifactId>infinispan-cachestore-jpa</artifactId>
   <name>Infinispan JPA CacheStore</name>
   <description>Infinispan JPA CacheStore module</description>

   <build>
      <resources>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
               <include>schema/*-${infinispan.core.schema.version}.xsd</include>
            </includes>
         </resource>
         <resource>
            <directory>${project.basedir}/src/main/resources</directory>
            <filtering>false</filtering>
            <includes>
               <include>**/*</include>
            </includes>
            <excludes>
               <exclude>schema/**</exclude>
            </excludes>
         </resource>
      </resources>
      <testResources>
         <testResource>
            <directory>${project.basedir}/src/test/resources</directory>
            <filtering>true</filtering>
            <excludes>
               <exclude>10_1_x_jpa_data/*</exclude>
            </excludes>
         </testResource>
         <testResource>
            <directory>${project.basedir}/src/test/resources</directory>
            <filtering>false</filtering>
            <includes>
               <include>10_1_x_jpa_data/*</include>
            </includes>
         </testResource>
      </testResources>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
               <!-- Tests against single database cannot be executed in paralllel -->
               <threadCount>1</threadCount>
               <dependenciesToScan>
                  <!-- TestNGSuiteChecksTest -->
                  <dependency>org.infinispan:infinispan-commons-test</dependency>
               </dependenciesToScan>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.infinispan</groupId>
            <artifactId>infinispan-defaults-maven-plugin</artifactId>
            <version>${project.version}</version>
            <executions>
               <execution>
                  <id>extract-defaults</id>
                  <phase>process-classes</phase>
                  <goals>
                     <goal>extract-defaults</goal>
                  </goals>
               </execution>
            </executions>
         </plugin>
      </plugins>
   </build>
   <dependencies>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>javax.persistence</groupId>
         <artifactId>javax.persistence-api</artifactId>
         <scope>provided</scope>
      </dependency>
      <dependency>
         <groupId>org.glassfish.jaxb</groupId>
         <artifactId>jaxb-runtime</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.mockito</groupId>
         <artifactId>mockito-core</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.apache.logging.log4j</groupId>
         <artifactId>log4j-slf4j-impl</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.infinispan</groupId>
         <artifactId>infinispan-component-processor</artifactId>
      </dependency>
      <dependency>
         <groupId>org.infinispan.protostream</groupId>
         <artifactId>protostream-processor</artifactId>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>org.kohsuke.metainf-services</groupId>
         <artifactId>metainf-services</artifactId>
      </dependency>
      <dependency>
         <groupId>org.testng</groupId>
         <artifactId>testng</artifactId>
         <scope>test</scope>
      </dependency>
   </dependencies>

   <profiles>
      <profile>
         <id>h2</id>
         <activation>
            <activeByDefault>true</activeByDefault>
         </activation>
         <dependencies>
            <dependency>
               <groupId>com.h2database</groupId>
               <artifactId>h2</artifactId>
               <scope>test</scope>
            </dependency>
         </dependencies>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <systemPropertyVariables>
                        <connection.url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection.url>
                        <driver.class>org.h2.Driver</driver.class>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
      <profile>
         <id>mysql</id>
         <dependencies>
            <dependency>
               <groupId>mysql</groupId>
               <artifactId>mysql-connector-java</artifactId>
               <scope>test</scope>
            </dependency>
         </dependencies>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <systemPropertyVariables>
                        <connection.url>jdbc:mysql://localhost:3306/ispn_jpa_test</connection.url>
                        <driver.class>com.mysql.jdbc.Driver</driver.class>
                        <db.username>${db.username}</db.username>
                        <db.password>${db.password}</db.password>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
      <profile>
         <id>postgres</id>
         <dependencies>
            <dependency>
               <groupId>org.postgresql</groupId>
               <artifactId>postgresql</artifactId>
            </dependency>
         </dependencies>
         <build>
            <plugins>
               <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-surefire-plugin</artifactId>
                  <configuration>
                     <systemPropertyVariables>
                        <connection.url>jdbc:postgresql://localhost:5432/ispn_jpa_test</connection.url>
                        <driver.class>org.postgresql.Driver</driver.class>
                        <db.username>${db.username}</db.username>
                        <db.password>${db.password}</db.password>
                     </systemPropertyVariables>
                  </configuration>
               </plugin>
            </plugins>
         </build>
      </profile>
   </profiles>
</project>
