use of io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest in project zeebe by camunda.
the class RequestMapper method toCreateProcessInstanceWithResultRequest.
public static BrokerCreateProcessInstanceWithResultRequest toCreateProcessInstanceWithResultRequest(final CreateProcessInstanceWithResultRequest grpcRequest) {
final BrokerCreateProcessInstanceWithResultRequest brokerRequest = new BrokerCreateProcessInstanceWithResultRequest();
final CreateProcessInstanceRequest request = grpcRequest.getRequest();
brokerRequest.setBpmnProcessId(request.getBpmnProcessId()).setKey(request.getProcessDefinitionKey()).setVersion(request.getVersion()).setVariables(ensureJsonSet(request.getVariables())).setFetchVariables(grpcRequest.getFetchVariablesList());
return brokerRequest;
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest in project zeebe by zeebe-io.
the class RequestMapper method toCreateProcessInstanceWithResultRequest.
public static BrokerCreateProcessInstanceWithResultRequest toCreateProcessInstanceWithResultRequest(final CreateProcessInstanceWithResultRequest grpcRequest) {
final BrokerCreateProcessInstanceWithResultRequest brokerRequest = new BrokerCreateProcessInstanceWithResultRequest();
final CreateProcessInstanceRequest request = grpcRequest.getRequest();
brokerRequest.setBpmnProcessId(request.getBpmnProcessId()).setKey(request.getProcessDefinitionKey()).setVersion(request.getVersion()).setVariables(ensureJsonSet(request.getVariables())).setFetchVariables(grpcRequest.getFetchVariablesList());
return brokerRequest;
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest in project zeebe by zeebe-io.
the class CreateProcessInstanceWithResultTest method shouldMapToBrokerRequest.
@Test
public void shouldMapToBrokerRequest() {
// given
final CreateProcessInstanceWithResultStub stub = new CreateProcessInstanceWithResultStub();
stub.registerWith(brokerClient);
final CreateProcessInstanceWithResultRequest request = CreateProcessInstanceWithResultRequest.newBuilder().setRequest(CreateProcessInstanceRequest.newBuilder().setProcessDefinitionKey(stub.getProcessDefinitionKey())).addAllFetchVariables(List.of("x")).build();
// when
client.createProcessInstanceWithResult(request);
// then
final BrokerCreateProcessInstanceWithResultRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATE_WITH_AWAITING_RESULT);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE_CREATION);
final ProcessInstanceCreationRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
assertThat(brokerRequestValue.fetchVariables().iterator().next().getValue()).isEqualTo(wrapString("x"));
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest in project zeebe by camunda-cloud.
the class CreateProcessInstanceWithResultTest method shouldMapToBrokerRequest.
@Test
public void shouldMapToBrokerRequest() {
// given
final CreateProcessInstanceWithResultStub stub = new CreateProcessInstanceWithResultStub();
stub.registerWith(brokerClient);
final CreateProcessInstanceWithResultRequest request = CreateProcessInstanceWithResultRequest.newBuilder().setRequest(CreateProcessInstanceRequest.newBuilder().setProcessDefinitionKey(stub.getProcessDefinitionKey())).addAllFetchVariables(List.of("x")).build();
// when
client.createProcessInstanceWithResult(request);
// then
final BrokerCreateProcessInstanceWithResultRequest brokerRequest = brokerClient.getSingleBrokerRequest();
assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATE_WITH_AWAITING_RESULT);
assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE_CREATION);
final ProcessInstanceCreationRecord brokerRequestValue = brokerRequest.getRequestWriter();
assertThat(brokerRequestValue.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
assertThat(brokerRequestValue.fetchVariables().iterator().next().getValue()).isEqualTo(wrapString("x"));
}
use of io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest in project zeebe by camunda-cloud.
the class RequestMapper method toCreateProcessInstanceWithResultRequest.
public static BrokerCreateProcessInstanceWithResultRequest toCreateProcessInstanceWithResultRequest(final CreateProcessInstanceWithResultRequest grpcRequest) {
final BrokerCreateProcessInstanceWithResultRequest brokerRequest = new BrokerCreateProcessInstanceWithResultRequest();
final CreateProcessInstanceRequest request = grpcRequest.getRequest();
brokerRequest.setBpmnProcessId(request.getBpmnProcessId()).setKey(request.getProcessDefinitionKey()).setVersion(request.getVersion()).setVariables(ensureJsonSet(request.getVariables())).setFetchVariables(grpcRequest.getFetchVariablesList());
return brokerRequest;
}
Aggregations