Search in sources :

Example 1 with BrokerFailJobRequest

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"));
}
Also used : BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) FailJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest) BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) FailJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 2 with BrokerFailJobRequest

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"));
}
Also used : BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) FailJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest) BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) FailJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 3 with BrokerFailJobRequest

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"));
}
Also used : BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) FailJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest) BrokerFailJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) FailJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Aggregations

GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)3 BrokerFailJobRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerFailJobRequest)3 FailJobRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobRequest)3 FailJobResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.FailJobResponse)3 JobRecord (io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)3 Test (org.junit.Test)3