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(), "{}");
}
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);
}
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(), "{}");
}
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(), "{}");
}
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);
}
Aggregations