AnsweredAssumed Answered

BPM Timer Expiry

Question asked by samsmith on Apr 8, 2016
Latest reply on Apr 11, 2016 by martin.grofcik
Hi,

I have got a BPM process that has got an 'Timer Intermediate Catch Event' with duration set to 10 seconds [PT10S].
When I try to unit test the BPM process, I noticed that  the timer doesn't get expired at all. 'asyncExecutorActivate' property is set to true.


But when I write the following code in my unit test, then the timer does get expired after 10 seconds.

JobQuery jobQuery = processEngine.getManagementService().createJobQuery().processInstanceId(processInstance.getId());
Date startTime = new Date();
processEngine.getProcessEngineConfiguration().getClock().setCurrentTime(new Date(startTime.getTime() + (10 * 1000) + 1000));
JobTestHelper.waitForJobExecutorToProcessAllJobs(processEngine.getProcessEngineConfiguration(), processEngine.getManagementService(), 10000L, 25L);
assertEquals(0L, jobQuery.count());


My question is that why do I have to write the above code for the timer to work from my unit test.

Thanks

Outcomes