use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class WorkflowInstanceFunctionalTest method testWorkflowInstanceStatesWithServiceTask.
@Test
public void testWorkflowInstanceStatesWithServiceTask() {
// given
final WorkflowDefinition definition = Bpmn.createExecutableWorkflow("process").startEvent("a").serviceTask("b", t -> t.taskType("foo")).endEvent("c").done();
testClient.deploy(definition);
testClient.createWorkflowInstance("process");
// when
testClient.completeTaskOfType("foo");
// then
final List<SubscribedEvent> workflowEvents = testClient.receiveEvents(workflowInstanceEvents()).limit(11).collect(Collectors.toList());
assertThat(workflowEvents).extracting(e -> e.event().get(PROP_STATE)).containsExactly("CREATE_WORKFLOW_INSTANCE", "WORKFLOW_INSTANCE_CREATED", "START_EVENT_OCCURRED", "SEQUENCE_FLOW_TAKEN", "ACTIVITY_READY", "ACTIVITY_ACTIVATED", "ACTIVITY_COMPLETING", "ACTIVITY_COMPLETED", "SEQUENCE_FLOW_TAKEN", "END_EVENT_OCCURRED", "WORKFLOW_INSTANCE_COMPLETED");
}
use of io.zeebe.model.bpmn.instance.WorkflowDefinition in project zeebe by zeebe-io.
the class ExclusiveGatewayTest method shouldTakeDefaultFlow.
@Test
public void shouldTakeDefaultFlow() {
final WorkflowDefinition workflowDefinition = Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway().sequenceFlow(s -> s.condition("$.foo < 5")).endEvent("a").sequenceFlow(s -> s.defaultFlow()).endEvent("b").done();
workflowClient.deploy(clientRule.getDefaultTopic()).addWorkflowModel(workflowDefinition, "workflow.bpmn").execute();
// when
workflowClient.create(clientRule.getDefaultTopic()).bpmnProcessId("workflow").payload("{\"foo\":7}").execute();
waitUntil(() -> eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_COMPLETED")));
final WorkflowInstanceEvent endEvent = eventRecorder.getSingleWorkflowInstanceEvent(wfInstanceEvent("END_EVENT_OCCURRED"));
assertThat(endEvent.getActivityId()).isEqualTo("b");
}
Aggregations