<?xml version="1.0" encoding="UTF-8"?>

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  -->

<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>

<!-- ====================================================================== -->
<!-- P R O J E C T  D E S C R I P T I O N                                   -->
<!-- ====================================================================== -->
  <parent>
    <groupId>org.apache.jackrabbit</groupId>
    <artifactId>jackrabbit-parent</artifactId>
    <version>2.21.13</version>
    <relativePath>../jackrabbit-parent/pom.xml</relativePath>
  </parent>
  <artifactId>jackrabbit-core</artifactId>
  <name>Jackrabbit Core</name>
  <description>Jackrabbit content repository implementation</description>

  <properties>
    <org.apache.jackrabbit.test.integration>false</org.apache.jackrabbit.test.integration>
    <test.opts.memory>-Xmx512m</test.opts.memory>
  </properties>

  <build>
    <plugins>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>process-test-resources</id>
            <phase>process-test-resources</phase>
            <configuration>
              <target>
                <copy todir="${project.build.directory}/repository">
                  <fileset dir="${basedir}/src/test/repository" />
                </copy>
                <copy todir="${project.build.directory}/repository-2">
                  <fileset dir="${basedir}/src/test/repository" />
                </copy>
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <includes>
            <include>**/*TestAll.java</include>
          </includes>
          <argLine>${test.opts}</argLine>
          <systemProperties>
            <property>
              <name>java.awt.headless</name>
              <value>true</value>
            </property>
            <property>
              <name>derby.system.durability</name>
              <value>test</value>
            </property>
            <property>
              <name>derby.storage.fileSyncTransactionLog</name>
              <value>true</value>
            </property>
            <property>
              <name>derby.stream.error.file</name>
              <value>target/derby.log</value>
            </property>
            <property>
              <name>org.apache.jackrabbit.repository.home</name>
              <value>target/repository-factory-test</value>
            </property>
            <property>
              <name>known.issues</name>
              <value>
org.apache.jackrabbit.core.ConcurrentImportTest
org.apache.jackrabbit.core.xml.DocumentViewTest#testMultiValue
org.apache.jackrabbit.core.NodeImplTest#testReferentialIntegrityCorruptionGetPath
org.apache.jackrabbit.core.integration.ConcurrentQueryTest#testConcurrentQueryWithDeletes
org.apache.jackrabbit.test.api.ShareableNodeTest#testGetName
org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNode
org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodes
org.apache.jackrabbit.test.api.ShareableNodeTest#testGetNodesByPattern
org.apache.jackrabbit.test.api.ShareableNodeTest#testMoveShareableNode<!--JCR-3381-->
org.apache.jackrabbit.test.api.ShareableNodeTest#testTransientMoveShareableNode<!--JCR-3381-->
org.apache.jackrabbit.test.api.lock.OpenScopedLockTest#testLockExpiration
org.apache.jackrabbit.test.api.lock.SessionScopedLockTest#testLockExpiration
org.apache.jackrabbit.test.api.observation.NodeReorderTest#testNodeReorderMove
org.apache.jackrabbit.core.data.ConcurrentGcTest#testDatabases
org.apache.jackrabbit.core.data.GarbageCollectorTest#testCloseSessionWhileRunningGc
org.apache.jackrabbit.core.data.GarbageCollectorTest#testSimultaneousRunGC <!-- JCR-4078 -->
org.apache.jackrabbit.core.ReplacePropertyWhileOthersReadTest <!-- JCR-3835 -->
org.apache.jackrabbit.core.security.user.MembershipCachePerfTest <!-- don't run expensive test -->
org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testStringLiteralInvalidName        <!-- OAK-3265 -->
org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testPathLiteral                     <!-- OAK-3265 -->
org.apache.jackrabbit.test.api.query.qom.NodeLocalNameTest#testURILiteral                      <!-- OAK-3265 -->
              </value>
            </property>
            <property>
              <name>org.apache.jackrabbit.test.integration</name>
              <value>${org.apache.jackrabbit.test.integration}</value>
            </property>
          </systemProperties>
        </configuration>
        <executions>
          <execution>
            <id>do_test</id>
            <phase>integration-test</phase>
            <configuration>
              <includes>
                <include>**/integration/*Test.java</include>
              </includes>
            </configuration>
            <goals>
              <goal>test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.rat</groupId>
        <artifactId>apache-rat-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>src/main/javadoc/**/*.uxf</exclude>
            <exclude>src/test/repository/**</exclude>
            <exclude>src/test/resources/**/*.txt</exclude>
            <exclude>src/test/resources/**/*.rtf</exclude>
            <exclude>src/test/resources/**/*.cnd</exclude>
            <exclude>src/test/compatibility/**/target/**</exclude>
            <exclude>src/test/compatibility/**/.*/**</exclude>
            <exclude>src/test/compatibility/repositories.zip</exclude>
            <exclude>repository/**</exclude>
            <exclude>*.log</exclude>
          </excludes>
        </configuration>
      </plugin>
     <plugin>
       <groupId>org.apache.maven.plugins</groupId>
       <artifactId>maven-jar-plugin</artifactId>
       <configuration>
          <excludes>
            <exclude>logback-test.xml</exclude>
          </excludes>
       </configuration>
       <executions>
         <execution>
           <goals>
             <goal>test-jar</goal>
           </goals>
         </execution>
       </executions>
     </plugin>
    </plugins>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
      <resource>
        <directory>src/main/resources-filtered</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
    <pluginManagement>
      <plugins>
        <!-- JCR-3136: Add m2e lifecycle mappings for Eclipse Indigo -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <versionRange>[3,)</versionRange>
                    <goals>
                      <goal>run</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore />
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <dependencies>
    <dependency>
      <groupId>concurrent</groupId>
      <artifactId>concurrent</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.4</version>
    </dependency>
    <dependency>
      <groupId>javax.jcr</groupId>
      <artifactId>jcr</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-jackrabbit-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-commons</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-data</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.jackrabbit</groupId>
        <artifactId>jackrabbit-data</artifactId>
        <version>${project.version}</version>
        <type>test-jar</type>
        <scope>test</scope>
    </dependency>  
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-spi-commons</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-spi</artifactId>
      <version>${project.version}</version>
      <classifier />
    </dependency>
      <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-spi</artifactId>
      <version>${project.version}</version>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.lucene</groupId>
      <artifactId>lucene-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-tests</artifactId>
      <version>${project.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-benchmark</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.tika</groupId>
      <artifactId>tika-parsers-standard-package</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.transaction</groupId>
      <artifactId>javax.transaction-api</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.h2database</groupId>
      <artifactId>h2</artifactId>
      <version>2.1.214</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>integrationTesting</id>
      <properties>
        <org.apache.jackrabbit.test.integration>true</org.apache.jackrabbit.test.integration>
      </properties>
    </profile>
    <!--
      These profiles can be used to run the (integration) tests against different DB backends.
      For instance, if you want to run the integration tests against MySQL backend, do:

        mvn clean integration-test -Pmysql,use-descriptor-overlay

      Note: the ${config.db.name} database is dropped and re-created in the clean phase. 
    -->
    <profile>
      <id>mysql</id>
      <properties>
        <config.db.name>jackrabbit</config.db.name>
        <config.db.fsclass>org.apache.jackrabbit.core.fs.db.DbFileSystem</config.db.fsclass>
        <config.db.dsclass>org.apache.jackrabbit.core.data.db.DbDataStore</config.db.dsclass>
        <config.db.pmclass>org.apache.jackrabbit.core.persistence.pool.MySqlPersistenceManager</config.db.pmclass>
        <config.db.journalclass>org.apache.jackrabbit.core.journal.DatabaseJournal</config.db.journalclass>
        <config.db.schema>mysql</config.db.schema>
        <config.db.validation.query>select 1</config.db.validation.query>
        <config.db.user>user</config.db.user>
        <config.db.pwd>pwd</config.db.pwd>
        <config.db.driver>com.mysql.jdbc.Driver</config.db.driver>
        <config.db.url>jdbc:mysql://localhost:3306/${config.db.name}?autoReconnect=true</config.db.url>
        <config.db.metaurl>jdbc:mysql://localhost:3306/mysql?autoReconnect=true</config.db.metaurl>
        <config.db.dropcommand>drop database ${config.db.name}</config.db.dropcommand>
        <config.db.createcommand>create database ${config.db.name}</config.db.createcommand>
      </properties>
    </profile>
    <profile>
      <id>mssql</id>
      <properties>
        <config.db.name>jackrabbit</config.db.name>
        <config.db.fsclass>org.apache.jackrabbit.core.fs.db.MSSqlFileSystem</config.db.fsclass>
        <config.db.dsclass>org.apache.jackrabbit.core.data.db.DbDataStore</config.db.dsclass>
        <config.db.pmclass>org.apache.jackrabbit.core.persistence.pool.MSSqlPersistenceManager</config.db.pmclass>
        <config.db.journalclass>org.apache.jackrabbit.core.journal.MSSqlDatabaseJournal</config.db.journalclass>
        <config.db.schema>mssql</config.db.schema>
        <config.db.validation.query>select 1</config.db.validation.query>
        <config.db.user>user</config.db.user>
        <config.db.pwd>pwd</config.db.pwd>
        <config.db.driver>net.sourceforge.jtds.jdbc.Driver</config.db.driver>
        <config.db.url>jdbc:jtds:sqlserver://localhost:2433/${config.db.name}</config.db.url>
        <config.db.metaurl>jdbc:jtds:sqlserver://localhost:2433/master</config.db.metaurl>
        <config.db.dropcommand>drop database ${config.db.name}</config.db.dropcommand>
        <config.db.createcommand>create database ${config.db.name}</config.db.createcommand>
      </properties>
    </profile>
    <profile>
      <id>oracle</id>
      <properties>
        <config.db.name>unused</config.db.name>
        <config.db.fsclass>org.apache.jackrabbit.core.fs.db.OracleFileSystem</config.db.fsclass>
        <config.db.dsclass>org.apache.jackrabbit.core.data.db.DbDataStore</config.db.dsclass>
        <config.db.pmclass>org.apache.jackrabbit.core.persistence.pool.OraclePersistenceManager</config.db.pmclass>
        <config.db.journalclass>org.apache.jackrabbit.core.journal.OracleDatabaseJournal</config.db.journalclass>
        <config.db.schema>oracle</config.db.schema>
        <config.db.validation.query>select 'validationQuery' from dual</config.db.validation.query>
        <config.db.user>user</config.db.user>
        <config.db.pwd>password</config.db.pwd>
        <config.db.driver>oracle.jdbc.driver.OracleDriver</config.db.driver>
        <config.db.url>jdbc:oracle:thin:@localhost:1521:xe</config.db.url>
        <config.db.metaurl>unused</config.db.metaurl>
        <config.db.dropcommand>unused</config.db.dropcommand>
        <config.db.createcommand>unused</config.db.createcommand>
      </properties>
    </profile>
    <profile>
      <id>h2</id>
      <properties>
        <config.db.name>jackrabbit</config.db.name>
        <config.db.fsclass>org.apache.jackrabbit.core.fs.db.DbFileSystem</config.db.fsclass>
        <config.db.dsclass>org.apache.jackrabbit.core.data.db.DbDataStore</config.db.dsclass>
        <config.db.pmclass>org.apache.jackrabbit.core.persistence.pool.H2PersistenceManager</config.db.pmclass>
        <config.db.journalclass>org.apache.jackrabbit.core.journal.DatabaseJournal</config.db.journalclass>
        <config.db.schema>h2</config.db.schema>
        <config.db.validation.query>call 1</config.db.validation.query>
        <config.db.user>sa</config.db.user>
        <config.db.pwd>sa</config.db.pwd>
        <config.db.driver>org.h2.Driver</config.db.driver>
        <!-- <config.db.url>jdbc:h2:~/jackrabbit2;MAX_LENGTH_INPLACE_LOB=10240;DB_CLOSE_ON_EXIT=FALSE;TRACE_LEVEL_FILE=2</config.db.url> -->
        <config.db.url>jdbc:h2:~/jackrabbit2;MAX_LENGTH_INPLACE_LOB=10240;DB_CLOSE_ON_EXIT=FALSE</config.db.url>
        <config.db.metaurl>unused</config.db.metaurl>
        <config.db.dropcommand>drop all objects delete files</config.db.dropcommand>
        <config.db.createcommand>unused</config.db.createcommand>
      </properties>
    </profile>
    <profile>
      <id>use-descriptor-overlay</id>
      <build>
      <plugins>
        <!-- Drop/create the test database on clean -->        
        <plugin>
          <groupId>org.codehaus.mojo</groupId>
          <artifactId>sql-maven-plugin</artifactId>
          <dependencies>
            <dependency>
              <groupId>mysql</groupId>
              <artifactId>mysql-connector-java</artifactId>
              <version>5.1.6</version>
              <type>jar</type>
              <scope>provided</scope>
            </dependency>
            <dependency>
              <groupId>net.sourceforge.jtds</groupId>
              <artifactId>jtds</artifactId>
              <version>1.2.2</version>
              <scope>provided</scope>
            </dependency>
          </dependencies>
          <configuration>
            <driver>${config.db.driver}</driver>
            <url>${config.db.metaurl}</url>
            <username>${config.db.user}</username>
            <password>${config.db.pwd}</password>
            <settingsKey>sensibleKey</settingsKey>
          </configuration>
          <executions>
            <execution>
              <id>drop-db</id>
              <phase>clean</phase>
              <goals>
                <goal>execute</goal>
              </goals>
              <configuration>
                <autocommit>true</autocommit>
                <sqlCommand>${config.db.dropcommand}</sqlCommand>
                <onError>continue</onError>
              </configuration>
            </execution>
            <execution>
              <id>create-db</id>
              <phase>clean</phase>
              <goals>
                <goal>execute</goal>
              </goals>
              <configuration>
                <autocommit>true</autocommit>
                <sqlCommand>${config.db.createcommand}</sqlCommand>
              </configuration>
            </execution>
          </executions>
        </plugin>
        <plugin>
          <artifactId>maven-antrun-plugin</artifactId>
          <executions>
            <execution>
              <id>overlay-repository-descriptors</id>
              <phase>process-test-resources</phase>
              <configuration>
                <target>
                  <copy todir="${project.build.directory}/repository" overwrite="true">
                    <fileset dir="${basedir}/src/test/repository-descriptor-overlay" />
                    <filterset>
                      <filter token="repo.id" value="A" />
                      <filter token="config.db.schema" value="${config.db.schema}" />
                      <filter token="config.db.validation.query" value="${config.db.validation.query}" />
                      <filter token="config.db.driver" value="${config.db.driver}" />
                      <filter token="config.db.url" value="${config.db.url}" />
                      <filter token="config.db.user" value="${config.db.user}" />
                      <filter token="config.db.pwd" value="${config.db.pwd}" />
                      <filter token="config.db.fsclass" value="${config.db.fsclass}" />
                      <filter token="config.db.dsclass" value="${config.db.dsclass}" />
                      <filter token="config.db.pmclass" value="${config.db.pmclass}" />
                      <filter token="config.db.journalclass" value="${config.db.journalclass}" />
                    </filterset>
                  </copy>
                  <copy todir="${project.build.directory}/repository-2" overwrite="true">
                    <fileset dir="${basedir}/src/test/repository-descriptor-overlay" />
                    <filterset>
                      <filter token="repo.id" value="B" />
                      <filter token="config.db.schema" value="${config.db.schema}" />
                      <filter token="config.db.validation.query" value="${config.db.validation.query}" />
                      <filter token="config.db.driver" value="${config.db.driver}" />
                      <filter token="config.db.url" value="${config.db.url}" />
                      <filter token="config.db.user" value="${config.db.user}" />
                      <filter token="config.db.pwd" value="${config.db.pwd}" />
                      <filter token="config.db.fsclass" value="${config.db.fsclass}" />
                      <filter token="config.db.dsclass" value="${config.db.dsclass}" />
                      <filter token="config.db.pmclass" value="${config.db.pmclass}" />
                      <filter token="config.db.journalclass" value="${config.db.journalclass}" />
                    </filterset>
                  </copy>
                </target>
              </configuration>
              <goals>
                <goal>run</goal>
              </goals>
            </execution>
          </executions>
        </plugin>
      </plugins>
      </build>
      <dependencies>
        <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
          <version>5.1.6</version>
          <type>jar</type>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>net.sourceforge.jtds</groupId>
          <artifactId>jtds</artifactId>
          <version>1.2.2</version>
          <scope>test</scope>
        </dependency>
        <dependency>
          <groupId>com.oracle</groupId>
          <artifactId>ojdbc14</artifactId>
          <version>10.2.0.3.0</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </profile>
  </profiles>
</project>
