@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .exclusiveGateway(elementId()) .defaultFlow() .endEvent() .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .exclusiveGateway(elementId()) .defaultFlow() .endEvent() .done(); } },
@Test public void shouldSplitIfDefaultFlowIsDeclaredFirst() { final BpmnModelInstance workflowDefinition = Bpmn.createExecutableProcess("workflow") .startEvent() .exclusiveGateway() .defaultFlow() .endEvent("a") .moveToLastExclusiveGateway() .condition("$.foo < 5") .endEvent("b") .done(); testClient.deploy(workflowDefinition); // when testClient.createWorkflowInstance("workflow", MsgPackUtil.asMsgPack("foo", 10)); // then final List<Record<WorkflowInstanceRecordValue>> completedEvents = RecordingExporter.workflowInstanceRecords() .limitToWorkflowInstanceCompleted() .withIntent(WorkflowInstanceIntent.EVENT_ACTIVATED) .collect(Collectors.toList()); assertThat(completedEvents).extracting(r -> r.getValue().getElementId()).containsExactly("a"); }
@Test public void shouldSplitIfDefaultFlowIsDeclaredFirst() { final BpmnModelInstance workflowDefinition = Bpmn.createExecutableProcess("workflow") .startEvent() .exclusiveGateway() .defaultFlow() .endEvent("a") .moveToLastExclusiveGateway() .condition("$.foo < 5") .endEvent("b") .done(); testClient.deploy(workflowDefinition); // when testClient.createWorkflowInstance("workflow", MsgPackUtil.asMsgPack("foo", 10)); // then final List<Record<WorkflowInstanceRecordValue>> completedEvents = RecordingExporter.workflowInstanceRecords() .limitToWorkflowInstanceCompleted() .withIntent(WorkflowInstanceIntent.ELEMENT_COMPLETED) .withElementType(BpmnElementType.END_EVENT) .collect(Collectors.toList()); assertThat(completedEvents).extracting(r -> r.getValue().getElementId()).containsExactly("a"); }
@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)); }
.sequenceFlowId("s1") .condition("$.foo < 5") .endEvent("a") .moveToLastExclusiveGateway() .defaultFlow()
@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)); }
@Before public void init() { testClient = apiRule.partitionClient(); apiRule.waitForPartition(1); testClient.deploy( Bpmn.createExecutableProcess("workflow") .startEvent() .exclusiveGateway("xor") .sequenceFlowId("s1") .condition("$.foo < 5") .endEvent() .moveToLastGateway() .sequenceFlowId("s2") .condition("$.foo >= 5 && $.foo < 10") .endEvent() .done()); }
@Before public void init() { testClient = apiRule.partitionClient(); apiRule.waitForPartition(1); testClient.deploy( Bpmn.createExecutableProcess("workflow") .startEvent() .exclusiveGateway("xor") .sequenceFlowId("s1") .condition("$.foo < 5") .endEvent() .moveToLastGateway() .sequenceFlowId("s2") .condition("$.foo >= 5 && $.foo < 10") .endEvent() .done()); }
.sequenceFlowId("s1") .condition("$.foo < 5") .endEvent("a") .moveToLastExclusiveGateway() .defaultFlow()
.sequenceFlowId("flow") .condition("foo") .endEvent() .done(), Arrays.asList(
.sequenceFlowId("flow") .condition("foo") .endEvent() .done(), Arrays.asList(
.sequenceFlowId("s1") .condition("$.foo < 5") .endEvent("a") .moveToLastGateway() .sequenceFlowId("s2")
.sequenceFlowId("s1") .condition("$.foo < 5") .endEvent("a") .moveToLastGateway() .sequenceFlowId("s2")
@Test public void shouldNotCompleteInstanceAfterIncidentIsRaisedOnExclusiveGateway() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .exclusiveGateway("gateway") .defaultFlow() .endEvent("end-2") .moveToNode("gateway") .sequenceFlowId("to-end-3") .condition("$.x < 21") .endEvent("end-3") .done()); testClient.createWorkflowInstance(PROCESS_ID); // when final Record<IncidentRecordValue> incident = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); testClient.completeJobOfType("task"); testClient.updatePayload(incident.getValue().getElementInstanceKey(), "{'x':123}"); testClient.resolveIncident(incident.getKey()); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.EVENT_ACTIVATED); }
@Test public void shouldNotCompleteInstanceAfterIncidentIsRaisedOnExclusiveGateway() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .exclusiveGateway("gateway") .defaultFlow() .endEvent("end-2") .moveToNode("gateway") .sequenceFlowId("to-end-3") .condition("$.x < 21") .endEvent("end-3") .done()); testClient.createWorkflowInstance(PROCESS_ID); // when final Record<IncidentRecordValue> incident = RecordingExporter.incidentRecords(IncidentIntent.CREATED).getFirst(); testClient.completeJobOfType("task"); testClient.updatePayload(incident.getValue().getElementInstanceKey(), "{'x':123}"); testClient.resolveIncident(incident.getKey()); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.ELEMENT_COMPLETED); }