public static void assertWorkflowInstanceRecord( long workflowKey, int version, long workflowInstanceKey, String elementId, Record<WorkflowInstanceRecordValue> workflowInstanceCanceledEvent) { Assertions.assertThat(workflowInstanceCanceledEvent.getValue()) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowKey(workflowKey) .hasVersion(version) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(elementId); }
public static void assertWorkflowInstanceRecord( long workflowKey, int version, long workflowInstanceKey, String elementId, Record<WorkflowInstanceRecordValue> workflowInstanceCanceledEvent) { Assertions.assertThat(workflowInstanceCanceledEvent.getValue()) .hasBpmnProcessId(PROCESS_ID) .hasWorkflowKey(workflowKey) .hasVersion(version) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementId(elementId); }
@Test public void shouldCompleteWorkflow() { // when final ExecuteCommandResponse response = testClient.deployWithResponse(SIMPLE_MODEL); final DeploymentRecordValue deploymentRecord = testClient .receiveFirstDeploymentEvent(DeploymentIntent.CREATED, response.getKey()) .getValue(); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(1)); final WorkflowInstanceRecordValue instanceCompleted = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED) .getFirst() .getValue(); Assertions.assertThat(instanceCompleted) .hasBpmnProcessId("process") .hasVersion(1) .hasWorkflowKey(deploymentRecord.getDeployedWorkflows().get(0).getWorkflowKey()); }
.hasBpmnProcessId("process") .hasVersion(workflow.getVersion()) .hasWorkflowKey(workflow.getWorkflowKey());
@Test public void shouldCompleteWorkflow() { // when final ExecuteCommandResponse response = testClient.deployWithResponse(SIMPLE_MODEL); final DeploymentRecordValue deploymentRecord = testClient .receiveFirstDeploymentEvent(DeploymentIntent.CREATED, response.getKey()) .getValue(); // then assertThat(RecordingExporter.timerRecords(TimerIntent.CREATED).exists()).isTrue(); brokerRule.getClock().addTime(Duration.ofSeconds(1)); final WorkflowInstanceRecordValue instanceCompleted = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_COMPLETED) .getFirst() .getValue(); Assertions.assertThat(instanceCompleted) .hasBpmnProcessId("process") .hasVersion(1) .hasWorkflowKey(deploymentRecord.getDeployedWorkflows().get(0).getWorkflowKey()); }
@Test public void shouldCorrelateMessageToStartEvent() { // given final ExecuteCommandResponse response = testClient.deployWithResponse(createWorkflowWithOneMessageStartEvent()); final long workflowKey = getFirstDeployedWorkflowKey(response); // wait until subscription is opened assertThat( messageStartEventSubscriptionRecords(MessageStartEventSubscriptionIntent.OPENED) .exists()) .isTrue(); // when testClient.publishMessage(MESSAGE_NAME1, "order-123", asMsgPack("foo", "bar")); // then final Record<WorkflowInstanceRecordValue> record = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_OCCURRED).getFirst(); assertThat(record.getValue()).hasWorkflowKey(workflowKey).hasElementId(EVENT_ID1); }
@Test public void shouldCorrelateMessageToStartEvent() { // given final ExecuteCommandResponse response = testClient.deployWithResponse(createWorkflowWithOneMessageStartEvent()); final long workflowKey = getFirstDeployedWorkflowKey(response); // wait until subscription is opened assertThat( messageStartEventSubscriptionRecords(MessageStartEventSubscriptionIntent.OPENED) .exists()) .isTrue(); // when testClient.publishMessage(MESSAGE_NAME1, "order-123", asMsgPack("foo", "bar")); // then final Record<WorkflowInstanceRecordValue> record = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.EVENT_OCCURRED).getFirst(); assertThat(record.getValue()).hasWorkflowKey(workflowKey).hasElementId(EVENT_ID1); }
.hasBpmnProcessId("process") .hasVersion(workflow.getVersion()) .hasWorkflowKey(workflow.getWorkflowKey());