public MessageStartEventSubscriptionRecordStream withWorkfloKey(long workflowKey) { return valueFilter(v -> v.getWorkflowKey() == workflowKey); }
public MessageStartEventSubscriptionRecordStream withWorkfloKey(long workflowKey) { return valueFilter(v -> v.getWorkflowKey() == workflowKey); }
/** * Verifies that the actual MessageStartEventSubscriptionRecordValue's workflowKey is equal to the given one. * @param workflowKey the given workflowKey to compare the actual MessageStartEventSubscriptionRecordValue's workflowKey to. * @return this assertion object. * @throws AssertionError - if the actual MessageStartEventSubscriptionRecordValue's workflowKey is not equal to the given one. */ public S hasWorkflowKey(long workflowKey) { // check that actual MessageStartEventSubscriptionRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting workflowKey of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // check long actualWorkflowKey = actual.getWorkflowKey(); if (actualWorkflowKey != workflowKey) { failWithMessage(assertjErrorMessage, actual, workflowKey, actualWorkflowKey); } // return the current assertion for method chaining return myself; }
@Test public void shouldCloseSubscriptionForOldVersions() { // given testClient.deploy(createWorkflowWithOneMessageStartEvent()); // when testClient.deploy(createWorkflowWithOneMessageStartEvent()); // then final List<Record<MessageStartEventSubscriptionRecordValue>> subscriptions = RecordingExporter.messageStartEventSubscriptionRecords().limit(6).asList(); final List<Intent> intents = subscriptions.stream().map(s -> s.getMetadata().getIntent()).collect(Collectors.toList()); assertThat(intents) .containsExactly( MessageStartEventSubscriptionIntent.OPEN, MessageStartEventSubscriptionIntent.OPENED, MessageStartEventSubscriptionIntent.CLOSE, // close old version MessageStartEventSubscriptionIntent.OPEN, // open new MessageStartEventSubscriptionIntent.CLOSED, MessageStartEventSubscriptionIntent.OPENED); final long closingWorkflowKey = subscriptions.get(2).getValue().getWorkflowKey(); assertThat(closingWorkflowKey).isEqualTo(subscriptions.get(0).getValue().getWorkflowKey()); }
@Test public void shouldCloseSubscriptionForOldVersions() { // given testClient.deploy(createWorkflowWithOneMessageStartEvent()); // when testClient.deploy(createWorkflowWithOneMessageStartEvent()); // then final List<Record<MessageStartEventSubscriptionRecordValue>> subscriptions = RecordingExporter.messageStartEventSubscriptionRecords().limit(6).asList(); final List<Intent> intents = subscriptions.stream().map(s -> s.getMetadata().getIntent()).collect(Collectors.toList()); assertThat(intents) .containsExactly( MessageStartEventSubscriptionIntent.OPEN, MessageStartEventSubscriptionIntent.OPENED, MessageStartEventSubscriptionIntent.CLOSE, // close old version MessageStartEventSubscriptionIntent.OPEN, // open new MessageStartEventSubscriptionIntent.CLOSED, MessageStartEventSubscriptionIntent.OPENED); final long closingWorkflowKey = subscriptions.get(2).getValue().getWorkflowKey(); assertThat(closingWorkflowKey).isEqualTo(subscriptions.get(0).getValue().getWorkflowKey()); }