hlux
November 11, 2016, 12:24pm
1
I’m trying to test a process model that has a start event with the flag asynBefore.
When I start the process with
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(“processKey”);
assertThat(processInstance).isStarted().isNotEnded();
assertThat(processInstance).isWaitingAt(“startBestellung”);
This is all green, but I don’t know how to move on to the first task or job because the processes
waits at the start event which is neither a task nor a job.
Can you give any hints?
Thanks
hlux
1 Like
Zelldon
November 11, 2016, 12:47pm
2
Hey hlux,
after the process is started a Job is created. So you have to query the job and execute it via the management service.
See following code snipped:
ProcessInstance asyncProc = rule.getRuntimeService().startProcessInstanceByKey("asyncProc");
Job job = rule.getManagementService().createJobQuery().singleResult();
rule.getManagementService().executeJob(job.getId());
assertNull(rule.getRuntimeService().createProcessInstanceQuery().singleResult());
Best regards,
Chris
2 Likes
Hi hlux,
if you use camunda-bpm-assert (https://github.com/camunda/camunda-bpm-assert#get-started-in-3-simple-steps ), excute(job())
will do your job.
Cheers, Ingo
3 Likes
hlux
November 11, 2016, 1:29pm
4
you are both right! Thank you very much!
Ingo_Richtsmeier:
excute(job())
typo in expression:
execute(job())