public WorkflowInstanceSubscriptionRecordStream withElementInstanceKey( final long elementInstanceKey) { return valueFilter(v -> v.getElementInstanceKey() == elementInstanceKey); }
public WorkflowInstanceSubscriptionRecordStream withElementInstanceKey( final long elementInstanceKey) { return valueFilter(v -> v.getElementInstanceKey() == elementInstanceKey); }
/** * Verifies that the actual WorkflowInstanceSubscriptionRecordValue's elementInstanceKey is equal to the given one. * @param elementInstanceKey the given elementInstanceKey to compare the actual WorkflowInstanceSubscriptionRecordValue's elementInstanceKey to. * @return this assertion object. * @throws AssertionError - if the actual WorkflowInstanceSubscriptionRecordValue's elementInstanceKey is not equal to the given one. */ public S hasElementInstanceKey(long elementInstanceKey) { // check that actual WorkflowInstanceSubscriptionRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting elementInstanceKey of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // check long actualElementInstanceKey = actual.getElementInstanceKey(); if (actualElementInstanceKey != elementInstanceKey) { failWithMessage(assertjErrorMessage, actual, elementInstanceKey, actualElementInstanceKey); } // return the current assertion for method chaining return myself; }
@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())); }