use of io.zeebe.broker.workflow.data.WorkflowInstanceEvent.PROP_STATE in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldCreateDeploymentWithMultipleResourcesAndWorkflows.
@Test
public void shouldCreateDeploymentWithMultipleResourcesAndWorkflows() throws IOException {
// given
final WorkflowDefinition singleWorkflow = Bpmn.createExecutableWorkflow("singleProcess").startEvent().done();
final InputStream multipleWorkflowsResource = getClass().getResourceAsStream("/workflows/collaboration.bpmn");
final List<Map<String, Object>> resources = Arrays.asList(deploymentResource(bpmnXml(singleWorkflow), "process1.bpmn"), deploymentResource(StreamUtil.read(multipleWorkflowsResource), "collaboration.bpmn"));
// when
final ExecuteCommandResponse resp = apiRule.createCmdRequest().partitionId(Protocol.SYSTEM_PARTITION).eventType(EventType.DEPLOYMENT_EVENT).command().put(PROP_STATE, "CREATE").put("topicName", ClientApiRule.DEFAULT_TOPIC_NAME).put("resources", resources).done().sendAndAwait();
// then
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "CREATED");
final List<SubscribedEvent> workflowEvents = apiRule.topic().receiveEvents(workflowEvents("CREATED")).limit(3).collect(toList());
assertThat(workflowEvents).extracting(s -> s.event().get(PROP_WORKFLOW_BPMN_PROCESS_ID)).contains("singleProcess", "process1", "process2");
}
use of io.zeebe.broker.workflow.data.WorkflowInstanceEvent.PROP_STATE in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldCreateDeploymentWithMultipleResources.
@Test
public void shouldCreateDeploymentWithMultipleResources() {
// given
final WorkflowDefinition definition1 = Bpmn.createExecutableWorkflow("process1").startEvent().done();
final WorkflowDefinition definition2 = Bpmn.createExecutableWorkflow("process2").startEvent().done();
final List<Map<String, Object>> resources = Arrays.asList(deploymentResource(bpmnXml(definition1), "process1.bpmn"), deploymentResource(bpmnXml(definition2), "process2.bpmn"));
// when
final ExecuteCommandResponse resp = apiRule.createCmdRequest().partitionId(Protocol.SYSTEM_PARTITION).eventType(EventType.DEPLOYMENT_EVENT).command().put(PROP_STATE, "CREATE").put("topicName", ClientApiRule.DEFAULT_TOPIC_NAME).put("resources", resources).done().sendAndAwait();
// then
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "CREATED");
final List<SubscribedEvent> workflowEvents = apiRule.topic().receiveEvents(workflowEvents("CREATED")).limit(2).collect(toList());
assertThat(workflowEvents).extracting(s -> s.event().get(PROP_WORKFLOW_BPMN_PROCESS_ID)).contains("process1", "process2");
}
use of io.zeebe.broker.workflow.data.WorkflowInstanceEvent.PROP_STATE in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldCreateDeploymentResourceWithMultipleWorkflows.
@Test
public void shouldCreateDeploymentResourceWithMultipleWorkflows() throws IOException {
// given
final InputStream resourceAsStream = getClass().getResourceAsStream("/workflows/collaboration.bpmn");
// when
final ExecuteCommandResponse resp = apiRule.topic().deployWithResponse(ClientApiRule.DEFAULT_TOPIC_NAME, StreamUtil.read(resourceAsStream), ResourceType.BPMN_XML.name(), "collaboration.bpmn");
// then
assertThat(resp.getEvent()).containsEntry(PROP_STATE, "CREATED");
final List<SubscribedEvent> workflowEvents = apiRule.topic().receiveEvents(workflowEvents("CREATED")).limit(2).collect(toList());
assertThat(workflowEvents).extracting(s -> s.event().get(PROP_WORKFLOW_BPMN_PROCESS_ID)).contains("process1", "process2");
}
Aggregations