public static void assertMessageSubscription( long workflowInstanceKey, String correlationKey, Record catchEventEntered, Record<MessageSubscriptionRecordValue> subscription) { Assertions.assertThat(subscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(correlationKey); }
public static void assertMessageSubscription( long workflowInstanceKey, String correlationKey, Record catchEventEntered, Record<MessageSubscriptionRecordValue> subscription) { Assertions.assertThat(subscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(correlationKey); }
@Test public void shouldCloseMessageSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when testClient.cancelWorkflowInstance(workflowInstanceKey); // then final Record<MessageSubscriptionRecordValue> messageSubscription = RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.CLOSED).getFirst(); assertThat(messageSubscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); Assertions.assertThat(messageSubscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(""); }
@Test public void shouldCloseMessageSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when testClient.cancelWorkflowInstance(workflowInstanceKey); // then final Record<MessageSubscriptionRecordValue> messageSubscription = RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.CLOSED).getFirst(); assertThat(messageSubscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); Assertions.assertThat(messageSubscription.getValue()) .hasWorkflowInstanceKey(workflowInstanceKey) .hasElementInstanceKey(catchEventEntered.getKey()) .hasMessageName("order canceled") .hasCorrelationKey(""); }