private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitMessagesCorrelated( int messagesCount) { return RecordingExporter.workflowInstanceSubscriptionRecords( WorkflowInstanceSubscriptionIntent.CORRELATED) .limit(messagesCount) .asList(); }
private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitMessagesCorrelated( int messagesCount) { return RecordingExporter.workflowInstanceSubscriptionRecords( WorkflowInstanceSubscriptionIntent.CORRELATED) .limit(messagesCount) .asList(); }
private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitSubscriptionsOpened( int subscriptionsCount) { return testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(subscriptionsCount) .asList(); } }
private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitSubscriptionsOpened( int subscriptionsCount) { return testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(subscriptionsCount) .asList(); } }
@Test public void shouldOpenWorkflowInstanceSubscriptions() { // given testClient.deploy(WORKFLOW_WITH_MESSAGES); // when testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "123")); // then final Record<WorkflowInstanceRecordValue> gatewayEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.GATEWAY_ACTIVATED) .getFirst(); final List<Record<WorkflowInstanceSubscriptionRecordValue>> subscriptionEvents = RecordingExporter.workflowInstanceSubscriptionRecords( WorkflowInstanceSubscriptionIntent.OPENED) .limit(2) .asList(); assertThat(subscriptionEvents) .hasSize(2) .extracting(r -> tuple(r.getValue().getMessageName(), r.getValue().getElementInstanceKey())) .contains(tuple("msg-1", gatewayEvent.getKey()), tuple("msg-2", gatewayEvent.getKey())); }
@Test public void shouldOpenWorkflowInstanceSubscriptions() { // given testClient.deploy(WORKFLOW_WITH_MESSAGES); // when testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "123")); // then final Record<WorkflowInstanceRecordValue> gatewayEvent = RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.ELEMENT_ACTIVATED) .withElementType(BpmnElementType.EVENT_BASED_GATEWAY) .getFirst(); final List<Record<WorkflowInstanceSubscriptionRecordValue>> subscriptionEvents = RecordingExporter.workflowInstanceSubscriptionRecords( WorkflowInstanceSubscriptionIntent.OPENED) .limit(2) .asList(); assertThat(subscriptionEvents) .hasSize(2) .extracting(r -> tuple(r.getValue().getMessageName(), r.getValue().getElementInstanceKey())) .contains(tuple("msg-1", gatewayEvent.getKey()), tuple("msg-2", gatewayEvent.getKey())); }