[jbpm-commits] JBoss JBPM SVN: r5780 - in jbpm4/trunk: modules/db/src and 11 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Oct 23 15:27:32 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-10-23 15:27:31 -0400 (Fri, 23 Oct 2009)
New Revision: 5780
Added:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbHelper.java
jbpm4/trunk/modules/db/src/test/
jbpm4/trunk/modules/db/src/test/resources/
jbpm4/trunk/modules/db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/db/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/db/src/test/resources/logging.properties
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/
jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/logging.properties
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/QueryTest.java
Removed:
jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java
Modified:
jbpm4/trunk/modules/db/.classpath
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/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.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-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java
jbpm4/trunk/qa/build.xml
Log:
JBPM-2509 database upgrade ci scripts
Modified: jbpm4/trunk/modules/db/.classpath
===================================================================
--- jbpm4/trunk/modules/db/.classpath 2009-10-23 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/db/.classpath 2009-10-23 19:27:31 UTC (rev 5780)
@@ -1,7 +1,8 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
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 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Create.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -22,32 +22,56 @@
package org.jbpm.db;
import org.hibernate.classic.Session;
+import org.jbpm.api.ProcessEngine;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.id.PropertyImpl;
/**
* @author Alejandro Guizar
*/
-public class Create extends DbOperation implements Command<Object> {
+public class Create {
private static final long serialVersionUID = 1L;
+ private static Log log = Log.getLog(Upgrade.class.getName());
+
+ static String database;
+
public static void main(String[] args) {
- Create createOperation = new Create();
- createOperation.parseArgs(args);
- executeInTransaction(createOperation);
- }
+ if ( (args==null)
+ || (args.length!=1)
+ ) {
+ DbHelper.printSyntax(Upgrade.class);
+ return;
+ }
+
+ database = args[0];
+
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ try {
+ processEngine.execute(new Command<Object>(){
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ DbHelper.executeSqlResource("create/jbpm."+database+".create.sql", session);
+ PropertyImpl.createProperties(session);
+ return null;
+ }
+ });
- 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;
+ log.info("jBPM DB create completed successfully.");
+
+ } catch (Exception e) {
+ log.error("ERROR: jBPM DB create FAILED", e);
+
+ } finally {
+ processEngine.close();
+ }
}
-
- public String toString() {
- return "jBPM "+JpdlParser.CURRENT_VERSION_JBPM+" DB Create";
- }
}
Copied: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbHelper.java (from rev 5779, jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java)
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbHelper.java (rev 0)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbHelper.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,90 @@
+/*
+ * 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.internal.log.Jdk14LogFactory;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.IoUtil;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class DbHelper {
+
+ private static Log log = Log.getLog(DbHelper.class.getName());
+
+ public static void initializeLogging() {
+ Jdk14LogFactory.initializeJdk14Logging();
+ }
+
+ public static void printSyntax(Class<?> clazz) {
+ log.info("Syntax: java -cp ... "+clazz.getName()+" database [delimiter]");
+ log.info("where database is one of {oracle, postgresql, mysql, hsqldb}");
+ log.info("and delimiter is the db sql delimiter. default delimiter is ;");
+ }
+
+ public static 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.info("--- Executing DB Commands -------------------------");
+ for (String command: commands) {
+ log.info(command);
+ try {
+ int result = session.createSQLQuery(command).executeUpdate();
+ log.info("--- Result: "+result+" --------------------------");
+ } catch (Exception e) {
+ e.printStackTrace();
+ log.info("-----------------------------------------------");
+ }
+ }
+ }
+
+ public static List<String> extractCommands(String fileContents) {
+ List<String> commands = new ArrayList<String>();
+ int i = 0;
+ while (i<fileContents.length()) {
+ int j = fileContents.indexOf(";", i);
+ if (j==-1) {
+ j = fileContents.length();
+ }
+ String command = fileContents.substring(i, j).trim();
+ if (command.length()>0) {
+ commands.add(command);
+ }
+ i = j+1;
+ }
+ return commands;
+ }
+}
Property changes on: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbHelper.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java
===================================================================
--- jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java 2009-10-23 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/DbOperation.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -1,134 +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.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);
- }
-}
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 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/db/src/main/java/org/jbpm/db/Upgrade.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -27,9 +27,11 @@
import org.hibernate.classic.Session;
import org.hibernate.criterion.Restrictions;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.ProcessEngine;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.Environment;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.cfg.ProcessEngineImpl;
import org.jbpm.pvm.internal.id.PropertyImpl;
import org.jbpm.pvm.internal.repository.DeploymentImpl;
import org.jbpm.pvm.internal.repository.DeploymentProperty;
@@ -37,82 +39,103 @@
/**
* @author Alejandro Guizar
*/
-public class Upgrade extends DbOperation implements Command<Object> {
+public class Upgrade {
private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(Upgrade.class.getName());
+
+ static String database;
public static void main(String[] args) {
- Upgrade upgradeOperation = new Upgrade();
- upgradeOperation.parseArgs(args);
- DbOperation.executeInTransaction(upgradeOperation);
- }
-
- public String toString() {
- return "DB Upgrade to jBPM " + JpdlParser.CURRENT_VERSION_JBPM;
- }
-
- public Object execute(Environment environment) throws Exception {
- Session session = environment.get(Session.class);
- JbpmVersion jbpmVersion = getJbpmVersion(session);
-
- if (jbpmVersion == JbpmVersion.V_4_2) {
- throw new JbpmException("jBPM schema is already up to date");
+ if ( (args==null)
+ || (args.length!=1)
+ ) {
+ DbHelper.printSyntax(Upgrade.class);
+ return;
}
+
+ database = args[0];
+
+ ProcessEngine processEngine = new ProcessEngineImpl()
+ .skipDbCheck()
+ .buildProcessEngine();
+
+ try {
+ JbpmVersion jbpmVersion = (JbpmVersion) processEngine.execute(new Command<Object>(){
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ if (!PropertyImpl.propertiesTableExists(session)) {
+ try {
+ session.createSQLQuery("select CLASSNAME_ from JBPM4_VARIABLE").list();
+ return JbpmVersion.V_4_1;
- if (jbpmVersion.isEarlier(JbpmVersion.V_4_1)) {
- upgrade40To41(session);
- }
+ } catch (HibernateException e) {
+ return JbpmVersion.V_4_0;
+ }
+ }
+
+ String dbVersion = PropertyImpl.getDbVersion(session);
+ if (dbVersion == null) {
+ throw new JbpmException("property table exists, but no db version property is present");
+ }
+
+ return JbpmVersion.getJbpmVersion(dbVersion);
+ }
+ });
- if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
- upgrade41To42(session);
- }
- return null;
- }
+ if (jbpmVersion == JbpmVersion.V_4_2) {
+ throw new JbpmException("jBPM schema is already up to date");
+ }
- private void upgrade40To41(Session session) {
- executeSqlResource("upgrade-4.0-to-4.1/jbpm." + database + ".upgrade.sql", session);
- }
+ if (jbpmVersion.isEarlier(JbpmVersion.V_4_1)) {
+ processEngine.execute(new Command<Object>(){
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ DbHelper.executeSqlResource("upgrade-4.0-to-4.1/jbpm." + database + ".upgrade.sql", session);
+ return null;
+ }
+ });
+ }
- private void upgrade41To42(Session session) {
- executeSqlResource("upgrade-4.1-to-4.2/jbpm." + database + ".upgrade.sql", session);
- PropertyImpl.upgradeProperties(session);
- addLangId(session);
- }
+ if (jbpmVersion.isEarlier(JbpmVersion.V_4_2)) {
+ processEngine.execute(new Command<Object>(){
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ DbHelper.executeSqlResource("upgrade-4.1-to-4.2/jbpm." + database + ".upgrade.sql", session);
+ PropertyImpl.upgradeProperties(session);
+ return null;
+ }
+ });
+ processEngine.execute(new Command<Object>(){
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ // find deployments without a langid property
+ List<DeploymentProperty> deploymentProperties = session.createCriteria(DeploymentProperty.class)
+ .add(Restrictions.eq("key", DeploymentImpl.KEY_PROCESS_DEFINITION_ID))
+ .list();
- private void addLangId(Session session) {
- // find deployments without a langid property
- List<DeploymentProperty> deploymentProperties = session.createCriteria(DeploymentProperty.class)
- .add(Restrictions.eq("key", DeploymentImpl.KEY_PROCESS_DEFINITION_ID))
- .list();
+ for (DeploymentProperty deploymentProperty : deploymentProperties) {
+ String objectName = deploymentProperty.getObjectName();
+ DeploymentImpl deployment = deploymentProperty.getDeployment();
+ deployment.setProcessLanguageId(objectName, "jpdl-4.0");
+ }
+ return null;
+ }
+ });
+ }
- for (DeploymentProperty deploymentProperty : deploymentProperties) {
- String objectName = deploymentProperty.getObjectName();
- DeploymentImpl deployment = deploymentProperty.getDeployment();
- deployment.setProcessLanguageId(objectName, "jpdl-4.0");
- }
- }
+ log.info("jBPM DB upgrade completed successfully.");
- private static JbpmVersion getJbpmVersion(Session session) {
- if (!PropertyImpl.propertiesTableExists(session)) {
- return variableClassNameColumnExists(session) ? JbpmVersion.V_4_1 : JbpmVersion.V_4_0;
- }
+ } catch (Exception e) {
+ log.error("ERROR: jBPM DB upgrade FAILED", e);
- String dbVersion = PropertyImpl.getDbVersion(session);
- if (dbVersion == null) {
- throw new JbpmException("property table exists, but no db version property is present");
+ } finally {
+ processEngine.close();
}
-
- return JbpmVersion.getJbpmVersion(dbVersion);
}
-
- private static boolean variableClassNameColumnExists(Session session) {
- try {
- session.createSQLQuery("select CLASSNAME_ from JBPM4_VARIABLE").list();
- return true;
- }
- catch (HibernateException e) {
- return false;
- }
- }
-
}
Added: jbpm4/trunk/modules/db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/db/src/test/resources/jbpm.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/db/src/test/resources/jbpm.cfg.xml 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+</jbpm-configuration>
Property changes on: jbpm4/trunk/modules/db/src/test/resources/jbpm.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/db/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/db/src/test/resources/jbpm.hibernate.cfg.xml (rev 0)
+++ jbpm4/trunk/modules/db/src/test/resources/jbpm.hibernate.cfg.xml 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!DOCTYPE hibernate-configuration PUBLIC
+ "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+ "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<hibernate-configuration>
+ <session-factory>
+
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+ <property name="hibernate.connection.driver_class">org.hsqldb.jdbcDriver</property>
+ <property name="hibernate.connection.url">jdbc:hsqldb:hsql://localhost:1701</property>
+ <property name="hibernate.connection.username">sa</property>
+ <property name="hibernate.connection.password"></property>
+ <property name="hibernate.format_sql">true</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Property changes on: jbpm4/trunk/modules/db/src/test/resources/jbpm.hibernate.cfg.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/db/src/test/resources/logging.properties (rev 0)
+++ jbpm4/trunk/modules/db/src/test/resources/logging.properties 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/db/src/test/resources/logging.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/logging.properties
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/logging.properties (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/logging.properties 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINEST
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINEST
+org.jbpm.pvm.internal.tx.level=FINE
+org.jbpm.pvm.internal.wire.level=FINE
+org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=FINE
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+org.hibernate.SQL.level=FINEST
+org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/logging/debug/logging.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java 2009-10-23 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/DbidGenerator.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -44,7 +44,4 @@
}
public abstract long getNextId();
-
- public abstract void reset();
-
}
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 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/id/PropertyImpl.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -105,8 +105,8 @@
public static void upgradeProperties(Session session) {
setDbVersionToLibraryVersion(session);
long nextDbid = getMaxDbid(session)+1;
+ setNextDbid(session, nextDbid);
log.info("nextDbid is initialized to "+nextDbid);
- setNextDbid(session, nextDbid);
}
public static boolean propertiesTableExists(Session session) {
@@ -159,7 +159,7 @@
e.printStackTrace();
}
}
-
+
return maxDbid;
}
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 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-10-23 19:27:31 UTC (rev 5780)
@@ -20,7 +20,6 @@
<object class="org.jbpm.pvm.internal.id.DatabaseDbidGenerator">
<field name="commandService"><ref object="newTxRequiredCommandService" /></field>
- <invoke method="initialize" />
</object>
<object class="org.jbpm.pvm.internal.id.DatabaseIdComposer" init="eager" />
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 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/pvm/src/test/java/org/jbpm/pvm/internal/id/DbidGeneratorTest.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -44,6 +44,8 @@
DbidGenerator dbidGenerator = processEngine.get(DbidGenerator.class);
+ assertEquals(1, dbidGenerator.getNextId());
+
processEngine.execute(new Command<Void>() {
private static final long serialVersionUID = 1L;
public Void execute(Environment environment) throws Exception {
@@ -56,7 +58,7 @@
}
});
- for (int i=1; i<10020; i++) {
+ for (int i=2; i<10020; i++) {
assertEquals(i, dbidGenerator.getNextId());
if ((i%1000) == 0) {
log.debug("just got dbid "+i+"...");
Modified: jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java
===================================================================
--- jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java 2009-10-23 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/modules/test-cfg/src/test/java/org/jbpm/test/idgenerator/DeploymentIdGenerationTest.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -104,7 +104,8 @@
assertNotSame(oldProcessEngine, processEngine);
// Reset the in memory generator and redeploy the process
- DbidGenerator.getDefaultIdGenerator().reset();
+ MemoryDbidGenerator memoryDbidGenerator = (MemoryDbidGenerator) DbidGenerator.getDefaultIdGenerator();
+ memoryDbidGenerator.reset();
}
}
Added: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/QueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/QueryTest.java (rev 0)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/QueryTest.java 2009-10-23 19:27:31 UTC (rev 5780)
@@ -0,0 +1,116 @@
+/*
+ * 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.test.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.history.model.HistoryActivityInstanceImpl;
+import org.jbpm.pvm.internal.history.model.HistoryDetailImpl;
+import org.jbpm.pvm.internal.history.model.HistoryTaskImpl;
+import org.jbpm.pvm.internal.history.model.HistoryVariableImpl;
+import org.jbpm.pvm.internal.identity.impl.GroupImpl;
+import org.jbpm.pvm.internal.identity.impl.MembershipImpl;
+import org.jbpm.pvm.internal.identity.impl.UserImpl;
+import org.jbpm.pvm.internal.job.JobImpl;
+import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.DeploymentProperty;
+import org.jbpm.pvm.internal.task.ParticipationImpl;
+import org.jbpm.pvm.internal.task.SwimlaneImpl;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.pvm.internal.type.Variable;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class QueryTest extends JbpmTestCase {
+
+ private static Log log = Log.getLog(QueryTest.class.getName());
+
+ public void testQueries() {
+
+ deployJpdlXmlString(
+ "<process name='TaskCommentDetail'>" +
+ " <start>" +
+ " <transition to='t' />" +
+ " </start>" +
+ " <task name='t' assignee='johndoe'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("TaskCommentDetail");
+ executionService.startProcessInstanceByKey("TaskCommentDetail");
+ executionService.startProcessInstanceByKey("TaskCommentDetail");
+ executionService.startProcessInstanceByKey("TaskCommentDetail");
+
+
+ processEngine.execute(new Command<Object>() {
+ private static final long serialVersionUID = 1L;
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+
+ List<String> persistedTypes = new ArrayList<String>();
+ persistedTypes.add(DeploymentImpl.class.getName());
+ persistedTypes.add(DeploymentProperty.class.getName());
+ persistedTypes.add(ExecutionImpl.class.getName());
+ persistedTypes.add(GroupImpl.class.getName());
+ persistedTypes.add(HistoryActivityInstanceImpl.class.getName());
+ persistedTypes.add(HistoryDetailImpl.class.getName());
+ persistedTypes.add(HistoryTaskImpl.class.getName());
+ persistedTypes.add(HistoryVariableImpl.class.getName());
+ persistedTypes.add(JobImpl.class.getName());
+ persistedTypes.add(Lob.class.getName());
+ persistedTypes.add(MembershipImpl.class.getName());
+ persistedTypes.add(ParticipationImpl.class.getName());
+ persistedTypes.add(SwimlaneImpl.class.getName());
+ persistedTypes.add(TaskImpl.class.getName());
+ persistedTypes.add(UserImpl.class.getName());
+ persistedTypes.add(Variable.class.getName());
+
+ for (String persistedType: persistedTypes) {
+ try {
+ Long typeMaxDbid = (Long) session.createQuery(
+ "select max(o.dbid) " +
+ "from "+persistedType+" as o"
+ ).uniqueResult();
+
+ log.info(persistedType+": "+typeMaxDbid);
+
+ } catch (Exception e) {
+ log.info("couldn't get max dbid for "+persistedType, e);
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+ });
+
+ }
+}
Property changes on: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/QueryTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-10-23 15:45:19 UTC (rev 5779)
+++ jbpm4/trunk/qa/build.xml 2009-10-23 19:27:31 UTC (rev 5780)
@@ -207,6 +207,7 @@
<ant antfile="${jbpm.home}/install/build.xml" target="upgrade.jbpm.schema" inheritall="false">
<property name="database" value="${database}" />
<property name="tx" value="standalone.testsuite" />
+ <!--property name="logging" value="debug" /-->
</ant>
</target>
More information about the jbpm-commits
mailing list