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

<!-- ====================================================================== -->
<!--                                                                        -->
<!--  JBoss, the OpenSource J2EE webOS                                      -->
<!--                                                                        -->
<!--  Distributable under LGPL license.                                     -->
<!--  See terms of license at http://www.gnu.org.                           -->
<!--                                                                        -->
<!-- ====================================================================== -->

<!-- $Id: pom.xml 3010 2008-11-20 08:30:16Z tom.baeyens@jboss.com $ -->
<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">

  <!-- Module Info -->
  <modelVersion>4.0.0</modelVersion>
  <name>jBPM 4 - TEST-UPGRADE</name>
  <groupId>org.jbpm.jbpm4</groupId>
  <artifactId>jbpm-test-upgrade</artifactId>
  <packaging>jar</packaging>

  <!-- Parent -->
  <parent>
    <groupId>org.jbpm.jbpm4</groupId>
    <artifactId>jbpm</artifactId>
    <version>4.3</version>
    <relativePath>../../pom.xml</relativePath>
  </parent>

  <dependencies>
  	<dependency>
      <groupId>org.jbpm.jbpm4</groupId>
      <artifactId>jbpm-jpdl</artifactId>
    </dependency>
    <dependency>
      <groupId>hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>${hsqldb.version}</version>
    </dependency>
  </dependencies>
  
  <profiles>

    <!-- -Ddatabase= -->
    <profile>
      <id>run.database.upgrade.testsuite</id>
      <activation>
        <property>
          <name>database</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>database-test-cfg-customization</id>
                <!-- Replace the hibernate config during test compilation -->
                <phase>test-compile</phase>
                <goals>
                  <goal>run</goal>
                </goals>
                <configuration>
                  <tasks>
                    <echo message="Creating test-upgrade cfg for database: ${database}" />
                    <mkdir dir="target/jdbc.properties" />
                    <copy todir="target/jdbc.properties" overwrite="true">
                      <fileset dir="../../qa/jdbc" />
                    </copy>
                    <copy todir="target/jdbc.properties" overwrite="true" failonerror="false">
                      <fileset dir="${user.home}/.jbpm4/jdbc" />
                    </copy>
                    
                    <replace dir="target/jdbc.properties">
                      <include name="*.properties" />
                      <replacefilter token="PVM1" value="PVM2" />
                      <replacefilter token="pvm1" value="pvm2" />
                    </replace>
                    
                    <ant antfile="../distro/src/main/files/install/build.xml" target="create.cfg">
                      <property name="tx" value="standalone.testsuite" />
                      <property name="mail.cfg" value="testsuite" />
                      <property name="database" value="${database}" />
                      <property name="cfg.dest.dir" value="target/test-classes" />
                      <property name="install.src.dir" value="../distro/src/main/files/install/src" />
                      <property name="jdbc.properties.dir" value="target/jdbc.properties" />
                      <property name="logging" value="none" /> <!-- then the original logging.properties in the resources of this project will be used -->
                    </ant> 
                  </tasks>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
  

</project>
