Search in sources :

Example 1 with DeployProcessRequest

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

the class DeployProcessCommandImpl method send.

@Override
public ZeebeFuture<DeploymentEvent> send() {
    final DeployProcessRequest request = requestBuilder.build();
    final RetriableClientFutureImpl<DeploymentEvent, GatewayOuterClass.DeployProcessResponse> future = new RetriableClientFutureImpl<>(DeploymentEventImpl::new, retryPredicate, streamObserver -> send(request, streamObserver));
    send(request, future);
    return future;
}
Also used : RetriableClientFutureImpl(io.camunda.zeebe.client.impl.RetriableClientFutureImpl) DeployProcessRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) DeploymentEventImpl(io.camunda.zeebe.client.impl.response.DeploymentEventImpl)

Example 2 with DeployProcessRequest

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

the class DeployProcessTest method shouldDeployProcessFromInputStream.

@Test
public void shouldDeployProcessFromInputStream() {
    // given
    final String filename = BPMN_1_FILENAME;
    final InputStream resourceAsStream = DeployProcessTest.class.getResourceAsStream(filename);
    // when
    client.newDeployCommand().addResourceStream(resourceAsStream, filename).send().join();
    // then
    final DeployProcessRequest request = gatewayService.getLastRequest();
    final ProcessRequestObject process = request.getProcesses(0);
    assertThat(process.getName()).isEqualTo(filename);
    assertThat(process.getDefinition().toByteArray()).isEqualTo(getBytes(BPMN_1_FILENAME));
}
Also used : InputStream(java.io.InputStream) DeployProcessRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest) ProcessRequestObject(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 3 with DeployProcessRequest

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

the class DeployProcessTest method shouldDeployProcessFromBytes.

@Test
public void shouldDeployProcessFromBytes() {
    // given
    final String filename = BPMN_1_FILENAME;
    final byte[] bytes = getBytes(filename);
    // when
    client.newDeployCommand().addResourceBytes(bytes, filename).send().join();
    // then
    final DeployProcessRequest request = gatewayService.getLastRequest();
    final ProcessRequestObject process = request.getProcesses(0);
    assertThat(process.getName()).isEqualTo(filename);
    assertThat(process.getDefinition().toByteArray()).isEqualTo(getBytes(BPMN_1_FILENAME));
}
Also used : DeployProcessRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest) ProcessRequestObject(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 4 with DeployProcessRequest

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

the class DeployProcessTest method shouldDeployProcessFromString.

@Test
public void shouldDeployProcessFromString() {
    // given
    final String filename = BPMN_1_FILENAME;
    final String xml = new String(getBytes(filename));
    // when
    client.newDeployCommand().addResourceString(xml, StandardCharsets.UTF_8, filename).send().join();
    // then
    final DeployProcessRequest request = gatewayService.getLastRequest();
    final ProcessRequestObject process = request.getProcesses(0);
    assertThat(process.getName()).isEqualTo(filename);
    assertThat(process.getDefinition().toByteArray()).isEqualTo(getBytes(BPMN_1_FILENAME));
}
Also used : DeployProcessRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest) ProcessRequestObject(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 5 with DeployProcessRequest

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

the class DeployProcessTest method shouldDeployMultipleProcesses.

@Test
public void shouldDeployMultipleProcesses() {
    // given
    final long key = 345L;
    final String filename1 = BPMN_1_FILENAME.substring(1);
    final String filename2 = BPMN_2_FILENAME.substring(1);
    final Process expected1 = new ProcessImpl(1, BPMN_1_PROCESS_ID, 1, filename1);
    final Process expected2 = new ProcessImpl(2, BPMN_2_PROCESS_ID, 1, filename2);
    gatewayService.onDeployProcessRequest(key, deployedProcess(BPMN_1_PROCESS_ID, 1, 1, filename1), deployedProcess(BPMN_2_PROCESS_ID, 1, 2, filename2));
    // when
    final DeploymentEvent response = client.newDeployCommand().addResourceFromClasspath(filename1).addResourceFromClasspath(filename2).send().join();
    // then
    assertThat(response.getKey()).isEqualTo(key);
    final List<Process> processes = response.getProcesses();
    assertThat(processes).containsOnly(expected1, expected2);
    final DeployProcessRequest request = gatewayService.getLastRequest();
    assertThat(request.getProcessesList()).hasSize(2);
    ProcessRequestObject process = request.getProcesses(0);
    assertThat(process.getName()).isEqualTo(filename1);
    assertThat(process.getDefinition().toByteArray()).isEqualTo(getBytes(BPMN_1_FILENAME));
    process = request.getProcesses(1);
    assertThat(process.getName()).isEqualTo(filename2);
    assertThat(process.getDefinition().toByteArray()).isEqualTo(getBytes(BPMN_2_FILENAME));
}
Also used : ProcessImpl(io.camunda.zeebe.client.impl.response.ProcessImpl) RecordingGatewayService.deployedProcess(io.camunda.zeebe.client.util.RecordingGatewayService.deployedProcess) Process(io.camunda.zeebe.client.api.response.Process) DeployProcessRequest(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest) ProcessRequestObject(io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Aggregations

DeployProcessRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest)35 Test (org.junit.Test)29 ClientTest (io.camunda.zeebe.client.util.ClientTest)26 ProcessRequestObject (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject)26 DeploymentEvent (io.camunda.zeebe.client.api.response.DeploymentEvent)5 DeployProcessResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessResponse)5 ByteString (com.google.protobuf.ByteString)3 GatewayTest (io.camunda.zeebe.gateway.api.util.GatewayTest)3 BrokerDeployResourceRequest (io.camunda.zeebe.gateway.impl.broker.request.BrokerDeployResourceRequest)3 Builder (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest.Builder)3 ProcessMetadata (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessMetadata)3 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)3 RetriableClientFutureImpl (io.camunda.zeebe.client.impl.RetriableClientFutureImpl)2 DeploymentEventImpl (io.camunda.zeebe.client.impl.response.DeploymentEventImpl)2 GatewayGrpc (io.camunda.zeebe.gateway.protocol.GatewayGrpc)2 GatewayOuterClass (io.camunda.zeebe.gateway.protocol.GatewayOuterClass)2 ActivateJobsRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivateJobsRequest)2 ActivateJobsResponse (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ActivateJobsResponse)2 BrokerInfo (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.BrokerInfo)2 CancelProcessInstanceRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.CancelProcessInstanceRequest)2