private void addTask(AbstractFlowNodeBuilder<?, ?> builder, final String taskId) { if (createdTasks.contains(taskId)) { builder.connectTo(taskId); } else { final YamlTask task = tasksById.get(taskId); if (task == null) { throw new RuntimeException( String.format( "Expected to add task with id '%s', but no task definition with that id exists", taskId)); } builder = addServiceTask(builder, task); createdTasks.add(taskId); addFlowFromTask(builder, task); } }
private void addTask(AbstractFlowNodeBuilder<?, ?> builder, final String taskId) { if (createdTasks.contains(taskId)) { builder.connectTo(taskId); } else { final YamlTask task = tasksById.get(taskId); if (task == null) { throw new RuntimeException( String.format( "Expected to add task with id '%s', but no task definition with that id exists", taskId)); } builder = addServiceTask(builder, task); createdTasks.add(taskId); addFlowFromTask(builder, task); } }
@Test public void shouldCompleteScopeWithMultipleTokensOnSamePath() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway("fork") .exclusiveGateway("join") .endEvent("end") .moveToNode("fork") .connectTo("join") .done(); testClient.deploy(process); // when testClient.createWorkflowInstance(PROCESS_ID); // then final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents = testClient .receiveWorkflowInstances() .limitToWorkflowInstanceCompleted() .collect(Collectors.toList()); assertThat(workflowInstanceEvents) .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent()) .containsSubsequence( tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATED), tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATED), tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETED)); }
@Test public void shouldCompleteScopeWithMultipleTokensOnSamePath() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway("fork") .exclusiveGateway("join") .endEvent("end") .moveToNode("fork") .connectTo("join") .done(); testClient.deploy(process); // when testClient.createWorkflowInstance(PROCESS_ID); // then final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents = testClient .receiveWorkflowInstances() .limitToWorkflowInstanceCompleted() .collect(Collectors.toList()); assertThat(workflowInstanceEvents) .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent()) .containsSubsequence( tuple("end", WorkflowInstanceIntent.ELEMENT_COMPLETED), tuple("end", WorkflowInstanceIntent.ELEMENT_COMPLETED), tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETED)); }
@Test public void shouldMergeAndSplitInOneGateway() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway("fork") .parallelGateway("join-fork") .moveToNode("fork") .connectTo("join-fork") .serviceTask("task1", b -> b.zeebeTaskType("type1")) .moveToLastGateway() .serviceTask("task2", b -> b.zeebeTaskType("type2")) .done(); testClient.deploy(process); // when testClient.createWorkflowInstance(PROCESS_ID); // then final List<Record<WorkflowInstanceRecordValue>> elementInstances = testClient .receiveWorkflowInstances() .filter(r -> r.getMetadata().getIntent() == WorkflowInstanceIntent.ELEMENT_ACTIVATED) .limit(3) .collect(Collectors.toList()); assertThat(elementInstances) .extracting(e -> e.getValue().getElementId()) .contains(PROCESS_ID, "task1", "task2"); }
.parallelGateway("join-fork") .moveToNode("fork") .connectTo("join-fork") .serviceTask("task1", b -> b.zeebeTaskType("type1")) .moveToLastGateway()