public MessageSubscriptionRecordStream withCorrelationKey(final String correlationKey) { return valueFilter(v -> correlationKey.equals(v.getCorrelationKey())); } }
public MessageSubscriptionRecordStream withCorrelationKey(final String correlationKey) { return valueFilter(v -> correlationKey.equals(v.getCorrelationKey())); } }
/** * Verifies that the actual MessageSubscriptionRecordValue's correlationKey is equal to the given one. * @param correlationKey the given correlationKey to compare the actual MessageSubscriptionRecordValue's correlationKey to. * @return this assertion object. * @throws AssertionError - if the actual MessageSubscriptionRecordValue's correlationKey is not equal to the given one. */ public S hasCorrelationKey(String correlationKey) { // check that actual MessageSubscriptionRecordValue we want to make assertions on is not null. isNotNull(); // overrides the default error message with a more explicit one String assertjErrorMessage = "\nExpecting correlationKey of:\n <%s>\nto be:\n <%s>\nbut was:\n <%s>"; // null safe check String actualCorrelationKey = actual.getCorrelationKey(); if (!Objects.areEqual(actualCorrelationKey, correlationKey)) { failWithMessage(assertjErrorMessage, actual, correlationKey, actualCorrelationKey); } // return the current assertion for method chaining return myself; }
@Test public void shouldOpenMessageSubscriptionsOnDifferentPartitions() { // when IntStream.range(0, 10) .forEach( i -> { testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_0)); testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_1)); testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_2)); }); // then assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED) .limit(30)) .extracting(r -> tuple(r.getMetadata().getPartitionId(), r.getValue().getCorrelationKey())) .containsOnly( tuple(0, CORRELATION_KEY_PARTITION_0), tuple(1, CORRELATION_KEY_PARTITION_1), tuple(2, CORRELATION_KEY_PARTITION_2)); }
@Test public void shouldOpenMessageSubscriptionsOnDifferentPartitions() { // when IntStream.range(0, 10) .forEach( i -> { testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_0)); testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_1)); testClient.createWorkflowInstance( PROCESS_ID, asMsgPack("key", CORRELATION_KEY_PARTITION_2)); }); // then assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED) .limit(30)) .extracting(r -> tuple(r.getMetadata().getPartitionId(), r.getValue().getCorrelationKey())) .containsOnly( tuple(0, CORRELATION_KEY_PARTITION_0), tuple(1, CORRELATION_KEY_PARTITION_1), tuple(2, CORRELATION_KEY_PARTITION_2)); }