Search in sources :

Example 1 with CreateProcessInstanceResponse

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

the class CreateProcessInstanceTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CreateProcessInstanceStub stub = new CreateProcessInstanceStub();
    stub.registerWith(brokerClient);
    final CreateProcessInstanceRequest request = CreateProcessInstanceRequest.newBuilder().setProcessDefinitionKey(stub.getProcessDefinitionKey()).build();
    // when
    final CreateProcessInstanceResponse response = client.createProcessInstance(request);
    // then
    assertThat(response.getBpmnProcessId()).isEqualTo(stub.getProcessId());
    assertThat(response.getVersion()).isEqualTo(stub.getProcessVersion());
    assertThat(response.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
    assertThat(response.getProcessInstanceKey()).isEqualTo(stub.getProcessInstanceKey());
    final BrokerCreateProcessInstanceRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATE);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE_CREATION);
    final ProcessInstanceCreationRecord brokerRequestValue = brokerRequest.getRequestWriter();
    assertThat(brokerRequestValue.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
}
Also used : CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) ProcessInstanceCreationRecord(io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) CreateProcessInstanceResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 2 with CreateProcessInstanceResponse

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

the class CreateProcessInstanceTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CreateProcessInstanceStub stub = new CreateProcessInstanceStub();
    stub.registerWith(brokerClient);
    final CreateProcessInstanceRequest request = CreateProcessInstanceRequest.newBuilder().setProcessDefinitionKey(stub.getProcessDefinitionKey()).build();
    // when
    final CreateProcessInstanceResponse response = client.createProcessInstance(request);
    // then
    assertThat(response.getBpmnProcessId()).isEqualTo(stub.getProcessId());
    assertThat(response.getVersion()).isEqualTo(stub.getProcessVersion());
    assertThat(response.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
    assertThat(response.getProcessInstanceKey()).isEqualTo(stub.getProcessInstanceKey());
    final BrokerCreateProcessInstanceRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATE);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE_CREATION);
    final ProcessInstanceCreationRecord brokerRequestValue = brokerRequest.getRequestWriter();
    assertThat(brokerRequestValue.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
}
Also used : CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) ProcessInstanceCreationRecord(io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) CreateProcessInstanceResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Example 3 with CreateProcessInstanceResponse

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

the class CreateProcessInstanceTest method shouldMapRequestAndResponse.

@Test
public void shouldMapRequestAndResponse() {
    // given
    final CreateProcessInstanceStub stub = new CreateProcessInstanceStub();
    stub.registerWith(brokerClient);
    final CreateProcessInstanceRequest request = CreateProcessInstanceRequest.newBuilder().setProcessDefinitionKey(stub.getProcessDefinitionKey()).build();
    // when
    final CreateProcessInstanceResponse response = client.createProcessInstance(request);
    // then
    assertThat(response.getBpmnProcessId()).isEqualTo(stub.getProcessId());
    assertThat(response.getVersion()).isEqualTo(stub.getProcessVersion());
    assertThat(response.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
    assertThat(response.getProcessInstanceKey()).isEqualTo(stub.getProcessInstanceKey());
    final BrokerCreateProcessInstanceRequest brokerRequest = brokerClient.getSingleBrokerRequest();
    assertThat(brokerRequest.getIntent()).isEqualTo(ProcessInstanceCreationIntent.CREATE);
    assertThat(brokerRequest.getValueType()).isEqualTo(ValueType.PROCESS_INSTANCE_CREATION);
    final ProcessInstanceCreationRecord brokerRequestValue = brokerRequest.getRequestWriter();
    assertThat(brokerRequestValue.getProcessDefinitionKey()).isEqualTo(stub.getProcessDefinitionKey());
}
Also used : CreateProcessInstanceRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceRequest) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) ProcessInstanceCreationRecord(io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord) BrokerCreateProcessInstanceRequest(io.camunda.zeebe.gateway.impl.broker.request.BrokerCreateProcessInstanceRequest) CreateProcessInstanceResponse(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceResponse) GatewayTest(io.camunda.zeebe.gateway.api.util.GatewayTest) Test(org.junit.Test)

Aggregations

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 CreateProcessInstanceResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CreateProcessInstanceResponse)3 ProcessInstanceCreationRecord (io.camunda.zeebe.protocol.impl.record.value.processinstance.ProcessInstanceCreationRecord)3 Test (org.junit.Test)3