1 2 3 Previous Next 43 Replies Latest reply on Sep 16, 2009 9:04 AM by mmusaji Go to original post
      • 15. Re: workflow design about wait states
        kukeltje

        I never said you should remove async in your final version I just metioned it as one of the things to try in finding the cause. And that should be possible shouldn't it?

        Correct, the custom node class async but once it is finished it does nothing. If you want it to leave the node, you have to add execution.take(); If you do not want it to leave directly after it finished in the execute, add a execution.waitForSignal() and implement the signal(...) method. Again, see the examples.

        The way you do in now, your process is in an undefined state. And if in a unit test you manually execute the async jobs (see the examples again) you can check in what custom nodes the executions are in. That is how you should use unittests. The examples are very good for this.

        • 16. Re: workflow design about wait states
          mmusaji

          Hi Ronald,

          Okay that is starting to make sense now. I know how the Unit Tests should work, but what I was missing was leaving the node when they finished. I didn't know this had to be done.

          Thanks again for pointing me in the right direction... and your patience. I know it must be frustrating sometimes! :)

          • 17. Re: workflow design about wait states
            kukeltje

            It is if the 'others' are not resposive or sometimes react negatively if I mention simple things like 'look at the examples'. But if they are all like you, it is not that depressing. In fact this thread would be nice for others to read as well who like to do things like this. Would be e.g. nice if you could write a blog entry about this once it works. The errors you ran into/made and how they were solved.

            I understand you know how unitests should work, but you focusses on not having an execution in 'wait´ while the focus should have been on 'where are they then?'. If you'd have seen they were still in the custom nodes, maybe it sould have been quicker to get to the cause... ;-)

            • 18. Re: workflow design about wait states
              mmusaji

              Would love to write a blog entry about this, get more involved with jboss and jbpm is my ultimate aim. I need to know what I'm talking about first! ;) Unfortunately... with work pressures etc its not always possible. We'll see...

              Taking the "async" out it works fine, I can see the nodes and assert which one they should be in. When the custom nodes run in async, the unit test runs to completion quicker than the actual workflow completes (or vice versa not sure). So when I do:

              Execution execution = processInstance.findActiveExecutionIn("validate one request");
               assertNotNull(execution ); //FAILS
               String executionId = execution .getId();
               executionService.signalExecutionById(executionId);
              


              The assertion fails. In my custom class I have the following line
              public void execute(ActivityExecution execution {
               //my code....
               execution.waitForSignal();
              }
              
              
              public void signal(ActivityExecution execution,
               String signalName,
               Map<String, ?> parameters) {
               execution.take(signalName);
               }
              
              


              and they all implement ExternalActivityBehaviour. I have no idea what state these are in now.


              • 19. Re: workflow design about wait states
                kukeltje

                probably you have to do a sleep in your unit test to give the custom nodes time to fully finish...

                Or what would probably be better is to have the classes do a take() in the execute and let the join be the 'wait for all branches to finish' (that is what it is for). The aforementioned sleep is not needed then.

                And why do you use the continue="exclusive" on the join?

                • 20. Re: workflow design about wait states
                  mmusaji

                  This was my original problem... in real world I wont know how long to sleep for. I need to read the objects back but only once they have all been updated after a certain amount of time (which could be 2 seconds or 20 seconds).

                  When I use take("join"), I get

                  org.jbpm.api.JbpmException: there is no transition join in activity(validate red request)
                  . But there is.

                  I use takeDefaultTransition() (no sleep in my unit test) I get StaleObjectStateException because my unit test and my workflow are out of sync. This was pointed out my JBarrez in one of my previous posts. The sleep in my unit test solved this problem.

                  If I don't use continue="exclusive" in the join, then my workflow doesn't continue past the join... just stops.

                  Do you know how the waitForSignal() and takeDefaultTransition() methods are affected (if at all) when used async? Using them normally like in the examples they work fine.

                  • 21. Re: workflow design about wait states
                    kukeltje

                    No, there is not transition *named* join, there only is a transition *to* join. And take() without any param should also work. It takes the default one if there is only one (duh.. ;-))

                    You do not need a sleep at all since the join should only continue if *all* incoming transitions are triggered. I think you misunderstood Joram (or he misunderstood you)

                    Can you make a unitest with everything embedded like in http://www.jboss.org/index.html?module=bb&op=viewtopic&t=158424 so the actionhandlers are inner classes etc...

                    Just start, fork, two custom nodes (async) , one join and one end. Lets first get that working (and include it as an example eventually in jBPM.

                    • 22. Re: workflow design about wait states
                      mmusaji

                      Okay so I took your advice and went back to basics. What I'm finding is if i have a node after the join (in my my case a custom node), the Unit test fails to find the execution in this. With a join going straight to an end it is ok.

                      My workflow:

                      <?xml version="1.0" encoding="UTF-8"?>
                      
                      <process name="process" xmlns="http://jbpm.org/4.0/jpdl">
                       <start>
                       <transition to="custom one"/>
                       </start>
                      
                       <custom class="org.workflow.test.forum.ProcessTest$CustomOne" name="custom one">
                       <transition to="fork"/>
                       </custom>
                      
                       <fork name="fork">
                       <transition name="custom two" to="custom two"/>
                       <transition name="custom three" to="custom three"/>
                       </fork>
                      
                       <custom continue="async" name="custom two" class="org.workflow.test.forum.ProcessTest$CustomTwo">
                       <transition to="join"/>
                       </custom>
                      
                       <custom continue="async" name="custom three" class="org.workflow.test.forum.ProcessTest$CustomThree">
                       <transition to="join"/>
                       </custom>
                      
                       <join name="join">
                       <transition name="custom four" to="custom four"/>
                       </join>
                      
                       <custom name="custom four" class="org.workflow.test.forum.ProcessTest$CustomFour">
                       <transition to="end"/>
                       </custom>
                      
                       <task name="end">
                       <transition name="to complete" to="end process"/>
                       </task>
                      
                       <end name="end process" state="complete"/>
                      
                       </process>
                      


                      I can't figure out how to test the custom four node. Without this things are working as expected but to me it seems like my unit test stops at the join and doesn't signal the workflow to carry on?

                      package org.workflow.test.forum;
                      
                      import java.util.List;
                      import java.util.Map;
                      
                      import org.jbpm.api.Execution;
                      import org.jbpm.api.ProcessInstance;
                      import org.jbpm.api.activity.ActivityExecution;
                      import org.jbpm.api.activity.ExternalActivityBehaviour;
                      import org.jbpm.api.job.Job;
                      import org.jbpm.test.JbpmTestCase;
                      
                      public class ProcessTest extends JbpmTestCase {
                       String deploymentDbid;
                      
                       protected void setUp() throws Exception {
                       super.setUp();
                       deploymentDbid = repositoryService.createDeployment()
                       .addResourceFromClasspath("org/workflow/test/forum/process.jpdl.xml")
                       .deploy();
                       }
                      
                       protected void tearDown() throws Exception {
                       repositoryService.deleteDeploymentCascade(deploymentDbid);
                       super.tearDown();
                       }
                      
                       public void testProcess() throws Exception {
                       ProcessInstance processInstance = executionService.startProcessInstanceByKey("process");
                       Execution executionInOne = processInstance.findActiveExecutionIn("custom one");
                       assertNotNull(executionInOne);
                       processInstance = executionService.signalExecutionById(executionInOne.getId());
                      
                       String processInstanceId = processInstance.getId();
                      
                       List<Job> jobs = managementService.createJobQuery()
                       .processInstanceId(processInstanceId)
                       .list();
                      
                       assertEquals(2, jobs.size());
                      
                       Job job = jobs.get(0);
                      
                       managementService.executeJob(job.getId());
                      
                       job = jobs.get(1);
                      
                       managementService.executeJob(job.getId());
                      
                       Execution executionInFour = processInstance.findActiveExecutionIn("custom four");
                       assertNotNull(executionInFour);
                       processInstance = executionService.signalExecutionById(executionInFour.getId());
                       }
                      
                       public static class CustomOne implements ExternalActivityBehaviour {
                       private static final long serialVersionUID = 1L;
                      
                       public void execute(ActivityExecution execution) throws Exception {
                       System.out.println("Executing");
                      
                       System.out.println(execution.getActivityName());
                      
                       execution.waitForSignal();
                       }
                      
                       public void signal(ActivityExecution execution,
                       String signalName,
                       Map<String, ?> parameters) {
                       execution.take(signalName);
                       }
                       }
                      
                       public static class CustomTwo implements ExternalActivityBehaviour {
                       private static final long serialVersionUID = 1L;
                      
                       public void execute(ActivityExecution execution) throws Exception {
                       System.out.println("Executing");
                      
                       System.out.println(execution.getActivityName());
                      
                       execution.waitForSignal();
                       }
                      
                       public void signal(ActivityExecution execution,
                       String signalName,
                       Map<String, ?> parameters) {
                       execution.take(signalName);
                       }
                       }
                      
                       public static class CustomThree implements ExternalActivityBehaviour {
                       private static final long serialVersionUID = 1L;
                      
                       public void execute(ActivityExecution execution) throws Exception {
                       System.out.println("Executing");
                      
                       System.out.println(execution.getActivityName());
                      
                       execution.waitForSignal();
                       }
                      
                       public void signal(ActivityExecution execution,
                       String signalName,
                       Map<String, ?> parameters) {
                       execution.take(signalName);
                       }
                       }
                      
                       public static class CustomFour implements ExternalActivityBehaviour {
                       private static final long serialVersionUID = 1L;
                      
                       public void execute(ActivityExecution execution) throws Exception {
                       System.out.println("Executing");
                      
                       System.out.println(execution.getActivityName());
                      
                       execution.waitForSignal();
                       }
                      
                       public void signal(ActivityExecution execution,
                       String signalName,
                       Map<String, ?> parameters) {
                       execution.take(signalName);
                       }
                       }
                      
                      }
                      
                      


                      Output:
                      12:44:53,841 FIN | [BaseJbpmTestCase] === starting testProcess =============================
                      12:44:53,981 FIN | [BaseJbpmTestCase] using ProcessEngine 78236
                      log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
                      log4j:WARN Please initialize the log4j system properly.
                      12:44:55,122 FIN | [ProcessDefinitionImpl] creating new execution for process 'process'
                      12:44:55,122 FIN | [DefaultIdGenerator] generated execution id process.149
                      Executing
                      custom one
                      12:44:55,122 FIN | [ExecuteActivity] executing activity(12319324)
                      12:44:55,122 FIN | [ExecuteActivity] executing activity(custom one)
                      12:44:55,137 FIN | [Signal] signalling activity(custom one), signalName=null
                      12:44:55,137 FIN | [ExecuteActivity] executing activity(fork)
                      12:44:55,137 FIN | [DefaultIdGenerator] generated execution id process.149.custom two
                      12:44:55,137 FIN | [ExecutionImpl] created execution[process.149.custom two]
                      12:44:55,137 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                      12:44:55,153 INF | [JobExecutorThread] starting...
                      12:44:55,153 INF | [JobExecutorThread] starting...
                      12:44:55,153 INF | [JobExecutorThread] starting...
                      12:44:55,153 INF | [DispatcherThread] starting...
                      12:44:55,153 FIN | [DefaultIdGenerator] generated execution id process.149.custom three
                      12:44:55,153 FIN | [ExecutionImpl] created execution[process.149.custom three]
                      12:44:55,153 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                      12:44:55,153 FIN | [AcquireJobsCmd] start querying first acquirable job...
                      12:44:55,153 FIN | [AcquireJobsCmd] locking jobs []
                      12:44:55,153 FIN | [GetNextDueDateCmd] getting next due date...
                      12:44:55,153 FIN | [GetNextDueDateCmd] next due date is null
                      12:44:55,153 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1d27069
                      12:44:55,153 FIN | [DispatcherThread] DispatcherThread woke up
                      12:44:55,153 FIN | [AcquireJobsCmd] start querying first acquirable job...
                      12:44:55,169 FIN | [AcquireJobsCmd] locking jobs [184]
                      12:44:55,169 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[184]...
                      12:44:55,169 FIN | [DispatcherThread] pushing jobs on the queue [184]
                      12:44:55,169 FIN | [DispatcherThread] added jobs [184] to the queue
                      12:44:55,169 FIN | [AcquireJobsCmd] start querying first acquirable job...
                      Executing
                      custom two
                      12:44:55,169 FIN | [JobExecutorThread] took job(s) [184] from queue
                      12:44:55,169 FIN | [AcquireJobsCmd] locking jobs [185]
                      12:44:55,184 FIN | [ExecuteActivity] execution[process.149.custom two] executes activity(custom two)
                      12:44:55,184 FIN | [DispatcherThread] pushing jobs on the queue [185]
                      12:44:55,184 FIN | [DispatcherThread] added jobs [185] to the queue
                      12:44:55,184 FIN | [AcquireJobsCmd] start querying first acquirable job...
                      12:44:55,184 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[184]
                      12:44:55,184 FIN | [AcquireJobsCmd] locking jobs []
                      12:44:55,184 FIN | [GetNextDueDateCmd] getting next due date...
                      12:44:55,184 FIN | [GetNextDueDateCmd] next due date is null
                      12:44:55,184 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1d27069
                      12:44:55,184 FIN | [JobExecutorThread] took job(s) [185] from queue
                      12:44:55,231 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[185]...
                      Executing
                      custom three
                      12:44:55,231 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[184]...
                      12:44:55,231 FIN | [ExecuteActivity] execution[process.149.custom three] executes activity(custom three)
                      12:44:55,231 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[185]
                      12:44:55,247 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[184]...
                      Executing
                      custom two
                      12:44:55,247 FIN | [ExecuteActivity] execution[process.149.custom two] executes activity(custom two)
                      12:44:55,247 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[184]
                      12:44:55,247 FIN | [ExecuteActivity] execution[process.149.custom two] executes activity(custom two)
                      Executing
                      custom two
                      12:44:55,247 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[184]
                      12:44:55,450 FIN | [ExecuteJobCmd] job 184 no longer exists
                      12:44:55,450 FIN | [ExecuteJobCmd] job 185 no longer exists
                      12:44:55,450 SEV | [BaseJbpmTestCase]
                      ### EXCEPTION ###########################################
                      12:44:55,466 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: null
                      junit.framework.AssertionFailedError
                       at junit.framework.Assert.fail(Assert.java:47)
                       at junit.framework.Assert.assertTrue(Assert.java:20)
                       at junit.framework.Assert.assertNotNull(Assert.java:220)
                       at junit.framework.Assert.assertNotNull(Assert.java:213)
                       at org.workflow.test.forum.ProcessTest.testProcess(ProcessTest.java:51)
                       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:460)
                       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                       at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                      ### EXCEPTION ###########################################
                      12:44:55,466 SEV | [BaseJbpmTestCase]
                      12:44:55,481 FIN | [DbSessionImpl] deleting history process instance process.149
                      12:44:55,497 FIN | [DbSessionImpl] deleting process instance process.149
                      12:44:55,497 FIN | [DeleteDeploymentCmd] deleting deployment 87
                      12:44:55,528 FIN | [BaseJbpmTestCase] === ending testProcess =============================
                      


                      Also are the classes being called twice? Is it once by the startProcessInstanceByKey and then again my the job in the unit tests?


                      • 23. Re: workflow design about wait states
                        kukeltje

                        Nice test now, I'll try to see what happens on my side later today.

                        But I think it is related to the fact that you made the nodes not only be carried out in async, but also made it waitstates AFTER the 'execute' method is ended. (by using the waitForSignal). In your testcase you have to signal both states then. But if you replace the waitForSignal() with a take() (as mentioned earlier) then the custom node automatically continues and should pass the join.

                        Without the customFour, your process is most likely still not ended (you can check that by building it in your test)

                        • 24. Re: workflow design about wait states
                          mmusaji

                          Thanks for that Ronald, be a huge help if you can see what I'm doing wrong.

                          So I changed the async nodes (custom one and two) to takeDefaultTransition().

                          package org.workflow.test.forum;
                          
                          import java.util.List;
                          import java.util.Map;
                          
                          import org.jbpm.api.Execution;
                          import org.jbpm.api.ProcessInstance;
                          import org.jbpm.api.activity.ActivityExecution;
                          import org.jbpm.api.activity.ExternalActivityBehaviour;
                          import org.jbpm.api.job.Job;
                          import org.jbpm.test.JbpmTestCase;
                          
                          public class ProcessTest extends JbpmTestCase {
                           String deploymentDbid;
                          
                           protected void setUp() throws Exception {
                           super.setUp();
                           deploymentDbid = repositoryService.createDeployment()
                           .addResourceFromClasspath("org/workflow/test/forum/process.jpdl.xml")
                           .deploy();
                           }
                          
                           protected void tearDown() throws Exception {
                           repositoryService.deleteDeploymentCascade(deploymentDbid);
                           super.tearDown();
                           }
                          
                           public void testProcess() throws Exception {
                           ProcessInstance processInstance = executionService.startProcessInstanceByKey("process");
                           Execution executionInOne = processInstance.findActiveExecutionIn("custom one");
                           assertNotNull(executionInOne);
                           processInstance = executionService.signalExecutionById(executionInOne.getId());
                          
                           String processInstanceId = processInstance.getId();
                          
                           List<Job> jobs = managementService.createJobQuery()
                           .processInstanceId(processInstanceId)
                           .list();
                          
                           assertEquals(2, jobs.size());
                          
                           Job job = jobs.get(0);
                          
                           managementService.executeJob(job.getId());
                          
                           job = jobs.get(1);
                          
                           managementService.executeJob(job.getId());
                          
                           Execution executionInFour = processInstance.findActiveExecutionIn("custom four");
                           assertNotNull(executionInFour);
                           processInstance = executionService.signalExecutionById(executionInFour.getId());
                           }
                          
                           public static class CustomOne implements ExternalActivityBehaviour {
                           private static final long serialVersionUID = 1L;
                          
                           public void execute(ActivityExecution execution) throws Exception {
                           System.out.println("Executing");
                          
                           System.out.println(execution.getActivityName());
                          
                           execution.waitForSignal();
                           }
                          
                           public void signal(ActivityExecution execution,
                           String signalName,
                           Map<String, ?> parameters) {
                           execution.take(signalName);
                           }
                           }
                          
                           public static class CustomTwo implements ExternalActivityBehaviour {
                           private static final long serialVersionUID = 1L;
                          
                           public void execute(ActivityExecution execution) throws Exception {
                           System.out.println("Executing");
                          
                           System.out.println(execution.getActivityName());
                          
                           execution.takeDefaultTransition();
                           }
                          
                           public void signal(ActivityExecution execution,
                           String signalName,
                           Map<String, ?> parameters) {
                           execution.take(signalName);
                           }
                           }
                          
                           public static class CustomThree implements ExternalActivityBehaviour {
                           private static final long serialVersionUID = 1L;
                          
                           public void execute(ActivityExecution execution) throws Exception {
                           System.out.println("Executing");
                          
                           System.out.println(execution.getActivityName());
                          
                           execution.takeDefaultTransition();
                           }
                          
                           public void signal(ActivityExecution execution,
                           String signalName,
                           Map<String, ?> parameters) {
                           execution.take(signalName);
                           }
                           }
                          
                           public static class CustomFour implements ExternalActivityBehaviour {
                           private static final long serialVersionUID = 1L;
                          
                           public void execute(ActivityExecution execution) throws Exception {
                           System.out.println("Executing");
                          
                           System.out.println(execution.getActivityName());
                          
                           execution.waitForSignal();
                           }
                          
                           public void signal(ActivityExecution execution,
                           String signalName,
                           Map<String, ?> parameters) {
                           execution.take(signalName);
                           }
                           }
                          
                          }
                          
                          


                          With the same workflow as before I get custom four node as showing output but still get null when the unittest attempts to find execution in this node.

                          13:58:02,975 FIN | [BaseJbpmTestCase] === starting testProcess =============================
                          13:58:03,100 FIN | [BaseJbpmTestCase] using ProcessEngine 22743805
                          log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
                          log4j:WARN Please initialize the log4j system properly.
                          13:58:04,288 FIN | [ProcessDefinitionImpl] creating new execution for process 'process'
                          13:58:04,288 FIN | [DefaultIdGenerator] generated execution id process.222
                          Executing
                          custom one
                          13:58:04,288 FIN | [ExecuteActivity] executing activity(14731203)
                          13:58:04,288 FIN | [ExecuteActivity] executing activity(custom one)
                          13:58:04,303 FIN | [Signal] signalling activity(custom one), signalName=null
                          13:58:04,303 FIN | [ExecuteActivity] executing activity(fork)
                          13:58:04,303 FIN | [DefaultIdGenerator] generated execution id process.222.custom two
                          13:58:04,303 FIN | [ExecutionImpl] created execution[process.222.custom two]
                          13:58:04,319 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                          13:58:04,319 INF | [JobExecutorThread] starting...
                          13:58:04,319 INF | [JobExecutorThread] starting...
                          13:58:04,319 INF | [JobExecutorThread] starting...
                          13:58:04,319 INF | [DispatcherThread] starting...
                          13:58:04,319 FIN | [DefaultIdGenerator] generated execution id process.222.custom three
                          13:58:04,319 FIN | [ExecutionImpl] created execution[process.222.custom three]
                          13:58:04,319 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                          13:58:04,319 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,319 FIN | [AcquireJobsCmd] locking jobs []
                          13:58:04,319 FIN | [GetNextDueDateCmd] getting next due date...
                          13:58:04,319 FIN | [GetNextDueDateCmd] next due date is null
                          13:58:04,319 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1ff2e1b
                          13:58:04,319 FIN | [DispatcherThread] DispatcherThread woke up
                          13:58:04,335 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,335 FIN | [AcquireJobsCmd] locking jobs [296]
                          13:58:04,335 FIN | [DispatcherThread] pushing jobs on the queue [296]
                          13:58:04,335 FIN | [DispatcherThread] added jobs [296] to the queue
                          13:58:04,335 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,335 FIN | [AcquireJobsCmd] locking jobs [297]
                          13:58:04,335 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[296]...
                          13:58:04,335 FIN | [JobExecutorThread] took job(s) [296] from queue
                          13:58:04,335 FIN | [DispatcherThread] pushing jobs on the queue [297]
                          13:58:04,335 FIN | [DispatcherThread] added jobs [297] to the queue
                          13:58:04,335 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,350 FIN | [AcquireJobsCmd] locking jobs []
                          13:58:04,350 FIN | [GetNextDueDateCmd] getting next due date...
                          13:58:04,350 FIN | [GetNextDueDateCmd] next due date is null
                          13:58:04,350 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1ff2e1b
                          Executing
                          custom two
                          13:58:04,350 FIN | [ExecuteActivity] execution[process.222.custom two] executes activity(custom two)
                          13:58:04,350 FIN | [JobExecutorThread] took job(s) [297] from queue
                          13:58:04,350 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                          13:58:04,350 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[297]...
                          Executing
                          custom three
                          13:58:04,350 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[296]
                          13:58:04,366 FIN | [ExecuteActivity] execution[process.222.custom three] executes activity(custom three)
                          13:58:04,366 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                          13:58:04,366 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[297]
                          13:58:04,366 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[297]...
                          13:58:04,366 FIN | [ExecuteJobCmd] job 296 no longer exists
                          Executing
                          custom three
                          13:58:04,366 FIN | [DispatcherThread] DispatcherThread woke up
                          13:58:04,366 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,366 FIN | [ExecuteActivity] execution[process.222.custom three] executes activity(custom three)
                          13:58:04,366 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                          13:58:04,366 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[297]
                          13:58:04,381 FIN | [AcquireJobsCmd] locking jobs [298, 299]
                          13:58:04,381 FIN | [DispatcherThread] pushing jobs on the queue [298, 299]
                          13:58:04,381 FIN | [DispatcherThread] added jobs [298, 299] to the queue
                          13:58:04,381 FIN | [JobExecutorThread] took job(s) [298, 299] from queue
                          13:58:04,381 FIN | [AcquireJobsCmd] start querying first acquirable job...
                          13:58:04,381 FIN | [AcquireJobsCmd] locking jobs []
                          13:58:04,381 FIN | [GetNextDueDateCmd] getting next due date...
                          13:58:04,381 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[298]...
                          13:58:04,381 FIN | [GetNextDueDateCmd] next due date is null
                          13:58:04,381 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1ff2e1b
                          13:58:04,381 FIN | [ExecuteActivity] execution[process.222.custom two] executes activity(join)
                          13:58:04,381 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[298]
                          13:58:04,381 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[299]...
                          13:58:04,397 FIN | [ExecuteActivity] execution[process.222.custom three] executes activity(join)
                          13:58:04,397 FIN | [ExecutionImpl] execution[process.222.custom two] ends
                          13:58:04,397 FIN | [ExecutionImpl] execution[process.222.custom three] ends
                          13:58:04,397 FIN | [ExecuteActivity] executing activity(custom four)
                          Executing
                          custom four
                          13:58:04,397 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[299]
                          13:58:04,428 FIN | [ExecuteJobCmd] job 297 no longer exists
                          13:58:04,428 SEV | [BaseJbpmTestCase]
                          ### EXCEPTION ###########################################
                          13:58:04,428 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: null
                          junit.framework.AssertionFailedError
                           at junit.framework.Assert.fail(Assert.java:47)
                           at junit.framework.Assert.assertTrue(Assert.java:20)
                           at junit.framework.Assert.assertNotNull(Assert.java:220)
                           at junit.framework.Assert.assertNotNull(Assert.java:213)
                           at org.workflow.test.forum.ProcessTest.testProcess(ProcessTest.java:51)
                           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:460)
                           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                           at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                          ### EXCEPTION ###########################################
                          13:58:04,428 SEV | [BaseJbpmTestCase]
                          13:58:04,444 FIN | [DbSessionImpl] deleting history process instance process.222
                          13:58:04,460 FIN | [DbSessionImpl] deleting process instance process.222
                          13:58:04,460 FIN | [DeleteDeploymentCmd] deleting deployment 109
                          13:58:04,475 FIN | [BaseJbpmTestCase] === ending testProcess =============================
                          


                          • 25. Re: workflow design about wait states
                            mmusaji

                            I've added...

                             processInstance = executionService.findProcessInstanceById(processInstanceId);
                            
                             Execution executionInFour = processInstance.findActiveExecutionIn("custom four");
                             assertNotNull(executionInFour);
                             processInstance = executionService.signalExecutionById(executionInFour.getId());
                            

                            ...to my unit test.

                            Now I'm not getting any exceptions and the output looks like this:
                            15:14:34,393 FIN | [BaseJbpmTestCase] === starting testProcess =============================
                            15:14:34,518 FIN | [BaseJbpmTestCase] using ProcessEngine 78236
                            log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
                            log4j:WARN Please initialize the log4j system properly.
                            15:14:35,675 FIN | [ProcessDefinitionImpl] creating new execution for process 'process'
                            15:14:35,675 FIN | [DefaultIdGenerator] generated execution id process.277
                            15:14:35,675 FIN | [ExecuteActivity] executing activity(16408563)
                            15:14:35,675 FIN | [ExecuteActivity] executing activity(custom one)
                            Executing
                            custom one
                            15:14:35,690 FIN | [Signal] signalling activity(custom one), signalName=null
                            15:14:35,690 FIN | [ExecuteActivity] executing activity(fork)
                            15:14:35,706 FIN | [DefaultIdGenerator] generated execution id process.277.custom two
                            15:14:35,706 FIN | [ExecutionImpl] created execution[process.277.custom two]
                            15:14:35,706 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                            15:14:35,706 INF | [JobExecutorThread] starting...
                            15:14:35,706 INF | [JobExecutorThread] starting...
                            15:14:35,706 INF | [JobExecutorThread] starting...
                            15:14:35,706 INF | [DispatcherThread] starting...
                            15:14:35,706 FIN | [DefaultIdGenerator] generated execution id process.277.custom three
                            15:14:35,706 FIN | [ExecutionImpl] created execution[process.277.custom three]
                            15:14:35,706 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                            15:14:35,722 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            15:14:35,722 FIN | [AcquireJobsCmd] locking jobs []
                            15:14:35,722 FIN | [GetNextDueDateCmd] getting next due date...
                            15:14:35,722 FIN | [GetNextDueDateCmd] next due date is null
                            15:14:35,722 FIN | [DispatcherThread] skipped wait because new message arrived
                            15:14:35,722 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            15:14:35,722 FIN | [AcquireJobsCmd] locking jobs [390]
                            15:14:35,722 FIN | [DispatcherThread] pushing jobs on the queue [390]
                            15:14:35,722 FIN | [DispatcherThread] added jobs [390] to the queue
                            15:14:35,722 FIN | [JobExecutorThread] took job(s) [390] from queue
                            15:14:35,722 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            15:14:35,722 FIN | [AcquireJobsCmd] locking jobs [391]
                            15:14:35,722 FIN | [DispatcherThread] pushing jobs on the queue [391]
                            15:14:35,722 FIN | [DispatcherThread] added jobs [391] to the queue
                            15:14:35,722 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            15:14:35,737 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[390]...
                            15:14:35,737 FIN | [AcquireJobsCmd] locking jobs []
                            15:14:35,737 FIN | [GetNextDueDateCmd] getting next due date...
                            15:14:35,737 FIN | [GetNextDueDateCmd] next due date is null
                            15:14:35,737 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@cd4544
                            15:14:35,737 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[390]...
                            15:14:35,784 FIN | [JobExecutorThread] took job(s) [391] from queue
                            Executing
                            custom two
                            Executing
                            custom two
                            15:14:35,784 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[391]...
                            15:14:35,784 FIN | [ExecuteActivity] execution[process.277.custom two] executes activity(custom two)
                            15:14:35,784 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                            15:14:35,784 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[390]
                            15:14:35,800 FIN | [ExecuteActivity] execution[process.277.custom two] executes activity(custom two)
                            15:14:35,800 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                            15:14:35,800 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[390]
                            15:14:35,800 FIN | [ExecuteActivity] execution[process.277.custom three] executes activity(custom three)
                            15:14:35,800 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                            15:14:35,800 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[391]
                            15:14:35,800 FIN | [DispatcherThread] DispatcherThread woke up
                            15:14:35,800 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            Executing
                            custom three
                            15:14:35,815 FIN | [AcquireJobsCmd] locking jobs [393, 394]
                            15:14:35,815 FIN | [DispatcherThread] pushing jobs on the queue [393, 394]
                            15:14:35,815 FIN | [DispatcherThread] added jobs [393, 394] to the queue
                            15:14:35,815 FIN | [AcquireJobsCmd] start querying first acquirable job...
                            15:14:35,815 FIN | [AcquireJobsCmd] locking jobs []
                            15:14:35,815 FIN | [JobExecutorThread] took job(s) [393, 394] from queue
                            15:14:35,815 FIN | [GetNextDueDateCmd] getting next due date...
                            15:14:35,815 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[393]...
                            15:14:35,815 FIN | [GetNextDueDateCmd] next due date is null
                            15:14:35,815 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@cd4544
                            15:14:35,815 FIN | [ExecuteActivity] execution[process.277.custom two] executes activity(join)
                            15:14:35,815 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[393]
                            15:14:35,831 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[394]...
                            15:14:35,831 FIN | [ExecuteActivity] execution[process.277.custom three] executes activity(join)
                            15:14:35,831 FIN | [ExecutionImpl] execution[process.277.custom two] ends
                            15:14:35,831 FIN | [ExecutionImpl] execution[process.277.custom three] ends
                            15:14:35,831 FIN | [ExecuteActivity] executing activity(custom four)
                            Executing
                            custom four
                            15:14:35,831 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[394]
                            15:14:35,862 FIN | [ExecuteJobCmd] job 390 no longer exists
                            15:14:35,862 FIN | [ExecuteJobCmd] job 391 no longer exists
                            15:14:35,862 FIN | [Signal] signalling activity(custom four), signalName=null
                            15:14:35,862 FIN | [ExecuteActivity] executing activity(end)
                            15:14:35,893 FIN | [DbSessionImpl] deleting history process instance process.277
                            15:14:35,909 FIN | [DbSessionImpl] deleting process instance process.277
                            15:14:35,909 FIN | [DeleteDeploymentCmd] deleting deployment 124
                            15:14:35,940 FIN | [BaseJbpmTestCase] === ending testProcess =============================
                            


                            Still uncertain if my process has ended correctly. Attempting to put this in to my "proper" workflow with more custom nodes is still showing errors.


                            • 26. Re: workflow design about wait states
                              kukeltje

                              your processinstance is really ended if retrieving it from the executionservice by id (processinstance id) is null. If it is not null isEnded() on the processInstance will return false. So you can add that at the end of your test.

                              Attempting to put this in to my "proper" workflow with more custom nodes is still showing errors.


                              Where? How? Errors? Please, otherwise we can't help

                              • 27. Re: workflow design about wait states
                                mmusaji

                                As expected...

                                 if(executionService.findProcessInstanceById(processInstanceId) != null) {
                                 assertFalse(processInstance.isEnded());
                                 }else {
                                assertNull(executionService.findProcessInstanceById(processInstanceId));
                                 }
                                


                                11:48:43,264 FIN | [BaseJbpmTestCase] === starting testProcess =============================
                                11:48:43,389 FIN | [BaseJbpmTestCase] using ProcessEngine 78236
                                log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
                                log4j:WARN Please initialize the log4j system properly.
                                11:48:44,530 FIN | [ProcessDefinitionImpl] creating new execution for process 'process'
                                11:48:44,545 FIN | [DefaultIdGenerator] generated execution id process.363
                                11:48:44,545 FIN | [ExecuteActivity] executing activity(20045467)
                                11:48:44,545 FIN | [ExecuteActivity] executing activity(custom one)
                                Executing
                                custom one
                                11:48:44,561 FIN | [Signal] signalling activity(custom one), signalName=null
                                11:48:44,561 FIN | [ExecuteActivity] executing activity(fork)
                                11:48:44,561 FIN | [DefaultIdGenerator] generated execution id process.363.custom two
                                11:48:44,561 FIN | [ExecutionImpl] created execution[process.363.custom two]
                                11:48:44,561 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,576 INF | [JobExecutorThread] starting...
                                11:48:44,576 INF | [JobExecutorThread] starting...
                                11:48:44,576 INF | [JobExecutorThread] starting...
                                11:48:44,576 INF | [DispatcherThread] starting...
                                11:48:44,576 FIN | [DefaultIdGenerator] generated execution id process.363.custom three
                                11:48:44,576 FIN | [ExecutionImpl] created execution[process.363.custom three]
                                11:48:44,576 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,576 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,576 FIN | [AcquireJobsCmd] locking jobs []
                                11:48:44,576 FIN | [GetNextDueDateCmd] getting next due date...
                                11:48:44,576 FIN | [GetNextDueDateCmd] next due date is null
                                11:48:44,576 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1417690
                                11:48:44,576 FIN | [DispatcherThread] DispatcherThread woke up
                                11:48:44,576 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,592 FIN | [AcquireJobsCmd] locking jobs [519]
                                11:48:44,592 FIN | [DispatcherThread] pushing jobs on the queue [519]
                                11:48:44,592 FIN | [DispatcherThread] added jobs [519] to the queue
                                11:48:44,592 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,592 FIN | [JobExecutorThread] took job(s) [519] from queue
                                11:48:44,592 FIN | [AcquireJobsCmd] locking jobs [520]
                                11:48:44,592 FIN | [DispatcherThread] pushing jobs on the queue [520]
                                11:48:44,592 FIN | [DispatcherThread] added jobs [520] to the queue
                                11:48:44,592 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,592 FIN | [JobExecutorThread] took job(s) [520] from queue
                                11:48:44,608 FIN | [AcquireJobsCmd] locking jobs []
                                11:48:44,608 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[519]...
                                11:48:44,608 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[519]...
                                11:48:44,608 FIN | [GetNextDueDateCmd] getting next due date...
                                11:48:44,608 FIN | [GetNextDueDateCmd] next due date is null
                                11:48:44,655 FIN | [ExecuteActivity] execution[process.363.custom two] executes activity(custom two)
                                11:48:44,655 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,655 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[520]...
                                Executing
                                custom two
                                11:48:44,670 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1417690
                                Executing
                                custom three
                                Executing
                                custom two
                                11:48:44,670 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[519]
                                11:48:44,670 FIN | [ExecuteActivity] execution[process.363.custom three] executes activity(custom three)
                                11:48:44,670 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,670 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[520]
                                11:48:44,670 FIN | [ExecuteActivity] execution[process.363.custom two] executes activity(custom two)
                                11:48:44,670 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,670 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[520]...
                                11:48:44,670 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[519]
                                11:48:44,670 FIN | [DispatcherThread] DispatcherThread woke up
                                11:48:44,670 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,686 FIN | [AcquireJobsCmd] locking jobs [521, 522]
                                11:48:44,686 FIN | [DispatcherThread] pushing jobs on the queue [521, 522]
                                11:48:44,686 FIN | [DispatcherThread] added jobs [521, 522] to the queue
                                11:48:44,686 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,686 FIN | [AcquireJobsCmd] locking jobs []
                                11:48:44,686 FIN | [GetNextDueDateCmd] getting next due date...
                                11:48:44,686 FIN | [GetNextDueDateCmd] next due date is null
                                11:48:44,686 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1417690
                                11:48:44,686 FIN | [JobExecutorThread] took job(s) [521, 522] from queue
                                11:48:44,686 FIN | [DispatcherThread] DispatcherThread woke up
                                11:48:44,686 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                Executing
                                custom three
                                11:48:44,686 FIN | [AcquireJobsCmd] locking jobs []
                                11:48:44,686 FIN | [GetNextDueDateCmd] getting next due date...
                                11:48:44,686 FIN | [ExecuteActivity] execution[process.363.custom three] executes activity(custom three)
                                11:48:44,686 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                11:48:44,686 FIN | [GetNextDueDateCmd] next due date is null
                                11:48:44,686 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1417690
                                11:48:44,686 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[520]
                                11:48:44,686 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[521]...
                                11:48:44,701 FIN | [DispatcherThread] DispatcherThread woke up
                                11:48:44,701 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                11:48:44,701 FIN | [ExecuteActivity] execution[process.363.custom two] executes activity(join)
                                11:48:44,701 FIN | [AcquireJobsCmd] locking jobs []
                                11:48:44,701 FIN | [GetNextDueDateCmd] getting next due date...
                                11:48:44,701 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[521]
                                11:48:44,701 FIN | [GetNextDueDateCmd] next due date is null
                                11:48:44,701 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@1417690
                                11:48:44,701 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[522]...
                                11:48:44,701 FIN | [ExecuteActivity] execution[process.363.custom three] executes activity(join)
                                11:48:44,701 FIN | [ExecutionImpl] execution[process.363.custom two] ends
                                11:48:44,701 FIN | [ExecutionImpl] execution[process.363.custom three] ends
                                11:48:44,701 FIN | [ExecuteActivity] executing activity(custom four)
                                Executing
                                custom four
                                11:48:44,701 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[522]
                                11:48:44,733 FIN | [ExecuteJobCmd] job 519 no longer exists
                                11:48:44,748 FIN | [ExecuteJobCmd] job 520 no longer exists
                                11:48:44,748 FIN | [Signal] signalling activity(custom four), signalName=null
                                11:48:44,748 FIN | [ExecuteActivity] executing activity(end)
                                11:48:44,764 SEV | [BaseJbpmTestCase]
                                ### EXCEPTION ###########################################
                                11:48:44,764 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: null
                                junit.framework.AssertionFailedError
                                 at junit.framework.Assert.fail(Assert.java:47)
                                 at junit.framework.Assert.assertTrue(Assert.java:20)
                                 at junit.framework.Assert.assertNull(Assert.java:233)
                                 at junit.framework.Assert.assertNull(Assert.java:226)
                                 at org.workflow.test.forum.ProcessTest.testProcess(ProcessTest.java:56)
                                 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:460)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                                ### EXCEPTION ###########################################
                                11:48:44,764 SEV | [BaseJbpmTestCase]
                                11:48:44,780 FIN | [DbSessionImpl] deleting history process instance process.363
                                11:48:44,795 FIN | [DbSessionImpl] deleting process instance process.363
                                11:48:44,795 FIN | [DeleteDeploymentCmd] deleting deployment 149
                                11:48:44,826 FIN | [BaseJbpmTestCase] === ending testProcess =============================
                                


                                Doesn't look like the process is completing correctly. Also very randomly sometimes custom four node is running ok, and sometimes I get a failure in
                                assertNull(executionInFour)
                                This doesn't make much sense to me, why is it giving different outputs?

                                Here's an example, you can see the nodes which ran. No sign of custom four.

                                12:18:12,797 FIN | [BaseJbpmTestCase] === starting testProcess =============================
                                12:18:12,938 FIN | [BaseJbpmTestCase] using ProcessEngine 6301159
                                log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
                                log4j:WARN Please initialize the log4j system properly.
                                12:18:14,094 FIN | [ProcessDefinitionImpl] creating new execution for process 'process'
                                12:18:14,094 FIN | [DefaultIdGenerator] generated execution id process.399
                                12:18:14,094 FIN | [ExecuteActivity] executing activity(16408563)
                                12:18:14,094 FIN | [ExecuteActivity] executing activity(custom one)
                                Executing
                                custom one
                                12:18:14,125 FIN | [Signal] signalling activity(custom one), signalName=null
                                12:18:14,125 FIN | [ExecuteActivity] executing activity(fork)
                                12:18:14,125 FIN | [DefaultIdGenerator] generated execution id process.399.custom two
                                12:18:14,125 FIN | [ExecutionImpl] created execution[process.399.custom two]
                                12:18:14,125 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                12:18:14,125 INF | [DispatcherThread] starting...
                                12:18:14,125 INF | [JobExecutorThread] starting...
                                12:18:14,125 INF | [JobExecutorThread] starting...
                                12:18:14,125 INF | [JobExecutorThread] starting...
                                12:18:14,141 FIN | [DefaultIdGenerator] generated execution id process.399.custom three
                                12:18:14,141 FIN | [ExecutionImpl] created execution[process.399.custom three]
                                12:18:14,141 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                12:18:14,141 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,141 FIN | [AcquireJobsCmd] locking jobs [581]
                                12:18:14,141 FIN | [DispatcherThread] pushing jobs on the queue [581]
                                12:18:14,141 FIN | [DispatcherThread] added jobs [581] to the queue
                                12:18:14,157 FIN | [JobExecutorThread] took job(s) [581] from queue
                                12:18:14,157 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,157 FIN | [AcquireJobsCmd] locking jobs [582]
                                12:18:14,157 FIN | [DispatcherThread] pushing jobs on the queue [582]
                                12:18:14,157 FIN | [DispatcherThread] added jobs [582] to the queue
                                12:18:14,157 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,157 FIN | [JobExecutorThread] took job(s) [582] from queue
                                12:18:14,203 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[581]...
                                12:18:14,203 FIN | [AcquireJobsCmd] locking jobs []
                                12:18:14,203 FIN | [GetNextDueDateCmd] getting next due date...
                                12:18:14,203 FIN | [GetNextDueDateCmd] next due date is null
                                12:18:14,203 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@cd4544
                                Executing
                                custom two
                                Executing
                                custom three
                                12:18:14,203 FIN | [ExecuteActivity] execution[process.399.custom two] executes activity(custom two)
                                12:18:14,219 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                12:18:14,219 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[582]...
                                12:18:14,219 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[581]
                                12:18:14,219 FIN | [ExecuteActivity] execution[process.399.custom three] executes activity(custom three)
                                12:18:14,219 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                12:18:14,219 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[582]
                                12:18:14,219 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[581]...
                                12:18:14,219 FIN | [DispatcherThread] DispatcherThread woke up
                                Executing
                                custom two
                                12:18:14,235 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,235 FIN | [ExecuteActivity] execution[process.399.custom two] executes activity(custom two)
                                12:18:14,235 FIN | [JobExecutorMessageSession] sending message ExecuteActivityMessage
                                12:18:14,235 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[581]
                                12:18:14,235 FIN | [AcquireJobsCmd] locking jobs [584]
                                12:18:14,235 FIN | [DispatcherThread] pushing jobs on the queue [584]
                                12:18:14,235 FIN | [DispatcherThread] added jobs [584] to the queue
                                12:18:14,235 FIN | [JobExecutorThread] took job(s) [584] from queue
                                12:18:14,235 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,235 FIN | [AcquireJobsCmd] locking jobs []
                                12:18:14,235 FIN | [GetNextDueDateCmd] getting next due date...
                                12:18:14,235 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[584]...
                                12:18:14,235 FIN | [GetNextDueDateCmd] next due date is null
                                12:18:14,235 FIN | [DispatcherThread] skipped wait because new message arrived
                                12:18:14,235 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,235 FIN | [AcquireJobsCmd] locking jobs [585]
                                12:18:14,250 FIN | [DispatcherThread] pushing jobs on the queue [585]
                                12:18:14,250 FIN | [DispatcherThread] added jobs [585] to the queue
                                12:18:14,250 FIN | [JobExecutorThread] took job(s) [585] from queue
                                12:18:14,250 FIN | [AcquireJobsCmd] start querying first acquirable job...
                                12:18:14,250 FIN | [ExecuteActivity] execution[process.399.custom three] executes activity(join)
                                12:18:14,250 FIN | [ExecuteJobCmd] executing job ExecuteActivityMessage[585]...
                                12:18:14,250 FIN | [AcquireJobsCmd] locking jobs []
                                12:18:14,250 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[584]
                                12:18:14,250 FIN | [GetNextDueDateCmd] getting next due date...
                                12:18:14,250 FIN | [GetNextDueDateCmd] next due date is null
                                12:18:14,250 FIN | [DispatcherThread] DispatcherThread will wait for max 600ms on org.jbpm.pvm.internal.jobexecutor.JobExecutor@cd4544
                                12:18:14,266 FIN | [ExecuteActivity] execution[process.399.custom two] executes activity(join)
                                12:18:14,266 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[585]
                                12:18:14,282 FIN | [ExecuteJobCmd] job 581 no longer exists
                                12:18:14,282 FIN | [ExecuteJobCmd] job 582 no longer exists
                                12:18:14,297 SEV | [BaseJbpmTestCase]
                                ### EXCEPTION ###########################################
                                12:18:14,297 SEV | [BaseJbpmTestCase] ASSERTION FAILURE: null
                                junit.framework.AssertionFailedError
                                 at junit.framework.Assert.fail(Assert.java:47)
                                 at junit.framework.Assert.assertTrue(Assert.java:20)
                                 at junit.framework.Assert.assertNotNull(Assert.java:220)
                                 at junit.framework.Assert.assertNotNull(Assert.java:213)
                                 at org.workflow.test.forum.ProcessTest.testProcess(ProcessTest.java:53)
                                 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:460)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                                 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                                ### EXCEPTION ###########################################
                                12:18:14,297 SEV | [BaseJbpmTestCase]
                                12:18:14,313 FIN | [DbSessionImpl] deleting history process instance process.399
                                12:18:14,328 FIN | [DbSessionImpl] deleting process instance process.399
                                12:18:14,344 FIN | [DeleteDeploymentCmd] deleting deployment 161
                                12:18:14,360 FIN | [BaseJbpmTestCase] === ending testProcess =============================
                                


                                • 28. Re: workflow design about wait states
                                  kukeltje

                                  I do not get your remark regarding "as expected"

                                  Small other question (which might not be related) why do you reassign processInstance a new value each time?

                                  And you might try to change the interface of tow and three to ActivityBehaviour (since there is no 'waitForSignal' anymore. You can remove the signal method then and the 'takeDefaultTransition()' can be removed as well if there is just one outgoing transition.

                                  Oh and make the error messages in the asserts more explicit (you can add a string as message, that way you can easily see in the logging which assert it was)

                                  • 29. Re: workflow design about wait states
                                    mmusaji

                                     

                                    "kukeltje" wrote:
                                    I do not get your remark regarding "as expected"


                                    Referring to me suggesting that I was unsure that the process was actually completing

                                    "kukeltje" wrote:

                                    Small other question (which might not be related) why do you reassign processInstance a new value each time?


                                    No reason other it was probably cut and paste from other unit tests.

                                    "kukeltje" wrote:

                                    And you might try to change the interface of tow and three to ActivityBehaviour (since there is no 'waitForSignal' anymore. You can remove the signal method then and the 'takeDefaultTransition()' can be removed as well if there is just one outgoing transition.


                                    I've done this just not repeat posted the unit test.

                                    "kukeltje" wrote:

                                    Oh and make the error messages in the asserts more explicit (you can add a string as message, that way you can easily see in the logging which assert it was)


                                    Good point. Will do this.