<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.fcrepo.camel</groupId>
    <artifactId>fcrepo-camel-toolbox</artifactId>
    <version>5.0.0</version>
  </parent>

  <artifactId>toolbox-features</artifactId>
  <packaging>bundle</packaging>

  <name>Provisioning features for Karaf</name>
  <description>Feature repositories for provisioning the Camel Toolbox modules in Karaf.</description>

  <properties>
    <cal10n.version>0.8.1</cal10n.version>
    <commons-beanutils.version>1.8.3</commons-beanutils.version>
    <commons-codec.version>1.10</commons-codec.version>
    <commons-collections.version>3.2.1</commons-collections.version>
    <commons-csv.version>1.4</commons-csv.version>
    <commons-digester.version>1.8</commons-digester.version>
    <commons-httpclient.version>3.1</commons-httpclient.version>
    <commons-io.version>2.5</commons-io.version>
    <commons-lang.version>3.4</commons-lang.version>
    <commons-validator.version>1.4.0</commons-validator.version>
    <dexx.version>0.6</dexx.version>
    <fluent-hc.version>4.5.2</fluent-hc.version>
    <guava.version>18.0</guava.version>
    <httpclient.version>4.5.2</httpclient.version>
    <httpclient-cache.version>4.3.5</httpclient-cache.version>
    <httpcore.version>4.4.5</httpcore.version>
    <httpcore-nio.version>4.4.4</httpcore-nio.version>
    <httpmime.version>4.5.2</httpmime.version>
    <jaxen.version>1.1.6</jaxen.version>
    <jdom2.version>2.0.5</jdom2.version>
    <joda-time.version>2.5</joda-time.version>
    <jsonld.version>0.5.1</jsonld.version>
    <jsoup.version>1.8.3</jsoup.version>
    <marmotta.version>3.3.0</marmotta.version>
    <semargl.version>0.6.1</semargl.version>
    <sesame.version>2.7.13</sesame.version>
    <thrift.version>0.9.2</thrift.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-indexing-triplestore</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-indexing-triplestore-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-indexing-solr</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-indexing-solr-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-reindexing</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-reindexing-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-fixity</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-fixity-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-audit-triplestore</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-audit-triplestore-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-serialization</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-serialization-blueprint</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-service-camel</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.camel</groupId>
      <artifactId>fcrepo-service-activemq</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>


    <!-- Testing & Camel Plugin -->
    <dependency>
      <groupId>org.glassfish.hk2.external</groupId>
      <artifactId>javax.inject</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.fcrepo.client</groupId>
      <artifactId>fcrepo-java-client</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.httpcomponents</groupId>
      <artifactId>httpclient</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-container-karaf</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.ops4j.pax.exam</groupId>
      <artifactId>pax-exam-junit4</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.karaf</groupId>
      <artifactId>apache-karaf</artifactId>
      <type>zip</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-karaf</artifactId>
      <type>xml</type>
      <classifier>features</classifier>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.apache.camel.karaf</groupId>
      <artifactId>apache-camel</artifactId>
      <type>xml</type>
      <classifier>features</classifier>
      <scope>test</scope>
    </dependency>

  </dependencies>

  <build>
    <defaultGoal>install</defaultGoal>

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/features.xml</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/features.xml</exclude>
        </excludes>
      </resource>
    </resources>

    <plugins>

      <!-- pax exam -->
      <plugin>
       <groupId>org.ops4j.pax.exam</groupId>
       <artifactId>maven-paxexam-plugin</artifactId>
       <version>${paxexam.plugin.version}</version>
       <executions>
         <execution>
           <id>generate-config</id>
           <goals>
             <goal>generate-depends-file</goal>
           </goals>
         </execution>
       </executions>
     </plugin>

      <!-- reserve network ports for integration testing -->
      <!-- add configuration file to artifact set for OSGi deployment -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <configuration>
          <portNames>
            <portName>fcrepo.dynamic.test.port</portName>
            <portName>fcrepo.dynamic.jms.port</portName>
            <portName>fcrepo.dynamic.stomp.port</portName>
            <portName>fcrepo.dynamic.reindexing.port</portName>
            <portName>karaf.rmiRegistry.port</portName>
            <portName>karaf.rmiServer.port</portName>
            <portName>karaf.ssh.port</portName>
            <portName>jetty.dynamic.stop.port</portName>
          </portNames>
        </configuration>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.outputDirectory}/features.xml</file>
                  <type>xml</type>
                  <classifier>features</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- integration testing -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <forkCount>3</forkCount>
          <reuseForks>false</reuseForks>
          <argLine>-Xmx1024m</argLine>
          <systemPropertyVariables>
            <fcrepo.dynamic.reindexing.port>${fcrepo.dynamic.reindexing.port}</fcrepo.dynamic.reindexing.port>
            <fcrepo.dynamic.stomp.port>${fcrepo.dynamic.stomp.port}</fcrepo.dynamic.stomp.port>
            <fcrepo.dynamic.test.port>${fcrepo.dynamic.test.port}</fcrepo.dynamic.test.port>
            <fcrepo.dynamic.jms.port>${fcrepo.dynamic.jms.port}</fcrepo.dynamic.jms.port>
            <project.version>${project.version}</project.version>
            <karaf.ssh.port>${karaf.ssh.port}</karaf.ssh.port>
            <karaf.rmiRegistry.port>${karaf.rmiRegistry.port}</karaf.rmiRegistry.port>
            <karaf.rmiServer.port>${karaf.rmiServer.port}</karaf.rmiServer.port>
          </systemPropertyVariables>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <!-- Launch jetty for integration testing with fedora -->
      <plugin>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <systemProperties>
            <force>true</force>
            <systemProperty>
              <name>fcrepo.home</name>
              <value>${project.build.directory}/fcrepo-data</value>
            </systemProperty>
            <systemProperty>
              <name>fcrepo.dynamic.jms.port</name>
              <value>${fcrepo.dynamic.jms.port}</value>
            </systemProperty>
            <systemProperty>
              <name>fcrepo.dynamic.stomp.port</name>
              <value>${fcrepo.dynamic.stomp.port}</value>
            </systemProperty>
            <systemProperty>
              <name>fcrepo.modeshape.configuration</name>
              <value>classpath:/config/file-simple/repository.json</value>
            </systemProperty>
          </systemProperties>
          <scanIntervalSeconds>10</scanIntervalSeconds>
          <stopKey>STOP</stopKey>
          <stopPort>${jetty.dynamic.stop.port}</stopPort>
          <daemon>true</daemon>
        </configuration>
        <executions>
          <execution>
            <id>start-jetty</id>
            <phase>pre-integration-test</phase>
            <goals>
              <goal>stop</goal>
              <goal>start</goal>
            </goals>
            <configuration>
            	  <jettyXml>${project.build.directory}/test-classes/jetty-test.xml</jettyXml>
              <httpConnector>
                <port>${fcrepo.dynamic.test.port}</port>
              </httpConnector>
              <scanIntervalSeconds>0</scanIntervalSeconds>
              <daemon>true</daemon>
              <contextHandlers>
                <contextHandler implementation="org.eclipse.jetty.maven.plugin.JettyWebAppContext">
                  <war>${project.build.directory}/fcrepo.war</war>
                  <contextPath>/fcrepo</contextPath>
                </contextHandler>
              </contextHandlers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>com.github.github</groupId>
        <artifactId>site-maven-plugin</artifactId>
      </plugin>

      <plugin>
        <artifactId>maven-site-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>

      <!-- enable checkstyle plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
      </plugin>

      <!-- to generate the MANIFEST-FILE of the bundle -->
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
      </plugin>

        <!--Bring in fcrepo webapp for integration testing-->
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <executions>
            <execution>
              <id>copy</id>
              <phase>package</phase>
              <goals>
                <goal>copy</goal>
              </goals>
              <configuration>
                <artifactItems>
                  <artifactItem>
                    <groupId>org.fcrepo</groupId>
                    <artifactId>fcrepo-webapp</artifactId>
                    <version>${fcrepo.version}</version>
                    <type>war</type>
                    <outputDirectory>${project.build.directory}</outputDirectory>
                    <destFileName>fcrepo.war</destFileName>
                  </artifactItem>
                </artifactItems>
              </configuration>
            </execution>
          </executions>
        </plugin>

    </plugins>
  </build>

</project>
