Search in sources :

Example 16 with DeploymentEvent

use of io.camunda.zeebe.client.api.response.DeploymentEvent in project zeebe-process-test by camunda-cloud.

the class EngineClientTest method shouldCreateInstanceWithoutVariables.

@Test
void shouldCreateInstanceWithoutVariables() {
    // given
    final DeploymentEvent deployment = zeebeClient.newDeployCommand().addProcessModel(Bpmn.createExecutableProcess("simpleProcess").startEvent().endEvent().done(), "simpleProcess.bpmn").send().join();
    // when
    final ProcessInstanceEvent processInstance = zeebeClient.newCreateInstanceCommand().bpmnProcessId("simpleProcess").latestVersion().send().join();
    // then
    assertThat(processInstance.getProcessInstanceKey()).isPositive();
    assertThat(processInstance.getBpmnProcessId()).isEqualTo("simpleProcess");
    assertThat(processInstance.getProcessDefinitionKey()).isEqualTo(deployment.getProcesses().get(0).getProcessDefinitionKey());
    assertThat(processInstance.getVersion()).isEqualTo(1);
}
Also used : ProcessInstanceEvent(io.camunda.zeebe.client.api.response.ProcessInstanceEvent) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) Test(org.junit.jupiter.api.Test)

Example 17 with DeploymentEvent

use of io.camunda.zeebe.client.api.response.DeploymentEvent in project zeebe-process-test by camunda-cloud.

the class EngineClientTest method shouldDeployProcess.

@Test
void shouldDeployProcess() {
    // given
    // when
    final DeploymentEvent deployment = zeebeClient.newDeployCommand().addProcessModel(Bpmn.createExecutableProcess("simpleProcess").startEvent().endEvent().done(), "simpleProcess.bpmn").send().join();
    // then
    assertThat(deployment.getKey()).isPositive();
    assertThat(deployment.getProcesses()).isNotEmpty();
    final Process process = deployment.getProcesses().get(0);
    assertThat(process.getVersion()).isEqualTo(1);
    assertThat(process.getResourceName()).isEqualTo("simpleProcess.bpmn");
    assertThat(process.getBpmnProcessId()).isEqualTo("simpleProcess");
    assertThat(process.getProcessDefinitionKey()).isPositive();
}
Also used : Process(io.camunda.zeebe.client.api.response.Process) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) Test(org.junit.jupiter.api.Test)

Example 18 with DeploymentEvent

use of io.camunda.zeebe.client.api.response.DeploymentEvent in project zeebe-process-test by camunda-cloud.

the class EngineClientTest method shouldDeployResource.

@Test
void shouldDeployResource() {
    // given
    // when
    final DeploymentEvent deployment = zeebeClient.newDeployResourceCommand().addProcessModel(Bpmn.createExecutableProcess("simpleProcess").startEvent().endEvent().done(), "simpleProcess.bpmn").send().join();
    // then
    assertThat(deployment.getKey()).isPositive();
    assertThat(deployment.getProcesses()).isNotEmpty();
    final Process process = deployment.getProcesses().get(0);
    assertThat(process.getVersion()).isEqualTo(1);
    assertThat(process.getResourceName()).isEqualTo("simpleProcess.bpmn");
    assertThat(process.getBpmnProcessId()).isEqualTo("simpleProcess");
    assertThat(process.getProcessDefinitionKey()).isPositive();
}
Also used : Process(io.camunda.zeebe.client.api.response.Process) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) Test(org.junit.jupiter.api.Test)

Example 19 with DeploymentEvent

use of io.camunda.zeebe.client.api.response.DeploymentEvent in project zeebe-process-test by camunda-cloud.

the class EngineClientTest method shouldCreateProcessInstanceWithResult.

@Test
void shouldCreateProcessInstanceWithResult() {
    // given
    final DeploymentEvent deployment = zeebeClient.newDeployCommand().addProcessModel(Bpmn.createExecutableProcess("simpleProcess").startEvent().endEvent().done(), "simpleProcess.bpmn").send().join();
    // when
    final ProcessInstanceResult processInstanceResult = zeebeClient.newCreateInstanceCommand().bpmnProcessId("simpleProcess").latestVersion().variables(Map.of("test", 1)).withResult().send().join();
    // then
    assertThat(processInstanceResult.getProcessInstanceKey()).isPositive();
    assertThat(processInstanceResult.getBpmnProcessId()).isEqualTo("simpleProcess");
    assertThat(processInstanceResult.getProcessDefinitionKey()).isEqualTo(deployment.getProcesses().get(0).getProcessDefinitionKey());
    assertThat(processInstanceResult.getVersion()).isEqualTo(1);
    assertThat(processInstanceResult.getVariablesAsMap()).containsEntry("test", 1);
}
Also used : ProcessInstanceResult(io.camunda.zeebe.client.api.response.ProcessInstanceResult) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) Test(org.junit.jupiter.api.Test)

Example 20 with DeploymentEvent

use of io.camunda.zeebe.client.api.response.DeploymentEvent in project zeebe-process-test by camunda-cloud.

the class AbstractProcessEventInspectionsTest method testFindLastProcessInstance.

@Test
void testFindLastProcessInstance() throws InterruptedException {
    // given
    final DeploymentEvent deploymentEvent = Utilities.deployResource(getClient(), ProcessPackTimerStartEvent.RESOURCE_NAME);
    // when
    Utilities.increaseTime(getEngine(), Duration.ofDays(1));
    final Optional<InspectedProcessInstance> lastProcessInstance = InspectionUtility.findProcessEvents().triggeredByTimer(ProcessPackTimerStartEvent.TIMER_ID).withProcessDefinitionKey(deploymentEvent.getProcesses().get(0).getProcessDefinitionKey()).findLastProcessInstance();
    // then
    Assertions.assertThat(lastProcessInstance).isNotEmpty();
    BpmnAssert.assertThat(lastProcessInstance.get()).isCompleted();
}
Also used : InspectedProcessInstance(io.camunda.zeebe.process.test.inspections.model.InspectedProcessInstance) DeploymentEvent(io.camunda.zeebe.client.api.response.DeploymentEvent) Test(org.junit.jupiter.api.Test)

Aggregations

DeploymentEvent (io.camunda.zeebe.client.api.response.DeploymentEvent)73 Test (org.junit.Test)26 Test (org.junit.jupiter.api.Test)26 ProcessInstanceEvent (io.camunda.zeebe.client.api.response.ProcessInstanceEvent)12 ClientTest (io.camunda.zeebe.client.util.ClientTest)12 ZeebeClient (io.camunda.zeebe.client.ZeebeClient)11 Process (io.camunda.zeebe.client.api.response.Process)11 ProcessImpl (io.camunda.zeebe.client.impl.response.ProcessImpl)10 InspectedProcessInstance (io.camunda.zeebe.process.test.inspections.model.InspectedProcessInstance)8 BpmnModelInstance (io.camunda.zeebe.model.bpmn.BpmnModelInstance)7 ProcessInstanceResult (io.camunda.zeebe.client.api.response.ProcessInstanceResult)6 RetriableClientFutureImpl (io.camunda.zeebe.client.impl.RetriableClientFutureImpl)5 DeploymentEventImpl (io.camunda.zeebe.client.impl.response.DeploymentEventImpl)5 DeployProcessRequest (io.camunda.zeebe.gateway.protocol.GatewayOuterClass.DeployProcessRequest)5 ZeebeClientBuilder (io.camunda.zeebe.client.ZeebeClientBuilder)3 ActivateJobsResponse (io.camunda.zeebe.client.api.response.ActivateJobsResponse)3 ActivatedJob (io.camunda.zeebe.client.api.response.ActivatedJob)3 Bpmn (io.camunda.zeebe.model.bpmn.Bpmn)3 ZeebeFuture (io.camunda.zeebe.client.api.ZeebeFuture)2 ClientException (io.camunda.zeebe.client.api.command.ClientException)2