[jbpm-commits] JBoss JBPM SVN: r5779 - in jbpm4/trunk: modules/distro and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Oct 23 11:45:20 EDT 2009


Author: tom.baeyens at jboss.com
Date: 2009-10-23 11:45:19 -0400 (Fri, 23 Oct 2009)
New Revision: 5779

Added:
   jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java
   jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/
   jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/hsqldb.properties
   jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/mysql.properties
   jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/oracle.properties
   jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/postgresql.properties
Removed:
   jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
Modified:
   jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
   jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
   jbpm4/trunk/modules/distro/pom.xml
   jbpm4/trunk/modules/distro/src/main/files/install/build.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
   jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
   jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
   jbpm4/trunk/modules/test-upgrade/pom.xml
   jbpm4/trunk/qa/build.xml
Log:
JBPM-2509 database upgrade ci scripts

Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -22,23 +22,29 @@
 package org.jbpm.db;
 
 import org.hibernate.classic.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
 import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.id.PropertyImpl;
 
 /**
  * @author Alejandro Guizar
  */
-public class Create extends HibernateOperation {
+public class Create  extends DbOperation implements Command<Object> {
 
+  private static final long serialVersionUID = 1L;
+
   public static void main(String[] args) {
     Create createOperation = new Create();
     createOperation.parseArgs(args);
     executeInTransaction(createOperation);
   }
 
-  public void execute(Session session) {
+  public Object execute(Environment environment) throws Exception {
+    Session session = environment.get(Session.class);
     executeSqlResource("create/jbpm."+database+".create.sql", session);
     PropertyImpl.createProperties(session);
+    return null;
   }
   
   public String toString() {

Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java (from rev 5778, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java	                        (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -0,0 +1,134 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.db;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.classic.Session;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.internal.log.Jdk14LogFactory;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
+import org.jbpm.pvm.internal.util.IoUtil;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class DbOperation {
+
+  static{
+    Jdk14LogFactory.initializeJdk14Logging(); 
+  }
+
+  String database;
+  String delimiter;
+  
+  public void parseArgs(String[] args) {
+    if (args==null || args.length==0) {
+      log("Syntax: java -cp ... "+getClass().getName()+" database [delimiter]"); 
+      log("where database is one of {oracle, postgresql, mysql, hsqldb}"); 
+      log("and delimiter is the db sql delimiter.  default delimiter is ;");
+      return;
+    }
+
+    database = args[0];
+
+    delimiter = ";";
+    if (args.length>1) {
+      delimiter = args[1];
+    }
+  }
+  
+  public static void executeInTransaction(Command<Object> command) {
+    log("Starting "+command);
+
+    ProcessEngine processEngine = new ProcessEngineImpl()
+      .skipDbCheck()
+      .buildProcessEngine();
+
+    try {
+      processEngine.execute(command);
+      log(command+" completed successfully.");
+
+    } catch (Exception e) {
+      log("ERROR: "+command+" FAILED:");
+      e.printStackTrace();
+
+    } finally {
+      processEngine.close();
+    }
+  }
+  
+  public void executeSqlResource(String resource, Session session) {
+    InputStream stream = Upgrade.class.getClassLoader().getResourceAsStream(resource);
+    if (stream == null) {
+      throw new JbpmException("resource "+resource+" does not exist");
+    }
+
+    byte[] bytes = IoUtil.readBytes(stream);
+    String fileContents = new String(bytes);
+    List<String> commands = extractCommands(fileContents);
+    
+    log("--- Executing DB Commands -------------------------");
+    for (String command: commands) {
+      log(command);
+      try {
+        int result = session.createSQLQuery(command).executeUpdate();
+        log("--- Result: "+result+" --------------------------");
+      } catch (Exception e) {
+        e.printStackTrace();
+        log("-----------------------------------------------");
+      }
+    }
+  }
+
+  public List<String> extractCommands(String fileContents) {
+    List<String> commands = new ArrayList<String>();
+    int i = 0;
+    while (i<fileContents.length()) {
+      int j = fileContents.indexOf(delimiter, i);
+      if (j==-1) {
+        j = fileContents.length();
+      } else {
+        j += delimiter.length();
+      }
+      String command = fileContents.substring(i, j).trim();
+      if ( "oracle".equals(database)
+           && command.endsWith(";")
+         ) {
+        command = command.substring(0, command.length()-1);
+      }
+      if (command.length()>0) {
+        commands.add(command);
+      }
+      i = j;
+    }
+    return commands;
+  }
+
+  public static void log(String msg) {
+    System.out.println(msg);
+  }
+}


Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/HibernateOperation.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -1,148 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.db;
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.SessionFactory;
-import org.hibernate.Transaction;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.classic.Session;
-import org.jbpm.api.JbpmException;
-import org.jbpm.internal.log.Jdk14LogFactory;
-import org.jbpm.pvm.internal.util.IoUtil;
-
-/**
- * @author Tom Baeyens
- */
-public abstract class HibernateOperation {
-
-  static{
-    Jdk14LogFactory.initializeJdk14Logging(); 
-  }
-
-  String database;
-  String delimiter;
-  
-  public abstract void execute(Session session);
-  
-  public void parseArgs(String[] args) {
-    if (args==null || args.length==0) {
-      log("Syntax: java -cp ... "+getClass().getName()+" database [delimiter]"); 
-      log("where database is one of {oracle, postgresql, mysql, hsqldb}"); 
-      log("and delimiter is the db sql delimiter.  default delimiter is ;");
-      return;
-    }
-
-    database = args[0];
-
-    delimiter = ";";
-    if (args.length>1) {
-      delimiter = args[1];
-    }
-  }
-  
-  public static void executeInTransaction(HibernateOperation hibernateOperation) {
-    log("Starting "+hibernateOperation);
-    log("  database : "+hibernateOperation.database);
-    log("  delimiter: "+hibernateOperation.delimiter);
-
-    SessionFactory sessionFactory = new Configuration()
-      .configure("jbpm.hibernate.cfg.xml")
-      .buildSessionFactory();
-
-    Session session = sessionFactory.openSession();
-    Transaction transaction = null;
-    try {
-      transaction = session.beginTransaction();
-
-      hibernateOperation.execute(session);
-
-      transaction.commit();
-      
-      log(hibernateOperation+" completed successfully.");
-
-    } catch (Exception e) {
-      if (transaction!=null){
-        transaction.rollback();
-      }
-      log("ERROR: "+hibernateOperation+" FAILED:");
-      e.printStackTrace();
-
-    } finally {
-      session.close();
-    }
-  }
-  
-  public void executeSqlResource(String resource, Session session) {
-    InputStream stream = Upgrade.class.getClassLoader().getResourceAsStream(resource);
-    if (stream == null) {
-      throw new JbpmException("resource "+resource+" does not exist");
-    }
-
-    byte[] bytes = IoUtil.readBytes(stream);
-    String fileContents = new String(bytes);
-    List<String> commands = extractCommands(fileContents);
-    
-    log("--- Executing DB Commands -------------------------");
-    for (String command: commands) {
-      log(command);
-      try {
-        int result = session.createSQLQuery(command).executeUpdate();
-        log("--- Result: "+result+" --------------------------");
-      } catch (Exception e) {
-        e.printStackTrace();
-        log("-----------------------------------------------");
-      }
-    }
-  }
-
-  public List<String> extractCommands(String fileContents) {
-    List<String> commands = new ArrayList<String>();
-    int i = 0;
-    while (i<fileContents.length()) {
-      int j = fileContents.indexOf(delimiter, i);
-      if (j==-1) {
-        j = fileContents.length();
-      } else {
-        j += delimiter.length();
-      }
-      String command = fileContents.substring(i, j).trim();
-      if ( "oracle".equals(database)
-           && command.endsWith(";")
-         ) {
-        command = command.substring(0, command.length()-1);
-      }
-      if (command.length()>0) {
-        commands.add(command);
-      }
-      i = j;
-    }
-    return commands;
-  }
-
-  public static void log(String msg) {
-    System.out.println(msg);
-  }
-}

Modified: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -27,6 +27,8 @@
 import org.hibernate.classic.Session;
 import org.hibernate.criterion.Restrictions;
 import org.jbpm.api.JbpmException;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
 import org.jbpm.jpdl.internal.xml.JpdlParser;
 import org.jbpm.pvm.internal.id.PropertyImpl;
 import org.jbpm.pvm.internal.repository.DeploymentImpl;
@@ -35,19 +37,22 @@
 /**
  * @author Alejandro Guizar
  */
-public class Upgrade extends HibernateOperation {
+public class Upgrade extends DbOperation implements Command<Object> {
 
+  private static final long serialVersionUID = 1L;
+
   public static void main(String[] args) {
     Upgrade upgradeOperation = new Upgrade();
     upgradeOperation.parseArgs(args);
-    HibernateOperation.executeInTransaction(upgradeOperation);
+    DbOperation.executeInTransaction(upgradeOperation);
   }
 
   public String toString() {
     return "DB Upgrade to jBPM " + JpdlParser.CURRENT_VERSION_JBPM;
   }
 
-  public void execute(Session session) {
+  public Object execute(Environment environment) throws Exception {
+    Session session = environment.get(Session.class);
     JbpmVersion jbpmVersion = getJbpmVersion(session);
 
     if (jbpmVersion == JbpmVersion.V_4_2) {
@@ -61,6 +66,7 @@
     if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
       upgrade41To42(session);
     }
+    return null;
   }
 
   private void upgrade40To41(Session session) {
@@ -69,8 +75,8 @@
 
   private void upgrade41To42(Session session) {
     executeSqlResource("upgrade-4.1-to-4.2/jbpm." + database + ".upgrade.sql", session);
+    PropertyImpl.upgradeProperties(session);
     addLangId(session);
-    PropertyImpl.upgradeProperties(session);
   }
 
   private void addLangId(Session session) {
@@ -81,7 +87,8 @@
 
     for (DeploymentProperty deploymentProperty : deploymentProperties) {
       String objectName = deploymentProperty.getObjectName();
-      deploymentProperty.getDeployment().setProcessLanguageId(objectName, "jpdl-4.0");
+      DeploymentImpl deployment = deploymentProperty.getDeployment();
+      deployment.setProcessLanguageId(objectName, "jpdl-4.0");
     }
   }
 

Modified: jbpm4/trunk/modules/distro/pom.xml
===================================================================
--- jbpm4/trunk/modules/distro/pom.xml	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/distro/pom.xml	2009-10-23 15:45:19 UTC (rev 5779)
@@ -159,11 +159,6 @@
       <groupId>org.freemarker</groupId>
       <artifactId>freemarker</artifactId>
     </dependency>
-    <dependency>
-      <groupId>xerces</groupId>
-      <artifactId>xercesImpl</artifactId>
-      <version>2.9.1</version>
-    </dependency>
     
     <!-- Database Drivers -->
     <dependency>

Modified: jbpm4/trunk/modules/distro/src/main/files/install/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/build.xml	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/distro/src/main/files/install/build.xml	2009-10-23 15:45:19 UTC (rev 5779)
@@ -585,7 +585,10 @@
           depends="create.cfg"
           description="creates the jbpm tables in the database">
     <echo message="creating jbpm schema..." />
-    <java classname="org.jbpm.db.Create">
+    <copy tofile="${cfg.dest.dir}/jbpm.cfg.xml" 
+          file="${install.src.dir}/cfg/jbpm/standalone.testsuite.jbpm.cfg.xml"
+          overwrite="true" />
+    <java classname="org.jbpm.db.Create" fork="true">
       <arg line="${database}" />
       <classpath>
         <pathelement location="${jbpm.home}/install/generated/cfg" />
@@ -605,7 +608,10 @@
   	      depends="create.cfg"
           description="Upgrades the jBPM tables in the database to the current version">
     <echo message="upgrading jbpm schema..." />
-    <java classname="org.jbpm.db.Upgrade">
+    <copy tofile="${cfg.dest.dir}/jbpm.cfg.xml" 
+          file="${install.src.dir}/cfg/jbpm/standalone.testsuite.jbpm.cfg.xml"
+          overwrite="true" />
+    <java classname="org.jbpm.db.Upgrade" fork="true">
     	<arg line="${database}" />
       <classpath>
       	<pathelement location="${jbpm.home}/install/generated/cfg" />

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -105,6 +105,7 @@
   public static void upgradeProperties(Session session) {
     setDbVersionToLibraryVersion(session);
     long nextDbid = getMaxDbid(session)+1;
+    log.info("nextDbid is initialized to "+nextDbid);
     setNextDbid(session, nextDbid);
   }
 
@@ -144,8 +145,8 @@
     for (String persistedType: persistedTypes) {
       try {
         Long typeMaxDbid = (Long) session.createQuery(
-                "select max(id) " +
-                "from "+persistedType
+                "select max(o.dbid) " +
+                "from "+persistedType+" as o"
             ).uniqueResult();
         
         if ( (typeMaxDbid!=null)
@@ -154,10 +155,11 @@
           maxDbid = typeMaxDbid.longValue();
         }
       } catch (Exception e) {
-        log.info("couldn't get max dbid for "+persistedType);
+        log.info("couldn't get max dbid for "+persistedType, e);
+        e.printStackTrace();
       }
     }
-
+    
     return maxDbid;
   }
 

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -226,7 +226,6 @@
     setObjectProperty(processDefinitionName, KEY_PROCESS_LANGUAGE_ID, processLanguageId);
   }
 
-
   public void setObjectProperty(String objectName, String key, Object value) {
     if (objectProperties==null) {
       objectProperties = new HashSet<DeploymentProperty>();

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -23,7 +23,9 @@
 
 import java.io.Serializable;
 
+import org.hibernate.Session;
 import org.jbpm.api.JbpmException;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
 import org.jbpm.pvm.internal.id.DbidGenerator;
 
 
@@ -46,6 +48,7 @@
   
   public DeploymentProperty(DeploymentImpl deployment, String objectName, String key) {
     this.dbid = DbidGenerator.getDbidGenerator().getNextId();
+    EnvironmentImpl.getFromCurrent(Session.class).save(this);
     this.deployment = deployment;
     this.objectName = objectName;
     this.key = key;

Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml	2009-10-23 15:45:19 UTC (rev 5779)
@@ -18,7 +18,7 @@
 
     <hibernate-session-factory />
     
-    <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator" init="eager">
+    <object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
       <field name="commandService"><ref object="newTxRequiredCommandService" /></field>
       <invoke method="initialize" />
     </object>

Modified: jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java	2009-10-23 15:45:19 UTC (rev 5779)
@@ -42,6 +42,8 @@
   public void testDbidGenerator() {
     ProcessEngine processEngine = new Configuration().buildProcessEngine();
     
+    DbidGenerator dbidGenerator = processEngine.get(DbidGenerator.class);
+    
     processEngine.execute(new Command<Void>() {
       private static final long serialVersionUID = 1L;
       public Void execute(Environment environment) throws Exception {
@@ -54,7 +56,6 @@
       }
     });
     
-    DbidGenerator dbidGenerator = processEngine.get(DbidGenerator.class);
     for (int i=1; i<10020; i++) {
       assertEquals(i, dbidGenerator.getNextId());
       if ((i%1000) == 0) {

Modified: jbpm4/trunk/modules/test-upgrade/pom.xml
===================================================================
--- jbpm4/trunk/modules/test-upgrade/pom.xml	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/modules/test-upgrade/pom.xml	2009-10-23 15:45:19 UTC (rev 5779)
@@ -32,7 +32,6 @@
   	<dependency>
       <groupId>org.jbpm.jbpm4</groupId>
       <artifactId>jbpm-jpdl</artifactId>
-      <version>4.2-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>hsqldb</groupId>

Added: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/hsqldb.properties
===================================================================
--- jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/hsqldb.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/hsqldb.properties	2009-10-23 15:45:19 UTC (rev 5779)
@@ -0,0 +1 @@
+hibernate.dialect=org.hibernate.dialect.HSQLDialect


Property changes on: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/hsqldb.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/mysql.properties
===================================================================
--- jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/mysql.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/mysql.properties	2009-10-23 15:45:19 UTC (rev 5779)
@@ -0,0 +1 @@
+hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect


Property changes on: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/mysql.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/oracle.properties
===================================================================
--- jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/oracle.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/oracle.properties	2009-10-23 15:45:19 UTC (rev 5779)
@@ -0,0 +1 @@
+hibernate.dialect=org.hibernate.dialect.Oracle10gDialect


Property changes on: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/oracle.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/postgresql.properties
===================================================================
--- jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/postgresql.properties	                        (rev 0)
+++ jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/postgresql.properties	2009-10-23 15:45:19 UTC (rev 5779)
@@ -0,0 +1 @@
+hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect


Property changes on: jbpm4/trunk/modules/test-upgrade/src/main/resources/dialect/postgresql.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml	2009-10-23 11:36:57 UTC (rev 5778)
+++ jbpm4/trunk/qa/build.xml	2009-10-23 15:45:19 UTC (rev 5779)
@@ -177,6 +177,11 @@
       <replacefilter token="PVM1" value="PVM2" />
       <replacefilter token="pvm1" value="pvm2" />
     </replace>
+  	<!-- install the jbpm-test-upgrade lib -->
+    <delete dir="upgrade/target/jbpm-test-upgrade" />
+    <mkdir dir="upgrade/target/jbpm-test-upgrade" />
+    <unzip dest="upgrade/target/jbpm-test-upgrade" src="upgrade/target/jbpm-test-upgrade.jar" />
+  	<delete file="upgrade/target/jbpm-test-upgrade/hibernate.properties" />
     <!-- create jbpm schema using the old jbpm distro -->
     <condition property="is.old.jbpm.40">
       <equals arg1="${old.jbpm.version}" arg2="4.0" />
@@ -184,11 +189,7 @@
     <antcall target="create.jbpm.schema.in.jbpm.40" />
     <antcall target="create.jbpm.schema.in.jbpm.41plus" />
   	<!-- start couple of processes using the old jbpm version -->
-    <delete dir="upgrade/target/jbpm-test-upgrade" />
-    <mkdir dir="upgrade/target/jbpm-test-upgrade" />
-  	<unzip dest="upgrade/target/jbpm-test-upgrade" src="upgrade/target/jbpm-test-upgrade.jar" />
-  	<copy file="upgrade/target/jdbc/${database}.properties" tofile="upgrade/target/jbpm-test-upgrade/hibernate.properties" overwrite="true" />
-    <java classname="org.jbpm.upgrade.BeforeUpgrade">
+    <java classname="org.jbpm.upgrade.BeforeUpgrade" fork="true">
       <classpath>
         <pathelement location="upgrade/target/jbpm-test-upgrade" />
         <fileset dir="${old.jbpm.home}">
@@ -203,7 +204,10 @@
     <copy todir="${jbpm.home}/install/jdbc" overwrite="true">
       <fileset dir="upgrade/target/jdbc" />
     </copy>
-  	<ant antfile="${jbpm.home}/install/build.xml" target="upgrade.jbpm.schema" inheritall="false" />
+  	<ant antfile="${jbpm.home}/install/build.xml" target="upgrade.jbpm.schema" inheritall="false">
+  		<property name="database" value="${database}" />
+      <property name="tx" value="standalone.testsuite" />
+  	</ant>
   </target>
       
   <condition property="is.hsqldb">
@@ -240,16 +244,27 @@
   </target>
 
   <target name="create.jbpm.schema.in.jbpm.40" if="is.old.jbpm.40">
+    <echo message="creating schema in jbpm 4.0" />
     <!-- copy the PVM2 jdbc properties files in the old jbpm distro -->
     <copy todir="${old.jbpm.home}/db/jdbc">
       <fileset dir="upgrade/target/jdbc" />
     </copy>
+  	<replace file="upgrade/target/jbpm-test-upgrade/jbpm.cfg.xml">
+  		<replacetoken><![CDATA[<import resource="jbpm.businesscalendar.cfg.xml" />]]></replacetoken>
+  		<replacevalue></replacevalue>
+  	</replace>
   	<ant antfile="${old.jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false">
   		<property name="database" value="${database}" />
   	</ant>
+    <copy file="${old.jbpm.home}/db/hibernate.cfg/${database}.hibernate.cfg.xml" 
+    	    tofile="upgrade/target/jbpm-test-upgrade/jbpm.hibernate.cfg.xml" 
+    	    overwrite="true">
+    	<filterset filtersfile="upgrade/target/jdbc/${database}.properties" />
+    </copy>
   </target>
 
   <target name="create.jbpm.schema.in.jbpm.41plus" unless="is.old.jbpm.40">
+  	<echo message="creating schema in jbpm 4.1+" />
     <!-- copy the PVM2 jdbc properties files in the old jbpm distro -->
     <copy todir="${old.jbpm.home}/install/jdbc">
       <fileset dir="upgrade/target/jdbc" />
@@ -257,6 +272,11 @@
     <ant antfile="${old.jbpm.home}/install/build.xml" target="create.jbpm.schema" inheritall="false">
       <property name="database" value="${database}" />
     </ant>
+    <copy file="${old.jbpm.home}/install/src/cfg/hibernate/jdbc/${database}.hibernate.cfg.xml" 
+          tofile="upgrade/target/jbpm-test-upgrade/jbpm.hibernate.cfg.xml" 
+          overwrite="true">
+      <filterset filtersfile="upgrade/target/jdbc/${database}.properties" />
+    </copy>
   </target>
   
   <target name="testsuite.upgrade.teardown">



More information about the jbpm-commits mailing list