Search in sources :

Example 1 with ProcessImpl

use of io.camunda.zeebe.client.impl.response.ProcessImpl 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)

Example 2 with ProcessImpl

use of io.camunda.zeebe.client.impl.response.ProcessImpl in project zeebe by zeebe-io.

the class DeployProcessTest method shouldReceiveDeployedProcessMetadataInResponse.

@Test
public void shouldReceiveDeployedProcessMetadataInResponse() {
    // given
    final long key = 123L;
    final String filename = DeployProcessTest.class.getResource(BPMN_1_FILENAME).getPath();
    gatewayService.onDeployProcessRequest(key, deployedProcess(BPMN_1_PROCESS_ID, 12, 423, filename));
    // when
    final DeploymentEvent response = client.newDeployCommand().addResourceFile(filename).send().join();
    // then
    assertThat(response.getKey()).isEqualTo(key);
    assertThat(response.getProcesses()).containsExactly(new ProcessImpl(423, BPMN_1_PROCESS_ID, 12, filename));
}
Also used : ProcessImpl(io.camunda.zeebe.client.impl.response.ProcessImpl) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 3 with ProcessImpl

use of io.camunda.zeebe.client.impl.response.ProcessImpl in project zeebe by camunda-cloud.

the class DeployProcessTest method shouldReceiveDeployedProcessMetadataInResponse.

@Test
public void shouldReceiveDeployedProcessMetadataInResponse() {
    // given
    final long key = 123L;
    final String filename = DeployProcessTest.class.getResource(BPMN_1_FILENAME).getPath();
    gatewayService.onDeployProcessRequest(key, deployedProcess(BPMN_1_PROCESS_ID, 12, 423, filename));
    // when
    final DeploymentEvent response = client.newDeployCommand().addResourceFile(filename).send().join();
    // then
    assertThat(response.getKey()).isEqualTo(key);
    assertThat(response.getProcesses()).containsExactly(new ProcessImpl(423, BPMN_1_PROCESS_ID, 12, filename));
}
Also used : ProcessImpl(io.camunda.zeebe.client.impl.response.ProcessImpl) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 4 with ProcessImpl

use of io.camunda.zeebe.client.impl.response.ProcessImpl in project zeebe by camunda-cloud.

the class DeployProcessTest method shouldDeployMultipleProcessesAsResources.

@Test
public void shouldDeployMultipleProcessesAsResources() {
    // given
    final long key = 345L;
    final String filename1 = BPMN_1_FILENAME.substring(1);
    final String filename2 = BPMN_2_FILENAME.substring(1);
    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);
    assertThat(response.getProcesses()).containsExactly(new ProcessImpl(1, BPMN_1_PROCESS_ID, 1, filename1), new ProcessImpl(2, BPMN_2_PROCESS_ID, 1, filename2));
}
Also used : ProcessImpl(io.camunda.zeebe.client.impl.response.ProcessImpl) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Example 5 with ProcessImpl

use of io.camunda.zeebe.client.impl.response.ProcessImpl in project zeebe by camunda-cloud.

the class DeployResourceTest method shouldDeployMultipleProcessesAsResources.

@Test
public void shouldDeployMultipleProcessesAsResources() {
    // given
    final long key = 345L;
    final String filename1 = BPMN_1_FILENAME.substring(1);
    final String filename2 = BPMN_2_FILENAME.substring(1);
    gatewayService.onDeployResourceRequest(key, deployment(deployedProcess(BPMN_1_PROCESS_ID, 1, 1, filename1)), deployment(deployedProcess(BPMN_2_PROCESS_ID, 1, 2, filename2)));
    // when
    final DeploymentEvent response = client.newDeployResourceCommand().addResourceFromClasspath(filename1).addResourceFromClasspath(filename2).send().join();
    // then
    assertThat(response.getKey()).isEqualTo(key);
    assertThat(response.getProcesses()).containsExactly(new ProcessImpl(1, BPMN_1_PROCESS_ID, 1, filename1), new ProcessImpl(2, BPMN_2_PROCESS_ID, 1, filename2));
}
Also used : ProcessImpl(io.camunda.zeebe.client.impl.response.ProcessImpl) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) ClientTest(io.camunda.zeebe.client.util.ClientTest) Test(org.junit.Test)

Aggregations

DeploymentEvent (io.camunda.zeebe.client.api.response.DeploymentEvent)10 ProcessImpl (io.camunda.zeebe.client.impl.response.ProcessImpl)10 ClientTest (io.camunda.zeebe.client.util.ClientTest)10 Test (org.junit.Test)10 Process (io.camunda.zeebe.client.api.response.Process)2 RecordingGatewayService.deployedProcess (io.camunda.zeebe.client.util.RecordingGatewayService.deployedProcess)2 DeployProcessRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest)2 ProcessRequestObject (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.ProcessRequestObject)2