2 Replies Latest reply on May 1, 2006 2:26 PM by Torsten Hartwig

    task is not blocking after save of process-instance

    Torsten Hartwig Newbie

      Hi all,

      i wrote a little test which refers to the following process-definition:

      <process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="standardprocess">
       <start-state name="start">
       <transition name="start" to="task"></transition>
       <end-state name="end"></end-state>
       <task-node name="task" create-tasks="true">
       <task name="dummytask" blocking="true"></task>
       <transition name="stop" to="end"></transition>

      In my test-class i create a new process-instance, call a signal on the root-token and save the process-instance. So the root-token of the persistent process-instance remains in the task-node and a blocking task-instance has been created automatically. After reloading the process-instance and calling a signal again, the root-token leaves the task-node, although the blocking task-instance has not been ended. In my opinion the root-token is not allowed to leave the task node. So i started the debugger and stepped into the leave()-method of TaskNode and find out that the check tmi.hasBlockingTaskInstances(executionContext.getToken()) fails, because the token-instance in execution-context an the token-instance in the (persistent) task-instance differ. What i mean is taskInstance.getToken()!=executionContext.getToken(), because the token in the task-instance is a hibernate proxy and the token in the execution-context is a "real" token). My test-class is as follows:

      import junit.framework.TestCase;
      import org.jbpm.JbpmConfiguration;
      import org.jbpm.JbpmContext;
      import org.jbpm.graph.def.ProcessDefinition;
      import org.jbpm.graph.exe.ProcessInstance;
      public class StandardprocessTest extends TestCase {
       JbpmConfiguration jbpmConfiguration = null;
       ProcessDefinition processDefinition = null;
       ProcessInstance processInstance = null;
       protected void setUp() throws Exception {
       jbpmConfiguration = JbpmConfiguration.getInstance();
       processDefinition = ProcessDefinition
       protected void tearDown() throws Exception {
       public void testStandardprocess() {
       long processInstanceId;
       JbpmContext jbpmContext1 = jbpmConfiguration.createJbpmContext();
       try {
       processInstance = jbpmContext1
       processInstanceId = processInstance.getId();
       } finally {
       // Implicit save
       JbpmContext jbpmContext2 = jbpmConfiguration.createJbpmContext();
       try {
       processInstance = jbpmContext2
       assertEquals("task", processInstance.getRootToken().getNode()
       // Should not be allowed
       } finally {
       // Implicit save

      Any suggestions?