Search in sources :

Example 1 with MsgPackUtil.asMsgPack

use of io.zeebe.test.util.MsgPackUtil.asMsgPack in project zeebe by zeebe-io.

the class WorkflowInstanceFunctionalTest method testWorkflowInstanceStatesWithExclusiveGateway.

@Test
public void testWorkflowInstanceStatesWithExclusiveGateway() {
    // given
    final WorkflowDefinition workflowDefinition = Bpmn.createExecutableWorkflow("workflow").startEvent().exclusiveGateway("xor").sequenceFlow("s1", s -> s.condition("$.foo < 5")).endEvent("a").sequenceFlow("s2", s -> s.defaultFlow()).endEvent("b").done();
    testClient.deploy(workflowDefinition);
    // when
    testClient.createWorkflowInstance("workflow", MsgPackUtil.asMsgPack("foo", 4));
    // then
    final List<SubscribedEvent> workflowEvents = testClient.receiveEvents(workflowInstanceEvents()).limit(8).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", "GATEWAY_ACTIVATED", "SEQUENCE_FLOW_TAKEN", "END_EVENT_OCCURRED", "WORKFLOW_INSTANCE_COMPLETED");
}
Also used : java.util(java.util) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) EmbeddedBrokerRule(io.zeebe.broker.test.EmbeddedBrokerRule) Bpmn(io.zeebe.model.bpmn.Bpmn) Protocol(io.zeebe.protocol.Protocol) MsgPackUtil.asMsgPack(io.zeebe.test.util.MsgPackUtil.asMsgPack) Collectors(java.util.stream.Collectors) File(java.io.File) TestTopicClient.taskEvents(io.zeebe.test.broker.protocol.clientapi.TestTopicClient.taskEvents) RuleChain(org.junit.rules.RuleChain) MsgPackUtil(io.zeebe.test.util.MsgPackUtil) ResourceType(io.zeebe.broker.workflow.data.ResourceType) io.zeebe.test.broker.protocol.clientapi(io.zeebe.test.broker.protocol.clientapi) EventType(io.zeebe.protocol.clientapi.EventType) WorkflowInstanceEvent(io.zeebe.broker.workflow.data.WorkflowInstanceEvent) Files(org.assertj.core.util.Files) org.junit(org.junit) WorkflowDefinition(io.zeebe.model.bpmn.instance.WorkflowDefinition) TestTopicClient.workflowInstanceEvents(io.zeebe.test.broker.protocol.clientapi.TestTopicClient.workflowInstanceEvents) WorkflowDefinition(io.zeebe.model.bpmn.instance.WorkflowDefinition)

Aggregations

EmbeddedBrokerRule (io.zeebe.broker.test.EmbeddedBrokerRule)1 ResourceType (io.zeebe.broker.workflow.data.ResourceType)1 WorkflowInstanceEvent (io.zeebe.broker.workflow.data.WorkflowInstanceEvent)1 Bpmn (io.zeebe.model.bpmn.Bpmn)1 WorkflowDefinition (io.zeebe.model.bpmn.instance.WorkflowDefinition)1 Protocol (io.zeebe.protocol.Protocol)1 EventType (io.zeebe.protocol.clientapi.EventType)1 io.zeebe.test.broker.protocol.clientapi (io.zeebe.test.broker.protocol.clientapi)1 TestTopicClient.taskEvents (io.zeebe.test.broker.protocol.clientapi.TestTopicClient.taskEvents)1 TestTopicClient.workflowInstanceEvents (io.zeebe.test.broker.protocol.clientapi.TestTopicClient.workflowInstanceEvents)1 MsgPackUtil (io.zeebe.test.util.MsgPackUtil)1 MsgPackUtil.asMsgPack (io.zeebe.test.util.MsgPackUtil.asMsgPack)1 File (java.io.File)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 java.util (java.util)1 Collectors (java.util.stream.Collectors)1 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)1 Files (org.assertj.core.util.Files)1 org.junit (org.junit)1 RuleChain (org.junit.rules.RuleChain)1