use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest in project zeebe by camunda.
the class UpdateJobRetriesTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final UpdateJobRetriesStub stub = new UpdateJobRetriesStub();
stub.registerWith(brokerClient);
final int retries = 123;
final UpdateJobRetriesRequest request = UpdateJobRetriesRequest.newBuilder().setJobKey(stub.getKey()).setRetries(retries).build();
// when
final UpdateJobRetriesResponse response = client.updateJobRetries(request);
// then
assertThat(response).isNotNull();
final BrokerUpdateJobRetriesRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.UPDATE_RETRIES);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getRetries()).isEqualTo(retries);
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest in project zeebe by camunda.
the class JobUpdateRetriesTest method shouldUpdateRetriesByKey.
@Test
public void shouldUpdateRetriesByKey() {
// given
final long jobKey = 12;
final int newRetries = 23;
// when
client.newUpdateRetriesCommand(jobKey).retries(newRetries).send().join();
// then
final UpdateJobRetriesRequest request = gatewayService.getLastRequest();
assertThat(request.getJobKey()).isEqualTo(jobKey);
assertThat(request.getRetries()).isEqualTo(newRetries);
rule.verifyDefaultRequestTimeout();
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest in project zeebe by zeebe-io.
the class UpdateJobRetriesTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final UpdateJobRetriesStub stub = new UpdateJobRetriesStub();
stub.registerWith(brokerClient);
final int retries = 123;
final UpdateJobRetriesRequest request = UpdateJobRetriesRequest.newBuilder().setJobKey(stub.getKey()).setRetries(retries).build();
// when
final UpdateJobRetriesResponse response = client.updateJobRetries(request);
// then
assertThat(response).isNotNull();
final BrokerUpdateJobRetriesRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.UPDATE_RETRIES);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getRetries()).isEqualTo(retries);
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest in project zeebe by zeebe-io.
the class JobUpdateRetriesTest method shouldUpdateRetries.
@Test
public void shouldUpdateRetries() {
// given
final int newRetries = 23;
final ActivatedJob job = Mockito.mock(ActivatedJob.class);
Mockito.when(job.getKey()).thenReturn(12L);
// when
client.newUpdateRetriesCommand(job).retries(newRetries).send().join();
// then
final UpdateJobRetriesRequest request = gatewayService.getLastRequest();
assertThat(request.getJobKey()).isEqualTo(job.getKey());
assertThat(request.getRetries()).isEqualTo(newRetries);
rule.verifyDefaultRequestTimeout();
}
use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.UpdateJobRetriesRequest in project zeebe by zeebe-io.
the class JobUpdateRetriesCommandImpl method send.
@Override
public ZeebeFuture<UpdateRetriesJobResponse> send() {
final UpdateJobRetriesRequest request = builder.build();
final RetriableClientFutureImpl<UpdateRetriesJobResponse, GatewayOuterClass.UpdateJobRetriesResponse> future = new RetriableClientFutureImpl<>(UpdateRetriesJobResponseImpl::new, retryPredicate, streamObserver -> send(request, streamObserver));
send(request, future);
return future;
}
Aggregations