use of io.camunda.zeebe.gateway.impl.broker.response.BrokerRejectionResponse in project zeebe by zeebe-io.
the class ActivateJobsTest method shouldSendRejectionWithoutRetrying.
@Test
public void shouldSendRejectionWithoutRetrying() {
// given
final RejectionType rejectionType = RejectionType.INVALID_ARGUMENT;
final AtomicInteger callCounter = new AtomicInteger();
brokerClient.registerHandler(BrokerActivateJobsRequest.class, (RequestHandler<BrokerRequest<?>, BrokerResponse<?>>) request -> {
callCounter.incrementAndGet();
return new BrokerRejectionResponse<>(new BrokerRejection(Intent.UNKNOWN, 1, rejectionType, "expected"));
});
final ActivateJobsRequest request = ActivateJobsRequest.newBuilder().setType("").setMaxJobsToActivate(1).build();
// when/then
assertThatThrownBy(() -> {
final Iterator<ActivateJobsResponse> responseIterator = client.activateJobs(request);
responseIterator.hasNext();
}).isInstanceOf(StatusRuntimeException.class).extracting(t -> ((StatusRuntimeException) t).getStatus().getCode()).isEqualTo(Status.INVALID_ARGUMENT.getCode());
assertThat(callCounter).hasValue(1);
}
use of io.camunda.zeebe.gateway.impl.broker.response.BrokerRejectionResponse in project zeebe by camunda-cloud.
the class ActivateJobsTest method shouldSendRejectionWithoutRetrying.
@Test
public void shouldSendRejectionWithoutRetrying() {
// given
final RejectionType rejectionType = RejectionType.INVALID_ARGUMENT;
final AtomicInteger callCounter = new AtomicInteger();
brokerClient.registerHandler(BrokerActivateJobsRequest.class, (RequestHandler<BrokerRequest<?>, BrokerResponse<?>>) request -> {
callCounter.incrementAndGet();
return new BrokerRejectionResponse<>(new BrokerRejection(Intent.UNKNOWN, 1, rejectionType, "expected"));
});
final ActivateJobsRequest request = ActivateJobsRequest.newBuilder().setType("").setMaxJobsToActivate(1).build();
// when/then
assertThatThrownBy(() -> {
final Iterator<ActivateJobsResponse> responseIterator = client.activateJobs(request);
responseIterator.hasNext();
}).isInstanceOf(StatusRuntimeException.class).extracting(t -> ((StatusRuntimeException) t).getStatus().getCode()).isEqualTo(Status.INVALID_ARGUMENT.getCode());
assertThat(callCounter).hasValue(1);
}
use of io.camunda.zeebe.gateway.impl.broker.response.BrokerRejectionResponse in project zeebe by camunda.
the class ActivateJobsTest method shouldSendRejectionWithoutRetrying.
@Test
public void shouldSendRejectionWithoutRetrying() {
// given
final RejectionType rejectionType = RejectionType.INVALID_ARGUMENT;
final AtomicInteger callCounter = new AtomicInteger();
brokerClient.registerHandler(BrokerActivateJobsRequest.class, (RequestHandler<BrokerRequest<?>, BrokerResponse<?>>) request -> {
callCounter.incrementAndGet();
return new BrokerRejectionResponse<>(new BrokerRejection(Intent.UNKNOWN, 1, rejectionType, "expected"));
});
final ActivateJobsRequest request = ActivateJobsRequest.newBuilder().setType("").setMaxJobsToActivate(1).build();
// when/then
assertThatThrownBy(() -> {
final Iterator<ActivateJobsResponse> responseIterator = client.activateJobs(request);
responseIterator.hasNext();
}).isInstanceOf(StatusRuntimeException.class).extracting(t -> ((StatusRuntimeException) t).getStatus().getCode()).isEqualTo(Status.INVALID_ARGUMENT.getCode());
assertThat(callCounter).hasValue(1);
}
Aggregations