use of io.camunda.zeebe.gateway.impl.job.InflightActivateJobsRequest in project zeebe by camunda.
the class LongPollingActivateJobsTest method shouldProbeIfNoNotificationReceived.
@Test
public void shouldProbeIfNoNotificationReceived() throws Exception {
// given
final long probeTimeout = 2000;
handler = LongPollingActivateJobsHandler.newBuilder().setBrokerClient(brokerClient).setLongPollingTimeout(20000).setProbeTimeoutMillis(probeTimeout).build();
submitActorToActivateJobs(handler);
final InflightActivateJobsRequest request = getLongPollingActivateJobsRequest();
handler.activateJobs(request);
waitUntil(request::hasScheduledTimer);
// when
actorClock.addTime(Duration.ofMillis(probeTimeout));
// then
verify(activateJobsStub, timeout(2000).times(2 * partitionsCount)).handle(any());
}
use of io.camunda.zeebe.gateway.impl.job.InflightActivateJobsRequest in project zeebe by camunda.
the class LongPollingActivateJobsTest method shouldNotBlockWhenNegativeTimeout.
@Test
public void shouldNotBlockWhenNegativeTimeout() {
// given
final InflightActivateJobsRequest request = new InflightActivateJobsRequest(getNextRequestId(), ActivateJobsRequest.newBuilder().setType(TYPE).setMaxJobsToActivate(1).setRequestTimeout(-1).build(), spy(ServerStreamObserver.class));
// when
handler.activateJobs(request);
verify(request.getResponseObserver(), timeout(1000).times(1)).onCompleted();
// then
assertThat(request.hasScheduledTimer()).isFalse();
assertThat(request.isTimedOut()).isFalse();
}
use of io.camunda.zeebe.gateway.impl.job.InflightActivateJobsRequest in project zeebe by camunda.
the class LongPollingActivateJobsTest method shouldBlockImmediatelyAfterThreshold.
@Test
public void shouldBlockImmediatelyAfterThreshold() throws Exception {
// given
final int amount = FAILED_RESPONSE_THRESHOLD;
activateJobsAndWaitUntilBlocked(amount);
// when
final InflightActivateJobsRequest request = getLongPollingActivateJobsRequest();
handler.activateJobs(request);
waitUntil(request::hasScheduledTimer);
// then
verify(activateJobsStub, times(amount * partitionsCount)).handle(any());
}
use of io.camunda.zeebe.gateway.impl.job.InflightActivateJobsRequest in project zeebe by camunda.
the class LongPollingActivateJobsTest method shouldBlockRequestsWhenResponseHasNoJobs.
@Test
public void shouldBlockRequestsWhenResponseHasNoJobs() {
// given
final InflightActivateJobsRequest request = getLongPollingActivateJobsRequest();
// when
handler.activateJobs(request);
// then
waitUntil(request::hasScheduledTimer);
verify(request.getResponseObserver(), times(0)).onCompleted();
}
use of io.camunda.zeebe.gateway.impl.job.InflightActivateJobsRequest in project zeebe by camunda.
the class LongPollingActivateJobsTest method shouldCompleteAfterRequestTimeout.
@Test
public void shouldCompleteAfterRequestTimeout() {
// given
final InflightActivateJobsRequest longPollingRequest = getLongPollingActivateJobsRequest();
// when
handler.activateJobs(longPollingRequest);
waitUntil(longPollingRequest::hasScheduledTimer);
actorClock.addTime(Duration.ofMillis(LONG_POLLING_TIMEOUT));
waitUntil(longPollingRequest::isTimedOut);
// then
verify(longPollingRequest.getResponseObserver(), times(1)).onCompleted();
}
Aggregations