use of io.camunda.zeebe.process.test.assertions.ProcessInstanceAssert in project micronaut-zeebe-client by camunda-community-hub.
the class ProcessTest method workerShouldProcessWork.
@Test
void workerShouldProcessWork() {
// Deploy process model
DeploymentEvent deploymentEvent = client.newDeployCommand().addResourceFromClasspath("bpmn/say_hello.bpmn").send().join();
BpmnAssert.assertThat(deploymentEvent);
// Start process instance
ProcessInstanceEvent event = client.newCreateInstanceCommand().bpmnProcessId("Process_SayHello").latestVersion().send().join();
engine.waitForIdleState();
// Verify that process has started
ProcessInstanceAssert processInstanceAssertions = BpmnAssert.assertThat(event);
processInstanceAssertions.hasPassedElement("start");
processInstanceAssertions.isWaitingAtElement("say_hello");
// Fetch job: say-hello
ActivateJobsResponse response = client.newActivateJobsCommand().jobType("say-hello").maxJobsToActivate(1).send().join();
// Complete job: say-hello
ActivatedJob activatedJob = response.getJobs().get(0);
client.newCompleteCommand(activatedJob.getKey()).send().join();
engine.waitForIdleState();
// Fetch job: say-goodbye
response = client.newActivateJobsCommand().jobType("say-goodbye").maxJobsToActivate(1).send().join();
// Complete job: say-goodbye
activatedJob = response.getJobs().get(0);
client.newCompleteCommand(activatedJob.getKey()).send().join();
engine.waitForIdleState();
// Verify completed
engine.waitForIdleState();
processInstanceAssertions.isCompleted();
}
Aggregations