[jbpm-commits] JBoss JBPM SVN: r6652 - in jbpm4/trunk/modules: db and 8 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 8 02:51:48 EDT 2010


Author: alex.guizar at jboss.com
Date: 2010-09-08 02:51:48 -0400 (Wed, 08 Sep 2010)
New Revision: 6652

Modified:
   jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java
   jbpm4/trunk/modules/db/pom.xml
   jbpm4/trunk/modules/db/scripts/antrun-schema.xml
   jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.hibernate.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml
   jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql
   jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql
   jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql
   jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql
   jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
   jbpm4/trunk/modules/pvm/pom.xml
   jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryDetailQueryTest.java
   jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java
   jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
   jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
Log:
JBPM-2398 add new history columns to create/drop sql scripts;
observe parameter operand type in AbstractQuery

Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/api/QueryOperand.java	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,26 +1,21 @@
 package org.jbpm.api;
 
-
 public enum QueryOperand {
 
-  EQUALS(0, "="), 
-  LIKE(1, "like"),
-  IN(2, "in"),
-  NOT_IN(3, "not in");
-  
-  @SuppressWarnings("unused")
-  private int id;
-  private String value;
-  
-  QueryOperand(int id, String value) {
-    this.id = id;
+  EQUALS("="),
+  LIKE("like"),
+  IN("in"),
+  NOT_IN("not in");
+
+  private final String value;
+
+  QueryOperand(String value) {
     this.value = value;
   }
 
   @Override
   public String toString() {
-    return this.value;
+    return value;
   }
-  
-  
+
 }

Modified: jbpm4/trunk/modules/db/pom.xml
===================================================================
--- jbpm4/trunk/modules/db/pom.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/db/pom.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -153,5 +153,10 @@
       <groupId>postgresql</groupId>
       <artifactId>postgresql</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-jdk14</artifactId>
+      <scope>runtime</scope>
+    </dependency>
   </dependencies>
 </project>
\ No newline at end of file

Modified: jbpm4/trunk/modules/db/scripts/antrun-schema.xml
===================================================================
--- jbpm4/trunk/modules/db/scripts/antrun-schema.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/db/scripts/antrun-schema.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,13 +1,12 @@
 <?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.                 -->
-<!-- ============================================================ -->
+<!-- ====================================================================== -->
+<!--  jBPM: Workflow in Java                                                -->
+<!--                                                                        -->
+<!--  Distributable under LGPL license.                                     -->
+<!--  See terms of license at http://www.gnu.org.                           -->
+<!-- ====================================================================== -->
 
-<!-- $Id: antrun-jbpmschema.xml 2999 2008-11-19 16:16:01Z thomas.diesler at jboss.com $ -->
-
 <project>
 
   <!-- ##################### -->
@@ -17,7 +16,7 @@
   <target name="create-schema">
     <taskdef name="schemaexport"
              classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"
-             classpathref="maven.compile.classpath" />
+             classpathref="maven.runtime.classpath" />
 
     <mkdir dir="${project.output.dir}" />
 

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/hsqldb.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!DOCTYPE hibernate-configuration PUBLIC
-  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
@@ -11,7 +10,9 @@
     <property name="hibernate.connection.url">@jdbc.url@</property>
     <property name="hibernate.connection.username">@jdbc.username@</property>
     <property name="hibernate.connection.password">@jdbc.password@</property>
+
     <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">true</property>
 
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/mysql.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!DOCTYPE hibernate-configuration PUBLIC
-  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
@@ -11,7 +10,9 @@
     <property name="hibernate.connection.url">@jdbc.url@</property>
     <property name="hibernate.connection.username">@jdbc.username@</property>
     <property name="hibernate.connection.password">@jdbc.password@</property>
+
     <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">true</property>
 
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/oracle.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!DOCTYPE hibernate-configuration PUBLIC
-  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
@@ -11,7 +10,9 @@
     <property name="hibernate.connection.url">@jdbc.url@</property>
     <property name="hibernate.connection.username">@jdbc.username@</property>
     <property name="hibernate.connection.password">@jdbc.password@</property>
+
     <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">true</property>
 
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/cfg/hibernate/jdbc/postgresql.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!DOCTYPE hibernate-configuration PUBLIC
-  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
@@ -11,7 +10,9 @@
     <property name="hibernate.connection.url">@jdbc.url@</property>
     <property name="hibernate.connection.username">@jdbc.username@</property>
     <property name="hibernate.connection.password">@jdbc.password@</property>
+
     <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">true</property>
 
     <mapping resource="jbpm.repository.hbm.xml" />
     <mapping resource="jbpm.execution.hbm.xml" />

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.hsqldb.create.sql	2010-09-08 06:51:48 UTC (rev 6652)
@@ -31,6 +31,7 @@
         SUSPHISTSTATE_ varchar(255),
         PRIORITY_ integer,
         HISACTINST_ bigint,
+        INITIATOR_ varchar(255),
         PARENT_ bigint,
         INSTANCE_ bigint,
         SUPEREXEC_ bigint,
@@ -94,6 +95,8 @@
         DURATION_ bigint,
         STATE_ varchar(255),
         ENDACTIVITY_ varchar(255),
+        SUPERPROCID_ varchar(255),
+        INITIATOR_ varchar(255),
         NEXTIDX_ integer,
         primary key (DBID_)
     );
@@ -101,6 +104,7 @@
     create table JBPM4_HIST_TASK (
         DBID_ bigint not null,
         DBVERSION_ integer not null,
+        NAME_ varchar(255),
         EXECUTION_ varchar(255),
         OUTCOME_ varchar(255),
         ASSIGNEE_ varchar(255),
@@ -109,6 +113,7 @@
         CREATE_ timestamp,
         END_ timestamp,
         DURATION_ bigint,
+        DUEDATE_ timestamp,
         NEXTIDX_ integer,
         SUPERTASK_ bigint,
         primary key (DBID_)

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.mysql.create.sql	2010-09-08 06:51:48 UTC (rev 6652)
@@ -31,6 +31,7 @@
         SUSPHISTSTATE_ varchar(255),
         PRIORITY_ integer,
         HISACTINST_ bigint,
+        INITIATOR_ varchar(255),
         PARENT_ bigint,
         INSTANCE_ bigint,
         SUPEREXEC_ bigint,
@@ -93,6 +94,8 @@
         DURATION_ bigint,
         STATE_ varchar(255),
         ENDACTIVITY_ varchar(255),
+        SUPERPROCID_ varchar(255),
+        INITIATOR_ varchar(255),
         NEXTIDX_ integer,
         primary key (DBID_)
     ) type=InnoDB;
@@ -100,6 +103,7 @@
     create table JBPM4_HIST_TASK (
         DBID_ bigint not null,
         DBVERSION_ integer not null,
+        NAME_ varchar(255),
         EXECUTION_ varchar(255),
         OUTCOME_ varchar(255),
         ASSIGNEE_ varchar(255),
@@ -108,6 +112,7 @@
         CREATE_ datetime,
         END_ datetime,
         DURATION_ bigint,
+        DUEDATE_ datetime,
         NEXTIDX_ integer,
         SUPERTASK_ bigint,
         primary key (DBID_)

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.oracle.create.sql	2010-09-08 06:51:48 UTC (rev 6652)
@@ -31,6 +31,7 @@
         SUSPHISTSTATE_ varchar2(255 char),
         PRIORITY_ number(10,0),
         HISACTINST_ number(19,0),
+        INITIATOR_ varchar2(255 char),
         PARENT_ number(19,0),
         INSTANCE_ number(19,0),
         SUPEREXEC_ number(19,0),
@@ -93,6 +94,8 @@
         DURATION_ number(19,0),
         STATE_ varchar2(255 char),
         ENDACTIVITY_ varchar2(255 char),
+        SUPERPROCID_ varchar2(255 char),
+        INITIATOR_ varchar2(255 char),
         NEXTIDX_ number(10,0),
         primary key (DBID_)
     );
@@ -100,6 +103,7 @@
     create table JBPM4_HIST_TASK (
         DBID_ number(19,0) not null,
         DBVERSION_ number(10,0) not null,
+        NAME_ varchar2(255 char),
         EXECUTION_ varchar2(255 char),
         OUTCOME_ varchar2(255 char),
         ASSIGNEE_ varchar2(255 char),
@@ -108,6 +112,7 @@
         CREATE_ timestamp,
         END_ timestamp,
         DURATION_ number(19,0),
+        DUEDATE_ timestamp,
         NEXTIDX_ number(10,0),
         SUPERTASK_ number(19,0),
         primary key (DBID_)

Modified: jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/distro/src/main/files/install/src/db/create/jbpm.postgresql.create.sql	2010-09-08 06:51:48 UTC (rev 6652)
@@ -31,6 +31,7 @@
         SUSPHISTSTATE_ varchar(255),
         PRIORITY_ int4,
         HISACTINST_ int8,
+        INITIATOR_ varchar(255),
         PARENT_ int8,
         INSTANCE_ int8,
         SUPEREXEC_ int8,
@@ -93,6 +94,8 @@
         DURATION_ int8,
         STATE_ varchar(255),
         ENDACTIVITY_ varchar(255),
+        SUPERPROCID_ varchar(255),
+        INITIATOR_ varchar(255),
         NEXTIDX_ int4,
         primary key (DBID_)
     );
@@ -100,6 +103,7 @@
     create table JBPM4_HIST_TASK (
         DBID_ int8 not null,
         DBVERSION_ int4 not null,
+        NAME_ varchar(255),
         EXECUTION_ varchar(255),
         OUTCOME_ varchar(255),
         ASSIGNEE_ varchar(255),
@@ -108,6 +112,7 @@
         CREATE_ timestamp,
         END_ timestamp,
         DURATION_ int8,
+        DUEDATE_ timestamp,
         NEXTIDX_ int4,
         SUPERTASK_ int8,
         primary key (DBID_)

Modified: jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/examples/src/test/resources/jbpm.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,25 +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">
+<!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:mem:.</property>
-     <property name="hibernate.connection.username">sa</property>
-     <property name="hibernate.connection.password"></property>
-     <property name="hibernate.hbm2ddl.auto">create-drop</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" />
-     
+    <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:mem:.</property>
+    <property name="hibernate.connection.username">sa</property>
+    <property name="hibernate.connection.password" />
+
+    <property name="hibernate.hbm2ddl.auto">create-drop</property>
+    <property name="hibernate.format_sql">true</property>
+    <property name="hibernate.use_sql_comments">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>

Modified: jbpm4/trunk/modules/pvm/pom.xml
===================================================================
--- jbpm4/trunk/modules/pvm/pom.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/pvm/pom.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -150,11 +150,6 @@
     </dependency>
     <dependency>
       <groupId>org.slf4j</groupId>
-      <artifactId>slf4j-api</artifactId>
-      <scope>runtime</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.slf4j</groupId>
       <artifactId>slf4j-jdk14</artifactId>
       <scope>runtime</scope>
     </dependency>

Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/AbstractQuery.java	2010-09-08 06:51:48 UTC (rev 6652)
@@ -217,7 +217,12 @@
     if (isListOperand(namedParam)) {
       query.setParameterList(namedParam, transformToArray(parameter, clazz));
     } else {
-      query.setString(namedParam, parameter);
+      if (clazz == Long.class) {
+        query.setLong(namedParam, Long.parseLong(parameter));
+      }
+      else {
+        query.setString(namedParam, parameter);
+      }
     }
   }
   

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/DeploymentQueryTest.java	2010-09-08 06:51:48 UTC (rev 6652)
@@ -26,6 +26,7 @@
 import java.util.List;
 import java.util.Set;
 
+import org.hibernate.HibernateException;
 import org.jbpm.api.Deployment;
 import org.jbpm.api.DeploymentQuery;
 import org.jbpm.api.QueryOperand;
@@ -125,10 +126,15 @@
   
   public void testLike() {
     List<String> deploymentIds = deployTestProcesses();
+
+    try {
+      repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0), QueryOperand.LIKE).count();
+      fail("expected sql grammar exception");
+    }
+    catch (HibernateException e) {
+      // operator like does not apply to long dbid field
+    }
     
-    assertEquals(1, repositoryService.createDeploymentQuery().deploymentId(deploymentIds.get(0), QueryOperand.LIKE).count());
-    
-    
     deleteCascade(deploymentIds);
   }
   
@@ -211,10 +217,6 @@
     return processIds;
   }
   
-  private void testOrderBy(String property, List expectedValues) {
-    testOrderBy(property, expectedValues, null, false);
-  }
-
   private void testOrderByNaturalOrdening(String property, int expectedNrOfResults) {
     testOrderBy(property, null, expectedNrOfResults, true);
   }

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryDetailQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryDetailQueryTest.java	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryDetailQueryTest.java	2010-09-08 06:51:48 UTC (rev 6652)
@@ -31,11 +31,9 @@
 import org.jbpm.api.history.HistoryDetailQuery;
 import org.jbpm.api.history.HistoryDetailUpdate;
 import org.jbpm.api.task.Task;
-import org.jbpm.pvm.internal.util.Clock;
 import org.jbpm.test.JbpmTestCase;
 import org.jbpm.test.assertion.QueryAssertions;
 
-
 /**
  * @author Tom Baeyens
  */
@@ -154,43 +152,41 @@
   
   @SuppressWarnings("unchecked")
   public void testHistoryVariable() {
-    
-    deployJpdlXmlString("<process name='HistoryTaskDetail'>" +
-            " <variable name='variable-to-update' type='string' init-expr='alex' history='true'/> " +
-            "  <start>" +
-            "    <transition to='review' />" +
-            "  </start>" +
-            "  <task name='review' " +
-            "        assignee='johndoe'>" +
-            "    <transition to='wait' />" +
-            "  </task>" +
-            "  <state name='wait'/>" +
-            "</process>");
+
+    deployJpdlXmlString("<process name='HistoryTaskDetail'>"
+      + " <variable name='variable-to-update' type='string' init-expr='alex' history='true'/> "
+      + "  <start>" + "    <transition to='review' />" + "  </start>"
+      + "  <task name='review' " + "        assignee='johndoe'>"
+      + "    <transition to='wait' />" + "  </task>" + "  <state name='wait'/>" + "</process>");
     ProcessInstance pi = executionService.startProcessInstanceByKey("HistoryTaskDetail");
 
     assertEquals("alex", executionService.getVariable(pi.getId(), "variable-to-update"));
-    
+
     executionService.setVariable(pi.getId(), "variable-to-update", "peter");
-    
+
     List<Task> tasks = taskService.findPersonalTasks("johndoe");
     assertEquals(1, tasks.size());
-    
+
     assertEquals("peter", executionService.getVariable(pi.getId(), "variable-to-update"));
-    
-    executionService.setVariable(pi.getId(), "variable-to-update", "jack");    
+
+    executionService.setVariable(pi.getId(), "variable-to-update", "jack");
     assertEquals("jack", historyService.getVariable(pi.getId(), "variable-to-update"));
-    
-    List<HistoryDetail> history = historyService.createHistoryDetailQuery().processInstanceId(pi.getId()).list();
-    assertNotNull(history);
+
+    List<HistoryDetail> history = historyService.createHistoryDetailQuery()
+      .processInstanceId(pi.getId())
+      .orderAsc(HistoryDetailQuery.PROPERTY_TIME)
+      .list();
     assertEquals(2, history.size());
-    assertEquals("updated variable variable-to-update from alex to peter", history.get(0).toString());
-    assertEquals("updated variable variable-to-update from peter to jack", history.get(1).toString());
-    
-    assertEquals("alex", ((HistoryDetailUpdate)history.get(0)).getOldValue());
-    assertEquals("peter", ((HistoryDetailUpdate)history.get(0)).getNewValue());
-    
-    assertEquals("peter", ((HistoryDetailUpdate)history.get(1)).getOldValue());
-    assertEquals("jack", ((HistoryDetailUpdate)history.get(1)).getNewValue());
+    assertEquals("updated variable variable-to-update from alex to peter", history.get(0)
+      .toString());
+    assertEquals("updated variable variable-to-update from peter to jack", history.get(1)
+      .toString());
+
+    assertEquals("alex", ((HistoryDetailUpdate) history.get(0)).getOldValue());
+    assertEquals("peter", ((HistoryDetailUpdate) history.get(0)).getNewValue());
+
+    assertEquals("peter", ((HistoryDetailUpdate) history.get(1)).getOldValue());
+    assertEquals("jack", ((HistoryDetailUpdate) history.get(1)).getNewValue());
   }
   
   @SuppressWarnings("unchecked")

Modified: jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/query/HistoryTaskQueryTest.java	2010-09-08 06:51:48 UTC (rev 6652)
@@ -24,9 +24,6 @@
  */
 package org.jbpm.test.query;
 
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Date;
@@ -40,7 +37,6 @@
 import org.jbpm.test.JbpmTestCase;
 import org.jbpm.test.assertion.QueryAssertions;
 
-
 /**
  * @author Joram Barrez
  */
@@ -79,7 +75,7 @@
     testOrderByNaturalOrdening(HistoryTaskQuery.PROPERTY_STATE, 3);
   }
 
-  private void testOrderBy(String property, List expectedValues) {
+  private void testOrderBy(String property, List<?> expectedValues) {
     testOrderBy(property, expectedValues, null, false);
   }
 
@@ -130,8 +126,13 @@
   public void testTaskIdLike() {
     createTestHistoryTasks();
     
-    assertEquals(3, historyService.createHistoryTaskQuery().taskId("%", QueryOperand.LIKE).count());
-    
+    try {
+      historyService.createHistoryTaskQuery().taskId("%", QueryOperand.LIKE).count();
+      fail("expected number format exception");
+    }
+    catch (NumberFormatException e) {
+      // non-numeric argument does not apply to long dbid field
+    }
   }
   
   public void testTaskIdIn() {
@@ -354,14 +355,5 @@
     
   }
   
-  private Date stringToDate(String dateString) {
-    DateFormat dateFormat = new SimpleDateFormat("dd/mm/yyyy");
-    try {
-      return dateFormat.parse(dateString);
-    } catch (ParseException e) {
-      throw new RuntimeException("Couldn't convert " + dateString);
-    }
-  }
   
-  
 }

Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.hibernate.cfg.xml	2010-09-08 06:51:48 UTC (rev 6652)
@@ -1,37 +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">
+<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
+  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
 
 <hibernate-configuration>
   <session-factory>
-  
-  	 <!-- MySQL 
-     <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
-     <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
-     <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpm</property>
-     <property name="hibernate.connection.username">jbpm</property>
-     <property name="hibernate.connection.password">jbpm</property>
-     -->
-  
-     <!-- HSQLDB -->
      <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:mem:.</property>
      <property name="hibernate.connection.username">sa</property>
-     <property name="hibernate.connection.password"></property>
+     <property name="hibernate.connection.password"/>
       
-      
-      
      <property name="hibernate.hbm2ddl.auto">create-drop</property>
      <property name="hibernate.format_sql">true</property>
+     <property name="hibernate.use_sql_comments">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>

Modified: jbpm4/trunk/modules/test-db/src/test/resources/logging.properties
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/logging.properties	2010-09-07 09:37:19 UTC (rev 6651)
+++ jbpm4/trunk/modules/test-db/src/test/resources/logging.properties	2010-09-08 06:51:48 UTC (rev 6652)
@@ -12,7 +12,7 @@
 org.hibernate.level=INFO
 #org.hibernate.cfg.SettingsFactory.level=SEVERE
 #org.hibernate.cfg.HbmBinder.level=SEVERE
-#org.hibernate.SQL.level=FINEST
+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



More information about the jbpm-commits mailing list