<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.cache2k</groupId>
    <artifactId>cache2k-parent</artifactId>
    <version>1.0.1.Final</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <groupId>org.cache2k</groupId>
  <artifactId>cache2k-jcache-tests</artifactId>

  <packaging>jar</packaging>

  <name>cache2k JCache tests</name>
  <description>
    Tests for JSR107 compliant caches. These are tests from the JSR107 TCK
    that were published as Open Source. The artifact may also contain additional
    tests and improvements. For compliance testing use the original TCK as published
    via jcp.org.
  </description>

  <properties>
    <jcache-spec-version>1.0.1</jcache-spec-version>
  </properties>

  <dependencies>

    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.11</version>
    </dependency>

    <dependency>
      <groupId>javax.cache</groupId>
      <artifactId>cache-api</artifactId>
      <version>${jcache.version}</version>
    </dependency>

    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-all</artifactId>
      <version>1.3</version>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>license-maven-plugin</artifactId>
          <version>1.5</version>
          <configuration>
            <licenseName>apache_v2</licenseName>
            <!-- do not touch header in original TCK code -->
            <excludes>
              <exclude>main/java/domain/**</exclude>
              <exclude>main/java/manager/**</exclude>
              <exclude>main/java/org/jsr107/**</exclude>
              <exclude>test/java/org/jsr107/**</exclude>
            </excludes>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>

    <!--The rest come from the parent pom-->
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.9</version>
        <configuration>
          <!-- disable the standard parallelism configuration from the parent -->
          <perCoreThreadCount>false</perCoreThreadCount>
          <threadCount>1</threadCount>
        </configuration>
      </plugin>
      <!-- The original TCK code is only compatible to Java 7 -->
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>2.3.2</version>
        <configuration>
          <source>1.7</source>
          <target>1.7</target>
        </configuration>
      </plugin>
      <!-- skip deploy -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-deploy-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>


  <profiles>

    <!-- Tests don't run on Java 6. -->
    <profile>
      <id>skip-for-java6</id>
      <!-- activation via jdk is not working since we run maven with the latest JDK but switch
           to another for testing via -Djvm -->
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <skip>true</skip>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- By default run the tests with cache2k. -->
    <profile>
      <id>cache2k-jcache-tests-with-cache2k</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>

      <dependencies>
        <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>cache2k-core</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>org.cache2k</groupId>
          <artifactId>cache2k-jcache</artifactId>
          <version>${project.version}</version>
          <scope>test</scope>
        </dependency>
      </dependencies>

      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
              <systemPropertyVariables>
                <java.net.preferIPv4Stack>${java.net.preferIPv4Stack}</java.net.preferIPv4Stack>
                <javax.management.builder.initial>org.cache2k.jcache.provider.tckGlue.TckMBeanServerBuilder
                </javax.management.builder.initial>
                <org.jsr107.tck.management.agentId>TckMBeanServer</org.jsr107.tck.management.agentId>
                <javax.cache.CacheManager>org.cache2k.CacheManager</javax.cache.CacheManager>
                <javax.cache.Cache>org.cache2k.Cache</javax.cache.Cache>
                <javax.cache.Cache.Entry>org.cache2k.CacheEntry</javax.cache.Cache.Entry>
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>

    </profile>
  </profiles>

</project>
