[jbpm-commits] JBoss JBPM SVN: r5880 - in jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src: main/java/org/jbpm/db/hibernate and 9 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 3 17:12:11 EST 2009


Author: alex.guizar at jboss.com
Date: 2009-11-03 17:12:10 -0500 (Tue, 03 Nov 2009)
New Revision: 5880

Added:
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
Removed:
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java
Modified:
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
   jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
Log:
JBPM-2617: Dynamic timer support pack for DB2
Merge revisions 5805-5818 from branch jbpm-3.2-soa

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/JobSession.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -31,6 +31,8 @@
 import org.hibernate.Query;
 import org.hibernate.Session;
 import org.hibernate.criterion.Restrictions;
+
+import org.jbpm.graph.def.Action;
 import org.jbpm.graph.exe.ProcessInstance;
 import org.jbpm.graph.exe.Token;
 import org.jbpm.job.Job;
@@ -48,10 +50,10 @@
   public Job getFirstAcquirableJob(String lockOwner) {
     try {
       return (Job) session.getNamedQuery("JobSession.getFirstAcquirableJob")
-          .setString("lockOwner", lockOwner)
-          .setTimestamp("now", new Date())
-          .setMaxResults(1)
-          .uniqueResult();
+        .setString("lockOwner", lockOwner)
+        .setTimestamp("now", new Date())
+        .setMaxResults(1)
+        .uniqueResult();
     }
     catch (HibernateException e) {
       throw new JbpmPersistenceException("could not get first acquirable job", e);
@@ -61,24 +63,24 @@
   public List findExclusiveJobs(String lockOwner, ProcessInstance processInstance) {
     try {
       return session.getNamedQuery("JobSession.findExclusiveJobs")
-          .setString("lockOwner", lockOwner)
-          .setTimestamp("now", new Date())
-          .setParameter("processInstance", processInstance)
-          .list();
+        .setString("lockOwner", lockOwner)
+        .setTimestamp("now", new Date())
+        .setParameter("processInstance", processInstance)
+        .list();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not find exclusive jobs owned by '" +
-          lockOwner +
-          "' for " +
-          processInstance, e);
+      throw new JbpmPersistenceException("could not find exclusive jobs owned by '"
+        + lockOwner
+        + "' for "
+        + processInstance, e);
     }
   }
 
   public List findJobsByToken(Token token) {
     try {
       return session.getNamedQuery("JobSession.findJobsByToken")
-          .setParameter("token", token)
-          .list();
+        .setParameter("token", token)
+        .list();
     }
     catch (HibernateException e) {
       throw new JbpmPersistenceException("could not find jobs for " + token, e);
@@ -98,16 +100,24 @@
       return (Job) query.setString("lockOwner", lockOwner).setMaxResults(1).uniqueResult();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not get first due job owned by '" +
-          lockOwner +
-          "' ignoring jobs " +
-          monitoredJobs, e);
+      throw new JbpmPersistenceException("could not get first due job owned by '"
+        + lockOwner
+        + "' ignoring jobs "
+        + monitoredJobs, e);
     }
   }
 
   public void saveJob(Job job) {
     try {
       session.save(job);
+      if (job instanceof Timer) {
+        Timer timer = (Timer) job;
+        Action action = timer.getAction();
+        if (action != null && action.getId() == 0) {
+          // transient action, save it
+          session.save(action);
+        }
+      }
     }
     catch (HibernateException e) {
       throw new JbpmPersistenceException("could not save " + job, e);
@@ -167,7 +177,9 @@
 
   public void suspendJobs(Token token) {
     try {
-      session.getNamedQuery("JobSession.suspendJobs").setParameter("token", token).executeUpdate();
+      session.getNamedQuery("JobSession.suspendJobs")
+        .setParameter("token", token)
+        .executeUpdate();
     }
     catch (HibernateException e) {
       throw new JbpmPersistenceException("could not suspend jobs for " + token, e);
@@ -176,7 +188,9 @@
 
   public void resumeJobs(Token token) {
     try {
-      session.getNamedQuery("JobSession.resumeJobs").setParameter("token", token).executeUpdate();
+      session.getNamedQuery("JobSession.resumeJobs")
+        .setParameter("token", token)
+        .executeUpdate();
     }
     catch (HibernateException e) {
       throw new JbpmPersistenceException("could not resume jobs for " + token, e);
@@ -187,29 +201,29 @@
     try {
       // delete unowned timers
       session.getNamedQuery("JobSession.deleteTimersByName")
-          .setString("name", name)
-          .setParameter("token", token)
-          .executeUpdate();
+        .setString("name", name)
+        .setParameter("token", token)
+        .executeUpdate();
 
       // prevent further repetitions
       List timers = session.getNamedQuery("JobSession.findRepeatingTimersByName")
-          .setString("name", name)
-          .setParameter("token", token)
-          .list();
+        .setString("name", name)
+        .setParameter("token", token)
+        .list();
       preventFurtherRepetitions(timers);
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not delete timers by name '" +
-          name +
-          "' for " +
-          token, e);
+      throw new JbpmPersistenceException("could not delete timers by name '"
+        + name
+        + "' for "
+        + token, e);
     }
   }
 
   public int countDeletableJobsForProcessInstance(ProcessInstance processInstance) {
     Number jobCount = (Number) session.getNamedQuery("JobSession.countDeletableJobsForProcessInstance")
-        .setParameter("processInstance", processInstance)
-        .uniqueResult();
+      .setParameter("processInstance", processInstance)
+      .uniqueResult();
     return jobCount.intValue();
   }
 
@@ -217,13 +231,13 @@
     try {
       // delete unowned node-execute-jobs and timers
       session.getNamedQuery("JobSession.deleteJobsForProcessInstance")
-          .setParameter("processInstance", processInstance)
-          .executeUpdate();
+        .setParameter("processInstance", processInstance)
+        .executeUpdate();
 
       // prevent further repetitions
       List timers = session.getNamedQuery("JobSession.findRepeatingTimersForProcessInstance")
-          .setParameter("processInstance", processInstance)
-          .list();
+        .setParameter("processInstance", processInstance)
+        .list();
       preventFurtherRepetitions(timers);
     }
     catch (HibernateException e) {
@@ -243,11 +257,12 @@
   public List findJobsWithOverdueLockTime(Date threshold) {
     try {
       return session.getNamedQuery("JobSession.findJobsWithOverdueLockTime")
-          .setDate("threshold", threshold)
-          .list();
+        .setDate("threshold", threshold)
+        .list();
     }
     catch (HibernateException e) {
-      throw new JbpmPersistenceException("could not find jobs with lock time over " + threshold, e);
+      throw new JbpmPersistenceException(
+        "could not find jobs with lock time over " + threshold, e);
     }
   }
 
@@ -257,8 +272,6 @@
     for (int i = 0; i < jobCount; i++) {
       jobs[i] = new Long(jobIds[i]);
     }
-    return session.createCriteria(Job.class)
-      .add(Restrictions.in("id", jobs))
-      .list();
+    return session.createCriteria(Job.class).add(Restrictions.in("id", jobs)).list();
   }
 }

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/db/hibernate/LimitedTextType.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -44,9 +44,13 @@
 
   public void set(PreparedStatement st, Object value, int index) throws SQLException {
     String text = (String) value;
-    if (text.length() > limit) text = text.substring(0, limit);
+    int length = text.length();
+    if (length > limit) {
+      text = text.substring(0, limit);
+      length = limit;
+    }
 
-    st.setCharacterStream(index, new StringReader(text), text.length());
+    st.setCharacterStream(index, new StringReader(text), length);
   }
 
   public void setParameterValues(Properties parameters) {

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/graph/def/Action.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -39,16 +39,16 @@
 
   private static final long serialVersionUID = 1L;
 
-  long id = 0;
-  protected String name = null;
+  long id;
+  protected String name;
   protected boolean isPropagationAllowed = true;
-  protected boolean isAsync = false;
-  protected boolean isAsyncExclusive = false;
-  protected Action referencedAction = null;
-  protected Delegation actionDelegation = null;
-  protected String actionExpression = null;
-  protected Event event = null;
-  protected ProcessDefinition processDefinition = null;
+  protected boolean isAsync;
+  protected boolean isAsyncExclusive;
+  protected Action referencedAction;
+  protected Delegation actionDelegation;
+  protected String actionExpression;
+  protected Event event;
+  protected ProcessDefinition processDefinition;
 
   public Action() {
   }

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/main/java/org/jbpm/scheduler/def/CreateTimerAction.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -43,13 +43,13 @@
 public class CreateTimerAction extends Action {
 
   private static final long serialVersionUID = 1L;
-  static BusinessCalendar businessCalendar = new BusinessCalendar(); 
+  static final BusinessCalendar businessCalendar = new BusinessCalendar(); 
 
-  String timerName = null;
-  String dueDate = null;
-  String repeat = null;
-  String transitionName = null;
-  Action timerAction = null;
+  String timerName;
+  String dueDate;
+  String repeat;
+  String transitionName;
+  Action timerAction;
 
   public void read(Element actionElement, JpdlXmlReader jpdlReader) {
     timerName = actionElement.attributeValue("name");

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/command/ChangeProcessInstanceVersionCommandTest.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -44,16 +44,16 @@
       // above), in this case I got
       // could not delete: [org.jbpm.taskmgmt.def.TaskMgmtDefinition#2]
       // Integrity constraint violation FK_TASKMGTINST_TMD table: JBPM_MODULEINSTANCE in statement [/* delete org.jbpm.taskmgmt.def.TaskMgmtDefinition */ delete from JBPM_MODULEDEFINITION where ID_=?]
-      jbpmContext.getGraphSession().deleteProcessDefinition(pd2.getId());
-      jbpmContext.getGraphSession().deleteProcessDefinition(pd1.getId());
+      graphSession.deleteProcessDefinition(pd2.getId());
+      graphSession.deleteProcessDefinition(pd1.getId());
     }
     else if (pd1 != null) {
       newTransaction();
-      jbpmContext.getGraphSession().deleteProcessDefinition(pd1.getId());
+      graphSession.deleteProcessDefinition(pd1.getId());
     }
     else if (pd2 != null) {
       newTransaction();
-      jbpmContext.getGraphSession().deleteProcessDefinition(pd2.getId());
+      graphSession.deleteProcessDefinition(pd2.getId());
     }
 
     pd1 = null;
@@ -83,7 +83,6 @@
 
     pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
     jbpmContext.deployProcessDefinition(pd1);
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
 
     // start 2 instances
     ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -108,7 +107,7 @@
 
     pd2 = ProcessDefinition.parseXmlString(xmlVersion2);
     jbpmContext.deployProcessDefinition(pd2);
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
 
     // now change all process instances to most current version
     try {
@@ -175,8 +174,8 @@
         + "   <end-state name='end' />" //
         + "</process-definition>";
 
-    jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+    jbpmContext.deployProcessDefinition(pd1);
 
     // start instance
     ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -206,7 +205,7 @@
         + "</process-definition>";
 
     jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
 
     // now change all process instances to most current version
     try {
@@ -264,8 +263,8 @@
         + "   <end-state name='end' />" //
         + "</process-definition>";
 
-    jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+    jbpmContext.deployProcessDefinition(pd1);
 
     // start instance
     ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -297,7 +296,7 @@
         + "</process-definition>";
 
     jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
 
     HashMap nodeNameMap = new HashMap();
     nodeNameMap.put("task1", "task1b");
@@ -381,7 +380,6 @@
 
     pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
     jbpmContext.deployProcessDefinition(pd1);
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("testTaskInstances");
 
     // start 2 instances
     ProcessInstance pi1 = jbpmContext.newProcessInstance("testTaskInstances");
@@ -408,7 +406,7 @@
 
     pd2 = ProcessDefinition.parseXmlString(xmlVersion2);
     jbpmContext.deployProcessDefinition(pd2);
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("testTaskInstances");
+    pd2 = graphSession.findLatestProcessDefinition("testTaskInstances");
 
     // process instance 1 can me updated, state names haven't changed in this path:
     new ChangeProcessInstanceVersionCommand().processInstanceId(pi1.getId()).execute(jbpmContext);
@@ -484,8 +482,8 @@
         + "   <end-state name='end'/>" //
         + "</process-definition>";
 
-    jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+    jbpmContext.deployProcessDefinition(pd1);
 
     // start instance
     ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -510,7 +508,7 @@
         + "</process-definition>";
 
     jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
 
     // change version
     HashMap nameMap = new HashMap();
@@ -549,8 +547,8 @@
         + "   <end-state name='end'/>" //
         + "</process-definition>";
 
-    jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion1));
-    pd1 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd1 = ProcessDefinition.parseXmlString(xmlVersion1);
+    jbpmContext.deployProcessDefinition(pd1);
 
     // start instance
     ProcessInstance pi1 = jbpmContext.newProcessInstance("TestChangeVersion");
@@ -585,7 +583,7 @@
         + "</process-definition>";
 
     jbpmContext.deployProcessDefinition(ProcessDefinition.parseXmlString(xmlVersion2));
-    pd2 = jbpmContext.getGraphSession().findLatestProcessDefinition("TestChangeVersion");
+    pd2 = graphSession.findLatestProcessDefinition("TestChangeVersion");
 
     // change version
     HashMap nameMap = new HashMap();

Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085 (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085)

Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java	2009-10-27 15:57:27 UTC (rev 5818)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,68 +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.jbpm1085;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JBPM1085Test extends AbstractDbTestCase {
-
-  public void testJoinPersistence() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
-      + "  <start-state>"
-      + "    <transition to='f' />"
-      + "  </start-state>"
-      + "  <fork name='f'>"
-      + "    <transition name='a' to='a' />"
-      + "    <transition name='b' to='b' />"
-      + "  </fork>"
-      + "  <state name='a'>"
-      + "    <transition to='j' />"
-      + "  </state>"
-      + "  <state name='b'>"
-      + "    <transition to='j' />"
-      + "  </state>"
-      + "  <join name='j'>"
-      + "    <transition to='end' />"
-      + "  </join>"
-      + "  <end-state name='end'/>"
-      + "</process-definition>");
-    graphSession.saveProcessDefinition(processDefinition);
-
-    try {
-      ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      processInstance.signal();
-      processInstance.findToken("/a").signal();
-
-      processInstance = saveAndReload(processInstance);
-      processInstance.findToken("/b").signal();
-
-      assertEquals("end", processInstance.getRootToken().getNode().getName());
-      assertEquals("j", processInstance.findToken("/a").getNode().getName());
-      assertEquals("j", processInstance.findToken("/b").getNode().getName());
-    }
-    finally {
-      jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
-    }
-  }
-}

Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java)
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm1085/JBPM1085Test.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -0,0 +1,68 @@
+/*
+ * 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.jbpm1085;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ProcessInstance;
+
+public class JBPM1085Test extends AbstractDbTestCase {
+
+  public void testJoinPersistence() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition>"
+      + "  <start-state>"
+      + "    <transition to='f' />"
+      + "  </start-state>"
+      + "  <fork name='f'>"
+      + "    <transition name='a' to='a' />"
+      + "    <transition name='b' to='b' />"
+      + "  </fork>"
+      + "  <state name='a'>"
+      + "    <transition to='j' />"
+      + "  </state>"
+      + "  <state name='b'>"
+      + "    <transition to='j' />"
+      + "  </state>"
+      + "  <join name='j'>"
+      + "    <transition to='end' />"
+      + "  </join>"
+      + "  <end-state name='end'/>"
+      + "</process-definition>");
+    graphSession.saveProcessDefinition(processDefinition);
+
+    try {
+      ProcessInstance processInstance = new ProcessInstance(processDefinition);
+      processInstance.signal();
+      processInstance.findToken("/a").signal();
+
+      processInstance = saveAndReload(processInstance);
+      processInstance.findToken("/b").signal();
+
+      assertEquals("end", processInstance.getRootToken().getNode().getName());
+      assertEquals("j", processInstance.findToken("/a").getNode().getName());
+      assertEquals("j", processInstance.findToken("/b").getNode().getName());
+    }
+    finally {
+      jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
+    }
+  }
+}

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2036/JBPM2036Test.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -20,7 +20,6 @@
     ProcessDefinition processDefinition = getProcessDefinition();
     jbpmContext.deployProcessDefinition(processDefinition);
 
-    newTransaction();
     try {
       ProcessInstance processInstance = new ProcessInstance(processDefinition);
       processInstance.signal();

Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603 (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603)

Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java	2009-10-27 15:57:27 UTC (rev 5818)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,114 +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.jbpm2603;
-
-import java.util.Calendar;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.Action;
-import org.jbpm.graph.def.ActionHandler;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ExecutionContext;
-import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.instantiation.Delegation;
-import org.jbpm.job.Timer;
-
-/**
- * Restore automatic save of timer actions.
- * 
- * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2603">JBPM-2603</a>
- * @author Alejandro Guizar
- */
-public class JBPM2603Test extends AbstractDbTestCase {
-
-  public void testStaticTimerAction() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
-      + "  name='static timer action'>"
-      + "  <start-state><transition to='mid'/></start-state>"
-      + "  <state name='mid'>"
-      + "    <timer duedate='1 hour'>"
-      + "      <action name='example' class='org.example.Action'/>"
-      + "    </timer>"
-      + "  </state>"
-      + "</process-definition>");
-    jbpmContext.deployProcessDefinition(processDefinition);
-
-    try {
-      ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      processInstance.signal();
-      jbpmContext.save(processInstance);
-
-      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
-      assertEquals(processDefinition.getAction("example").getId(), timer.getAction().getId());
-    }
-    finally {
-      graphSession.deleteProcessDefinition(processDefinition.getId());
-    }
-  }
-
-  public void testDynamicTimerAction() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
-      + "  name='dynamic timer action'>"
-      + "  <start-state><transition to='mid'/></start-state>"
-      + "  <state name='mid'>"
-      + "    <event type='node-enter'>"
-      + "      <action class='"
-      + CreateDynamicTimer.class.getName()
-      + "'/>"
-      + "    </event>"
-      + "  </state>"
-      + "</process-definition>");
-    jbpmContext.deployProcessDefinition(processDefinition);
-
-    try {
-      ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      processInstance.signal();
-      jbpmContext.save(processInstance);
-
-      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
-      Action action = timer.getAction();
-      assertEquals("org.example.Action", action.getActionDelegation().getClassName());
-
-      session.delete(action);
-    }
-    finally {
-      graphSession.deleteProcessDefinition(processDefinition.getId());
-    }
-  }
-
-  public static class CreateDynamicTimer implements ActionHandler {
-    private static final long serialVersionUID = 1L;
-
-    public void execute(ExecutionContext executionContext) throws Exception {
-      Action action = new Action(new Delegation("org.example.Action"));
-
-      Calendar oneHour = Calendar.getInstance();
-      oneHour.add(Calendar.HOUR_OF_DAY, 1);
-
-      Timer timer = new Timer(executionContext.getToken());
-      timer.setDueDate(oneHour.getTime());
-      timer.setAction(action);
-
-      executionContext.getJbpmContext().getServices().getSchedulerService().createTimer(timer);
-    }
-  }
-}

Copied: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java (from rev 5818, jbpm3/branches/jbpm-3.2-soa/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java)
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java	                        (rev 0)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jbpm2603/JBPM2603Test.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -0,0 +1,114 @@
+/*
+ * 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.jbpm2603;
+
+import java.util.Calendar;
+
+import org.jbpm.db.AbstractDbTestCase;
+import org.jbpm.graph.def.Action;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.exe.ProcessInstance;
+import org.jbpm.instantiation.Delegation;
+import org.jbpm.job.Timer;
+
+/**
+ * Restore automatic save of timer actions.
+ * 
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-2603">JBPM-2603</a>
+ * @author Alejandro Guizar
+ */
+public class JBPM2603Test extends AbstractDbTestCase {
+
+  public void testStaticTimerAction() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
+      + "  name='static timer action'>"
+      + "  <start-state><transition to='mid'/></start-state>"
+      + "  <state name='mid'>"
+      + "    <timer duedate='1 hour'>"
+      + "      <action name='example' class='org.example.Action'/>"
+      + "    </timer>"
+      + "  </state>"
+      + "</process-definition>");
+    jbpmContext.deployProcessDefinition(processDefinition);
+
+    try {
+      ProcessInstance processInstance = new ProcessInstance(processDefinition);
+      processInstance.signal();
+      jbpmContext.save(processInstance);
+
+      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
+      assertEquals(processDefinition.getAction("example").getId(), timer.getAction().getId());
+    }
+    finally {
+      graphSession.deleteProcessDefinition(processDefinition.getId());
+    }
+  }
+
+  public void testDynamicTimerAction() {
+    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString("<process-definition"
+      + "  name='dynamic timer action'>"
+      + "  <start-state><transition to='mid'/></start-state>"
+      + "  <state name='mid'>"
+      + "    <event type='node-enter'>"
+      + "      <action class='"
+      + CreateDynamicTimer.class.getName()
+      + "'/>"
+      + "    </event>"
+      + "  </state>"
+      + "</process-definition>");
+    jbpmContext.deployProcessDefinition(processDefinition);
+
+    try {
+      ProcessInstance processInstance = new ProcessInstance(processDefinition);
+      processInstance.signal();
+      jbpmContext.save(processInstance);
+
+      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
+      Action action = timer.getAction();
+      assertEquals("org.example.Action", action.getActionDelegation().getClassName());
+
+      session.delete(action);
+    }
+    finally {
+      graphSession.deleteProcessDefinition(processDefinition.getId());
+    }
+  }
+
+  public static class CreateDynamicTimer implements ActionHandler {
+    private static final long serialVersionUID = 1L;
+
+    public void execute(ExecutionContext executionContext) throws Exception {
+      Action action = new Action(new Delegation("org.example.Action"));
+
+      Calendar oneHour = Calendar.getInstance();
+      oneHour.add(Calendar.HOUR_OF_DAY, 1);
+
+      Timer timer = new Timer(executionContext.getToken());
+      timer.setDueDate(oneHour.getTime());
+      timer.setAction(action);
+
+      executionContext.getJbpmContext().getServices().getSchedulerService().createTimer(timer);
+    }
+  }
+}

Deleted: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/jpdl/exe/JoinExecutionDbTest.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -1,71 +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.jpdl.exe;
-
-import org.jbpm.db.AbstractDbTestCase;
-import org.jbpm.graph.def.ProcessDefinition;
-import org.jbpm.graph.exe.ProcessInstance;
-
-public class JoinExecutionDbTest extends AbstractDbTestCase {
-
-  public void testJoinPersistence() {
-    ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
-      "<process-definition>" +
-      "  <start-state>" +
-      "    <transition to='f' />" +
-      "  </start-state>" +
-      "  <fork name='f'>" +
-      "    <transition name='a' to='a' />" +
-      "    <transition name='b' to='b' />" +
-      "  </fork>" +
-      "  <state name='a'>" +
-      "    <transition to='j' />" +
-      "  </state>" +
-      "  <state name='b'>" +
-      "    <transition to='j' />" +
-      "  </state>" +
-      "  <join name='j'>" +
-      "    <transition to='end' />" +
-      "  </join>" +
-      "  <end-state name='end'/>" +
-      "</process-definition>"
-    ); 
-    graphSession.saveProcessDefinition(processDefinition);
-    try
-    {
-      ProcessInstance processInstance = new ProcessInstance(processDefinition);
-      processInstance.signal();
-      processInstance.findToken("/a").signal();
-
-      processInstance = saveAndReload(processInstance);
-      processInstance.findToken("/b").signal();
-      
-      assertEquals("end", processInstance.getRootToken().getNode().getName());
-      assertEquals("j", processInstance.findToken("/a").getNode().getName());
-      assertEquals("j", processInstance.findToken("/b").getNode().getName());
-    }
-    finally
-    {
-      jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
-    }
-  }
-}

Modified: jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java
===================================================================
--- jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java	2009-11-03 22:11:03 UTC (rev 5879)
+++ jbpm3/branches/jbpm-3.2.8.GA_JBPM-2617/modules/core/src/test/java/org/jbpm/taskmgmt/exe/TaskTimerExecutionDbTest.java	2009-11-03 22:12:10 UTC (rev 5880)
@@ -65,7 +65,7 @@
 
       processInstance = saveAndReload(processInstance);
 
-      Timer timer = getTimer();
+      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
       assertEquals("ceiling-timer", timer.getName());
     }
     finally {
@@ -200,7 +200,7 @@
       newTransaction();
 
       // fetch the original duedate
-      Timer timer = getTimer();
+      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
       assertNotNull(timer);
       long originalDueDate = timer.getDueDate().getTime();
 
@@ -210,7 +210,7 @@
       assertEquals(new Integer(1), processInstance.getContextInstance().getVariable("count"));
 
       // check if the timer has be re-scheduled because of the repeat.
-      timer = getTimer();
+      timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
       assertNotNull(timer);
       // check that the timer was rescheduled with a duedate 60 seconds after the original duedate.
       assertEquals(originalDueDate + 60000, timer.getDueDate().getTime());
@@ -253,7 +253,7 @@
       baseDateTest.clear(Calendar.MILLISECOND);
       baseDateTest.add(Calendar.DAY_OF_YEAR, 2);
 
-      Timer timer = getTimer();
+      Timer timer = (Timer) session.createCriteria(Timer.class).uniqueResult();
       assertEquals("ceiling-timer", timer.getName());
 
       assertNotNull(timer.getDueDate());
@@ -263,8 +263,4 @@
       jbpmContext.getGraphSession().deleteProcessDefinition(processDefinition.getId());
     }
   }
-
-  private Timer getTimer() {
-    return (Timer) session.createCriteria(Timer.class).setMaxResults(1).uniqueResult();
-  }
 }



More information about the jbpm-commits mailing list