@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .sequenceFlowId(elementId()) .endEvent() .done(); } });
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .sequenceFlowId(elementId()) .endEvent() .done(); } });
@Test public void shouldTakeSequenceFlowFromStartEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .sequenceFlowId("foo") .endEvent() .done()); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // then final Record<WorkflowInstanceRecordValue> sequenceFlow = testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN); assertThat(sequenceFlow.getKey()).isGreaterThan(0).isNotEqualTo(workflowInstanceKey); assertWorkflowInstanceRecord(workflowInstanceKey, "foo", sequenceFlow); }
@Test public void shouldTakeSequenceFlowFromStartEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .sequenceFlowId("foo") .endEvent() .done()); // when final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID); // then final Record<WorkflowInstanceRecordValue> sequenceFlow = testClient.receiveFirstWorkflowInstanceEvent(WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN); assertThat(sequenceFlow.getKey()).isGreaterThan(0).isNotEqualTo(workflowInstanceKey); assertWorkflowInstanceRecord(workflowInstanceKey, "foo", sequenceFlow); }
@Test public void shouldCompleteScopeOnParallelGateway() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent("start") .sequenceFlowId("flow1") .parallelGateway("fork") .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()) .containsSequence( tuple("fork", WorkflowInstanceIntent.ELEMENT_COMPLETED), tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING)); }
@Test public void shouldCompleteScopeOnParallelGateway() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent("start") .sequenceFlowId("flow1") .parallelGateway("fork") .done(); testClient.deploy(process); // when testClient.createWorkflowInstance(PROCESS_ID); // then final Record<WorkflowInstanceRecordValue> completedEvent = testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETED); final List<Record<WorkflowInstanceRecordValue>> workflowInstanceEvents = testClient .receiveWorkflowInstances() .limit(r -> r.getPosition() == completedEvent.getPosition()) .collect(Collectors.toList()); assertThat(workflowInstanceEvents) .extracting(e -> e.getValue().getElementId(), e -> e.getMetadata().getIntent()) .containsSequence( tuple("fork", WorkflowInstanceIntent.GATEWAY_ACTIVATED), tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING)); }
@Test public void shouldPassThroughParallelGateway() { // given final BpmnModelInstance process = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent("start") .sequenceFlowId("flow1") .parallelGateway("fork") .sequenceFlowId("flow2") .endEvent("end") .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()) .containsSequence( tuple("fork", WorkflowInstanceIntent.GATEWAY_ACTIVATED), tuple("flow2", WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN), tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATING), tuple("end", WorkflowInstanceIntent.EVENT_ACTIVATED), tuple(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_COMPLETING)); }
Bpmn.createExecutableProcess(PROCESS_ID) .startEvent("start") .sequenceFlowId("flow1") .parallelGateway("fork") .sequenceFlowId("flow2")