use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldDeployYamlWorkflow.
@Test
public void shouldDeployYamlWorkflow() {
// given
final WorkflowsClient workflowService = clientRule.workflows();
// when
final DeploymentEvent result = workflowService.deploy(clientRule.getDefaultTopic()).addResourceFromClasspath("workflows/simple-workflow.yaml").execute();
// then
assertThat(result.getMetadata().getKey()).isGreaterThan(0);
assertThat(result.getResources()).hasSize(1);
final DeploymentResource deployedResource = result.getResources().get(0);
assertThat(deployedResource.getResourceType()).isEqualTo(ResourceType.YAML_WORKFLOW);
assertThat(deployedResource.getResourceName()).isEqualTo("workflows/simple-workflow.yaml");
assertThat(result.getDeployedWorkflows()).hasSize(1);
final WorkflowDefinition deployedWorkflow = result.getDeployedWorkflows().get(0);
assertThat(deployedWorkflow.getBpmnProcessId()).isEqualTo("yaml-workflow");
assertThat(deployedWorkflow.getVersion()).isEqualTo(1);
waitUntil(() -> eventRecorder.hasWorkflowEvent(wfEvent("CREATED")));
final InputStream yamlStream = getClass().getResourceAsStream("/workflows/simple-workflow.yaml");
final io.zeebe.model.bpmn.instance.WorkflowDefinition workflowDefinition = Bpmn.readFromYamlStream(yamlStream);
final String bpmnXml = Bpmn.convertToString(workflowDefinition);
final WorkflowEvent workflowEvent = eventRecorder.getSingleWorkflowEvent(wfEvent("CREATED"));
assertThat(workflowEvent.getBpmnProcessId()).isEqualTo("yaml-workflow");
assertThat(workflowEvent.getVersion()).isEqualTo(1);
assertThat(workflowEvent.getDeploymentKey()).isEqualTo(result.getMetadata().getKey());
assertThat(workflowEvent.getBpmnXml()).isEqualTo(bpmnXml);
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldNotDeployUnparsableModel.
@Test
public void shouldNotDeployUnparsableModel() {
// given
final WorkflowsClient workflowService = clientRule.workflows();
// then
exception.expect(ClientCommandRejectedException.class);
exception.expectMessage(containsString("Failed to deploy resource 'invalid.bpmn'"));
// when
workflowService.deploy(clientRule.getDefaultTopic()).addResourceStringUtf8("Foooo", "invalid.bpmn").execute();
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldNotDeployIfNoResourceIsAdded.
@Test
public void shouldNotDeployIfNoResourceIsAdded() {
// given
final WorkflowsClient workflowService = clientRule.workflows();
// then
exception.expect(ClientCommandRejectedException.class);
exception.expectMessage(containsString("Deployment doesn't contain a resource to deploy."));
// when
workflowService.deploy(clientRule.getDefaultTopic()).execute();
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateDeploymentTest method shouldNotDeployNonExecutableModel.
@Test
public void shouldNotDeployNonExecutableModel() {
// given
final WorkflowsClient workflowService = clientRule.workflows();
final io.zeebe.model.bpmn.instance.WorkflowDefinition workflowDefinition = Bpmn.createExecutableWorkflow("not-executable").startEvent().endEvent().done();
final ProcessImpl workflowImpl = (ProcessImpl) workflowDefinition.getWorkflows().iterator().next();
workflowImpl.setExecutable(false);
// then
exception.expect(ClientCommandRejectedException.class);
exception.expectMessage(containsString("BPMN model must contain at least one executable process"));
// when
workflowService.deploy(clientRule.getDefaultTopic()).addWorkflowModel(workflowDefinition, "workflow.bpmn").execute();
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method deployProcess.
@Before
public void deployProcess() {
final WorkflowsClient workflowService = clientRule.workflows();
workflowService.deploy(clientRule.getDefaultTopic()).addWorkflowModel(Bpmn.createExecutableWorkflow("anId").startEvent().endEvent().done(), "workflow.bpmn").execute();
workflowService.deploy(clientRule.getDefaultTopic()).addWorkflowModel(Bpmn.createExecutableWorkflow("anId").startEvent().endEvent().done(), "workflow.bpmn").execute();
}
Aggregations