use of io.zeebe.client.impl.TasksClientImpl in project zeebe by zeebe-io.
the class TaskSubscriptionTest method shouldSendCorrectCreditsRequest.
@Test
public void shouldSendCorrectCreditsRequest() {
// given
broker.stubTaskSubscriptionApi(123L);
final TasksClientImpl taskClient = (TasksClientImpl) clientRule.tasks();
// when
taskClient.increaseSubscriptionCredits(StubBrokerRule.TEST_PARTITION_ID).credits(123).subscriberKey(456L).execute();
// then
final List<ControlMessageRequest> controlMessageRequests = broker.getReceivedControlMessageRequests().stream().filter(r -> r.messageType() == ControlMessageType.INCREASE_TASK_SUBSCRIPTION_CREDITS).collect(Collectors.toList());
assertThat(controlMessageRequests).hasSize(1);
final ControlMessageRequest request = controlMessageRequests.get(0);
assertThat(request.messageType()).isEqualTo(ControlMessageType.INCREASE_TASK_SUBSCRIPTION_CREDITS);
assertThat(request.getData()).contains(entry("credits", 123), entry("subscriberKey", 456));
}
Aggregations