Details
Description
The following test fails if the create task listener looks like this:
public class CreateTaskListener implements TaskListener { public void notify(DelegateTask delegateTask) { // delegateTask.complete(); delegateTask.getProcessEngineServices().getTaskService().complete(delegateTask.getId()); } }
@Test public void shouldExecuteProcess() { final BpmnModelInstance subProcess = Bpmn.createExecutableProcess("subProc") .startEvent() .userTask("calledTask") .endEvent() .done(); final BpmnModelInstance bpmnModelInstance = Bpmn.createExecutableProcess("mainProc") .startEvent() .userTask("mainTask") .camundaTaskListenerClass(TaskListener.EVENTNAME_CREATE, CreateTaskListener.class.getName()) .callActivity().calledElement("subProc") .endEvent() .done(); rule.getRepositoryService() .createDeployment() .addModelInstance("mainProc.bpmn20.xml", bpmnModelInstance) .addModelInstance("subProc.bpmn20.xml", subProcess) .deploy(); ProcessInstance testProc = rule.getRuntimeService().startProcessInstanceByKey("mainProc"); Task task = rule.getTaskService() .createTaskQuery() .singleResult(); assertEquals(task.getTaskDefinitionKey(), "calledTask"); }
If simply the complete() method of the DelegateTask is called it works OR if no call activity follows the userTask.