Search in sources :

Example 1 with CompleteJobResponse

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse in project zeebe by camunda.

the class CompleteJobTest method shouldConvertEmptyVariables.

@Test
public void shouldConvertEmptyVariables() {
    // given
    final CompleteJobStub stub = new CompleteJobStub();
    stub.registerWith(brokerClient);
    final CompleteJobRequest request = CompleteJobRequest.newBuilder().setJobKey(stub.getKey()).setVariables("").build();
    // when
    final CompleteJobResponse response = client.completeJob(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCompleteJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
    final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
    MsgPackUtil.assertEqualityExcluding(brokerRequestValue.getVariablesBuffer(), "{}");
}
Also used : CompleteJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) CompleteJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 2 with CompleteJobResponse

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse in project zeebe by camunda.

the class CompleteJobTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CompleteJobStub stub = new CompleteJobStub();
    stub.registerWith(brokerClient);
    final String variables = JsonUtil.toJson(Collections.singletonMap("key", "value"));
    final CompleteJobRequest request = CompleteJobRequest.newBuilder().setJobKey(stub.getKey()).setVariables(variables).build();
    // when
    final CompleteJobResponse response = client.completeJob(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCompleteJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
    assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.COMPLETE);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
    final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
    MsgPackUtil.assertEqualityExcluding(brokerRequestValue.getVariablesBuffer(), variables);
}
Also used : CompleteJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) CompleteJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 3 with CompleteJobResponse

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse in project zeebe by zeebe-io.

the class CompleteJobTest method shouldConvertEmptyVariables.

@Test
public void shouldConvertEmptyVariables() {
    // given
    final CompleteJobStub stub = new CompleteJobStub();
    stub.registerWith(brokerClient);
    final CompleteJobRequest request = CompleteJobRequest.newBuilder().setJobKey(stub.getKey()).setVariables("").build();
    // when
    final CompleteJobResponse response = client.completeJob(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCompleteJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
    final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
    MsgPackUtil.assertEqualityExcluding(brokerRequestValue.getVariablesBuffer(), "{}");
}
Also used : CompleteJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) CompleteJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 4 with CompleteJobResponse

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse in project zeebe by camunda-cloud.

the class CompleteJobTest method shouldConvertEmptyVariables.

@Test
public void shouldConvertEmptyVariables() {
    // given
    final CompleteJobStub stub = new CompleteJobStub();
    stub.registerWith(brokerClient);
    final CompleteJobRequest request = CompleteJobRequest.newBuilder().setJobKey(stub.getKey()).setVariables("").build();
    // when
    final CompleteJobResponse response = client.completeJob(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCompleteJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
    final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
    MsgPackUtil.assertEqualityExcluding(brokerRequestValue.getVariablesBuffer(), "{}");
}
Also used : CompleteJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) CompleteJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 5 with CompleteJobResponse

use of io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse in project zeebe by camunda-cloud.

the class CompleteJobTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CompleteJobStub stub = new CompleteJobStub();
    stub.registerWith(brokerClient);
    final String variables = JsonUtil.toJson(Collections.singletonMap("key", "value"));
    final CompleteJobRequest request = CompleteJobRequest.newBuilder().setJobKey(stub.getKey()).setVariables(variables).build();
    // when
    final CompleteJobResponse response = client.completeJob(request);
    // then
    assertThat(response).isNotNull();
    final BrokerCompleteJobRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getKey()).isEqualTo(stub.getKey());
    assertThat(brokerRequest.getIntent()).isEqualTo(JobIntent.COMPLETE);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.JOB);
    final JobRecord brokerRequestValue = brokerRequest.getRequestWriter();
    MsgPackUtil.assertEqualityExcluding(brokerRequestValue.getVariablesBuffer(), variables);
}
Also used : CompleteJobRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) JobRecord(io.camunda.zeebe.protocol.impl.record.value.job.JobRecord) BrokerCompleteJobRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest) CompleteJobResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Aggregations

GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)6 BrokerCompleteJobRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerCompleteJobRequest)6 CompleteJobRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobRequest)6 CompleteJobResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CompleteJobResponse)6 JobRecord (io.camunda.zeebe.protocol.impl.record.value.job.JobRecord)6 Test (org.junit.Test)6