Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-7902

Can't complete Task in TaskCreateListener with the taskService if a call activity follows the task

    XMLWordPrintable

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.

      mgm-controller-panel

        This is the controller panel for Smart Panels app

        Attachments

          Activity

            People

              Unassigned Unassigned
              christopher.zell Christopher Kujawa
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Salesforce