use of io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest in project zeebe by camunda.
the class FailJobTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final FailJobStub stub = new FailJobStub();
stub.registerWith(brokerClient);
final int retries = 123;
final int retryBackOff = 100;
final FailJobRequest request = FailJobRequest.newBuilder().setJobKey(stub.getKey()).setRetries(retries).setRetryBackOff(retryBackOff).setErrorMessage("failed").build();
// when
final FailJobResponse response = client.failJob(request);
// then
assertThat(response).isNotNull();
final BrokerFailJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.FAIL);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getRetries()).isEqualTo(retries);
assertThat(brokerRequestValue.getRetryBackoff()).isEqualTo(retryBackOff);
assertThat(brokerRequestValue.getErrorMessageBuffer()).isEqualTo(wrapString("failed"));
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest in project zeebe by zeebe-io.
the class FailJobTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final FailJobStub stub = new FailJobStub();
stub.registerWith(brokerClient);
final int retries = 123;
final int retryBackOff = 100;
final FailJobRequest request = FailJobRequest.newBuilder().setJobKey(stub.getKey()).setRetries(retries).setRetryBackOff(retryBackOff).setErrorMessage("failed").build();
// when
final FailJobResponse response = client.failJob(request);
// then
assertThat(response).isNotNull();
final BrokerFailJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.FAIL);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getRetries()).isEqualTo(retries);
assertThat(brokerRequestValue.getRetryBackoff()).isEqualTo(retryBackOff);
assertThat(brokerRequestValue.getErrorMessageBuffer()).isEqualTo(wrapString("failed"));
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest in project zeebe by camunda-cloud.
the class FailJobTest method shouldMapRequestAndResponse.
@Test
public void shouldMapRequestAndResponse() {
// given
final FailJobStub stub = new FailJobStub();
stub.registerWith(brokerClient);
final int retries = 123;
final int retryBackOff = 100;
final FailJobRequest request = FailJobRequest.newBuilder().setJobKey(stub.getKey()).setRetries(retries).setRetryBackOff(retryBackOff).setErrorMessage("failed").build();
// when
final FailJobResponse response = client.failJob(request);
// then
assertThat(response).isNotNull();
final BrokerFailJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.FAIL);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getRetries()).isEqualTo(retries);
assertThat(brokerRequestValue.getRetryBackoff()).isEqualTo(retryBackOff);
assertThat(brokerRequestValue.getErrorMessageBuffer()).isEqualTo(wrapString("failed"));
}
Aggregations