Search in sources :

Example 1 with BrokerCreateProcessInstanceWithResultRequest

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;
}
Also used : BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest)

Example 2 with BrokerCreateProcessInstanceWithResultRequest

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;
}
Also used : BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest)

Example 3 with BrokerCreateProcessInstanceWithResultRequest

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"));
}
Also used : CreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceWithResultRequest) BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) ProcessInstanceCreationRecord(io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 4 with BrokerCreateProcessInstanceWithResultRequest

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"));
}
Also used : CreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceWithResultRequest) BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) ProcessInstanceCreationRecord(io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 5 with BrokerCreateProcessInstanceWithResultRequest

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;
}
Also used : BrokerCreateProcessInstanceWithResultRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest) CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest)

Aggregations

BrokerCreateProcessInstanceWithResultRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceWithResultRequest)6 GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)3 BrokerCreateProcessInstanceRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest)3 CreateProcessInstanceRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest)3 CreateProcessInstanceWithResultRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceWithResultRequest)3 ProcessInstanceCreationRecord (io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord)3 Test (org.junit.Test)3