4 Replies Latest reply on Aug 6, 2009 4:23 PM by kukeltje

    [jBPM4] Task still in Active Activies after being completed

      Hi,

      I've encountered a problem when evaluating the task activity of jBPM4. Unfortunately the forum search is down at the moment, but I haven't found any posts regarding that issue when searching manually ;)

      Configuration:
      - jBPM4.0 standalone out of the box, only changed DB to MySQL5
      - JDK/Container: Java(TM) SE Runtime Environment (build 1.6.0_14-b08)

      Process definition:

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process name="tasktest" xmlns="http://jbpm.org/4.0/jpdl">
       <start name="start" g="77,110,48,48">
       <transition name="to task" to="task" g="-36,-20" />
       </start>
       <task assignee="freiburger" name="task" g="206,127,92,52">
       <transition name="to wait" to="wait" g="-36,-20" />
       </task>
       <state name="wait" g="401,154,92,52">
       <transition name="to end" to="end" g="-41,-20" />
       </state>
       <end name="end" g="543,121,48,48" />
      </process>
      


      API using JbpmTestCase:
      public void testTakeTask() {
       /* Create process instance */
       ProcessInstance processInstance = executionService
       .startProcessInstanceByKey("tasktest");
      
       /* Find tasks for freiburger (1 expected) */
       List<Task> taskList = taskService.findPersonalTasks("freiburger");
       assertEquals(1, taskList.size());
       Task task = taskList.get(0);
       assertEquals("task", task.getName());
       assertEquals("freiburger", task.getAssignee());
      
       /* Complete task */
       taskService.completeTask(task.getId());
      
       /* Find tasks for freiburger (0 expected) */
       taskList = taskService.findPersonalTasks("freiburger");
       assertEquals(0, taskList.size());
      
       /* Find active activities ("wait" expected) */
       Set<String> expectedActivityNames = new HashSet<String>();
       expectedActivityNames.add("wait");
       assertEquals(expectedActivityNames, processInstance
       .findActiveActivityNames());
      }
      


      Log
      18:30:27,357 FIN | [ProcessDefinitionImpl] creating new execution for process 'tasktest'
      18:30:27,365 FIN | [DefaultIdGenerator] generated execution id tasktest.1
      18:30:27,372 FIN | [ExecuteActivity] executing activity(start)
      18:30:27,372 FIN | [ExecuteActivity] executing activity(task)
      18:30:27,459 FIN | [TaskQueryImpl] select task from org.jbpm.pvm.internal.task.TaskImpl as task where task.assignee = :assignee order by task.priority desc
      18:30:27,467 FIN | [TaskQueryImpl] setting parameter assignee: freiburger
      18:30:27,518 FIN | [Signal] signalling activity(task), signalName=completed
      18:30:27,527 FIN | [ExecuteActivity] executing activity(wait)
      18:30:27,559 FIN | [TaskQueryImpl] select task from org.jbpm.pvm.internal.task.TaskImpl as task where task.assignee = :assignee order by task.priority desc
      18:30:27,559 FIN | [TaskQueryImpl] setting parameter assignee: freiburger
      18:30:27,561 SEV | [BaseJbpmTestCase]
      ### EXCEPTION ###########################################
      18:30:27,561 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: expected:<[wait]> but was:<[task]>
      junit.framework.AssertionFailedError: expected:<[wait]> but was:<[task]>
       at junit.framework.Assert.fail(Assert.java:47)
       at junit.framework.Assert.failNotEquals(Assert.java:282)
       at junit.framework.Assert.assertEquals(Assert.java:64)
       at junit.framework.Assert.assertEquals(Assert.java:71)
       at testing.TakeTaskTest.testTakeTask(TakeTaskTest.java:49)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at junit.framework.TestCase.runTest(TestCase.java:154)
       at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at junit.framework.TestSuite.runTest(TestSuite.java:208)
       at junit.framework.TestSuite.run(TestSuite.java:203)
       at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
       at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      ### EXCEPTION ###########################################
      18:30:27,562 SEV | [BaseJbpmTestCase]
      18:30:27,607 FIN | [DbSessionImpl] deleting history process instance tasktest.1
      18:30:27,640 FIN | [DbSessionImpl] deleting process instance tasktest.1
      18:30:27,654 FIN | [DeleteDeploymentCmd] deleting deployment 1
      18:30:27,706 FIN | [BaseJbpmTestCase] === ending testTakeTask =============================
      


      Problem description
      So obviously the task was not removed from the current activities after completion. Still the engine moves on to the next activity, but it doesn't show up in the activity list at all. I quite don't understand this behaviour if it is intended, any help is greatly appreciated.

      Thanks!