//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableInOutMappingOfCallActivity() public virtual void testNonInterruptingSetVariableInOutMappingOfCallActivity() { engine.manageDeployment(repositoryService.createDeployment().addModelInstance(CONDITIONAL_MODEL, DELEGATED_PROCESS).deploy()); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().callActivity(TASK_WITH_CONDITION_ID).calledElement(DELEGATED_PROCESS_KEY).camundaOut(VARIABLE_NAME, VARIABLE_NAME).userTask().name(TASK_AFTER_OUTPUT_MAPPING).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, false); modelInstance = addBoundaryEvent(modelInstance, TASK_WITH_CONDITION_ID, TASK_AFTER_COND_BOUN_EVENT_IN_SUB_PROCESS, false); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); Task task = taskQuery.singleResult(); assertNotNull(task); assertEquals(TASK_BEFORE_CONDITION, task.Name); //when task before service task is completed taskService.complete(task.Id); //then out mapping of call activity sets a variable //-> all non interrupting conditional events are triggered tasksAfterVariableIsSet = taskQuery.list(); assertEquals(5, tasksAfterVariableIsSet.Count); //three subscriptions: event sub process in sub process and on process instance level and boundary event of sub process assertEquals(3, conditionEventSubscriptionQuery.count()); }
// sub process testing with event sub process on process instance and in sub process ///////////////////////////////// // and conditional start event and boundary event on sub process ///////////////////////////////////////////////////// // execution listener in sub process ///////////////////////////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetVariableOnStartExecutionListenerInSubProcessWithBoundary() public virtual void testSetVariableOnStartExecutionListenerInSubProcessWithBoundary() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).camundaExecutionListenerExpression([email protected]_Fields.EVENTNAME_START, EXPR_SET_VARIABLE).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, true); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, true); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when start listener sets variable //then conditional boundary should not triggered but conditional start event tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_AFTER_CONDITIONAL_START_EVENT, tasksAfterVariableIsSet[0].Name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableOnOutputMappingInSubProcessWithBoundary() public virtual void testNonInterruptingSetVariableOnOutputMappingInSubProcessWithBoundary() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).camundaOutputParameter(VARIABLE_NAME, "1").name(TASK_WITH_CONDITION).userTask().name(TASK_AFTER_OUTPUT_MAPPING).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, false); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when task before is completed taskService.complete(taskQuery.singleResult().Id); //then all conditional events are triggered tasksAfterVariableIsSet = taskQuery.list(); assertEquals(4, tasksAfterVariableIsSet.Count); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableOnStartExecutionListenerInSubProcessWithBoundary() public virtual void testNonInterruptingSetVariableOnStartExecutionListenerInSubProcessWithBoundary() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).camundaExecutionListenerExpression([email protected]_Fields.EVENTNAME_START, EXPR_SET_VARIABLE).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, false); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when start listener sets variable //then conditional boundary and event sub process inside the sub process should triggered via default evaluation behavior //and global conditional start event via delayed events tasksAfterVariableIsSet = taskQuery.list(); assertEquals(4, tasksAfterVariableIsSet.Count); assertTaskNames(tasksAfterVariableIsSet, TASK_AFTER_CONDITIONAL_START_EVENT, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, TASK_WITH_CONDITION); }
// io mapping //////////////////////////////////////////////////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetVariableOnInputMapping() public virtual void testSetVariableOnInputMapping() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).userTask(TASK_WITH_CONDITION_ID).camundaInputParameter(VARIABLE_NAME, "1").name(TASK_WITH_CONDITION).endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).userTask(TASK_WITH_CONDITION_ID).camundaInputParameter(VARIABLE_NAME, "1").name(TASK_WITH_CONDITION).endEvent().done(); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, true); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); Task task = taskQuery.singleResult(); //when task before is completed taskService.complete(task.Id); //then conditional boundary event should triggered with the default evaluation behavior tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, tasksAfterVariableIsSet[0].Name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableOnInputMappingInSubProcessWithBoundary() public virtual void testNonInterruptingSetVariableOnInputMappingInSubProcessWithBoundary() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).camundaInputParameter(VARIABLE_NAME, "1").embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, false); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when input mapping sets variable //then conditional boundary event should triggered and also conditional start event in sub process //via the default evaluation behavior but not the global event sub process //since variable is only local tasksAfterVariableIsSet = taskQuery.list(); assertEquals(3, tasksAfterVariableIsSet.Count); assertTaskNames(tasksAfterVariableIsSet, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, TASK_WITH_CONDITION); }
// io mapping in sub process ///////////////////////////////////////////////////////////////////////////////////////// //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetVariableOnInputMappingInSubProcessWithBoundary() public virtual void testSetVariableOnInputMappingInSubProcessWithBoundary() { BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).camundaInputParameter(VARIABLE_NAME, "1").embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); modelInstance = addEventSubProcess(modelInstance, SUB_PROCESS_ID, TASK_AFTER_COND_START_EVENT_IN_SUB_PROCESS, true); deployMixedProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, SUB_PROCESS_ID, true); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when input mapping sets variable //then conditional boundary event should triggered from the default evaluation behavior // The event sub process inside the sub process should not since the scope is lower than from the boundary. // The global event sub process should not since the variable is only locally. tasksAfterVariableIsSet = taskQuery.list(); assertEquals(1, tasksAfterVariableIsSet.Count); assertEquals(TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, tasksAfterVariableIsSet[0].Name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableOnOutputMappingInSubProcess() public virtual void testNonInterruptingSetVariableOnOutputMappingInSubProcess() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).camundaOutputParameter(VARIABLE_NAME, "1").name(TASK_WITH_CONDITION).userTask().name(TASK_AFTER_OUTPUT_MAPPING).endEvent().subProcessDone().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).camundaOutputParameter(VARIABLE_NAME, "1").name(TASK_WITH_CONDITION).userTask().name(TASK_AFTER_OUTPUT_MAPPING).endEvent().subProcessDone().endEvent().done(); deployMixedProcess(modelInstance, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when task before is completed taskService.complete(taskQuery.singleResult().Id); //then conditional boundary should not triggered but conditional start event tasksAfterVariableIsSet = taskQuery.list(); assertEquals(2, tasksAfterVariableIsSet.Count); assertTaskNames(tasksAfterVariableIsSet, TASK_AFTER_CONDITIONAL_START_EVENT, TASK_AFTER_OUTPUT_MAPPING); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testSetVariableOnEndExecutionListenerInSubProcess() public virtual void testSetVariableOnEndExecutionListenerInSubProcess() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).camundaExecutionListenerExpression(org.camunda.bpm.engine.delegate.ExecutionListener_Fields.EVENTNAME_END, EXPR_SET_VARIABLE).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_WITH_CONDITION_ID).camundaExecutionListenerExpression([email protected]_Fields.EVENTNAME_END, EXPR_SET_VARIABLE).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); deployMixedProcess(modelInstance, SUB_PROCESS_ID, true); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); Task task = taskQuery.singleResult(); //when task before is completed taskService.complete(task.Id); //then conditional boundary should not triggered but conditional start event tasksAfterVariableIsSet = taskQuery.list(); assertEquals(TASK_AFTER_CONDITIONAL_START_EVENT, tasksAfterVariableIsSet[0].Name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testNonInterruptingSetVariableOnStartExecutionListenerInSubProcess() public virtual void testNonInterruptingSetVariableOnStartExecutionListenerInSubProcess() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.model.bpmn.BpmnModelInstance modelInstance = org.camunda.bpm.model.bpmn.Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).userTask(TASK_WITH_CONDITION_ID).camundaExecutionListenerExpression(org.camunda.bpm.engine.delegate.ExecutionListener_Fields.EVENTNAME_START, EXPR_SET_VARIABLE).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY).startEvent().subProcess(SUB_PROCESS_ID).embeddedSubProcess().startEvent().userTask(TASK_BEFORE_CONDITION_ID).name(TASK_BEFORE_CONDITION).userTask(TASK_WITH_CONDITION_ID).camundaExecutionListenerExpression([email protected]_Fields.EVENTNAME_START, EXPR_SET_VARIABLE).name(TASK_WITH_CONDITION).endEvent().subProcessDone().endEvent().done(); deployMixedProcess(modelInstance, SUB_PROCESS_ID, false); // given ProcessInstance procInst = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY); TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(procInst.Id); //when task before is completed taskService.complete(taskQuery.singleResult().Id); //then conditional boundary should triggered via default evaluation behavior //and conditional start event via delayed events tasksAfterVariableIsSet = taskQuery.list(); assertEquals(3, tasksAfterVariableIsSet.Count); assertTaskNames(tasksAfterVariableIsSet, TASK_AFTER_CONDITIONAL_START_EVENT, TASK_AFTER_CONDITIONAL_BOUNDARY_EVENT, TASK_WITH_CONDITION); }