use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method shouldCreateBpmnProcessByIdAndVersion.
@Test
public void shouldCreateBpmnProcessByIdAndVersion() {
final WorkflowsClient workflowService = clientRule.workflows();
// when
final WorkflowInstanceEvent workflowInstance = workflowService.create(clientRule.getDefaultTopic()).bpmnProcessId("anId").version(1).execute();
// then instance is created of first workflow version
assertThat(workflowInstance.getBpmnProcessId()).isEqualTo("anId");
assertThat(workflowInstance.getVersion()).isEqualTo(1);
assertThat(workflowInstance.getWorkflowInstanceKey()).isGreaterThan(0);
waitUntil(() -> eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_CREATED")));
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method shouldThrowExceptionForCreateBpmnProcessIfBpmnProcessIdAndWorkflowKeyNotSet.
@Test
public void shouldThrowExceptionForCreateBpmnProcessIfBpmnProcessIdAndWorkflowKeyNotSet() {
final WorkflowsClient workflowService = clientRule.workflows();
// expected
exception.expect(ClientCommandRejectedException.class);
exception.expectMessage("Command was rejected by broker (WORKFLOW_INSTANCE_REJECTED)");
// when
workflowService.create(clientRule.getDefaultTopic()).execute();
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method shouldRejectCreateBpmnProcessByIllegalKey.
@Test
public void shouldRejectCreateBpmnProcessByIllegalKey() {
final WorkflowsClient workflowService = clientRule.workflows();
// expected
exception.expect(ClientCommandRejectedException.class);
exception.expectMessage("Failed to create instance of workflow with key '99'");
// when
workflowService.create(clientRule.getDefaultTopic()).workflowKey(99L).execute();
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method shouldCreateBpmnProcessByKey.
@Test
public void shouldCreateBpmnProcessByKey() {
final WorkflowsClient workflowService = clientRule.workflows();
waitUntil(() -> eventRecorder.hasWorkflowEvent(wfEvent("CREATED")));
final long workflowKey = eventRecorder.getSingleWorkflowEvent(wfEvent("CREATED")).getMetadata().getKey();
// when
final WorkflowInstanceEvent workflowInstance = workflowService.create(clientRule.getDefaultTopic()).workflowKey(workflowKey).execute();
// then
assertThat(workflowInstance.getBpmnProcessId()).isEqualTo("anId");
assertThat(workflowInstance.getVersion()).isEqualTo(1);
assertThat(workflowInstance.getWorkflowKey()).isEqualTo(workflowKey);
waitUntil(() -> eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_CREATED")));
}
use of io.zeebe.client.WorkflowsClient in project zeebe by zeebe-io.
the class CreateWorkflowInstanceTest method shouldThrowExceptionForIllegalVersion.
@Test
@Ignore("https://github.com/zeebe-io/zeebe/issues/369")
public void shouldThrowExceptionForIllegalVersion() {
final WorkflowsClient workflowService = clientRule.workflows();
// expected
exception.expect(RuntimeException.class);
exception.expectMessage("version must be greater than or equal to -1");
// when
workflowService.create(clientRule.getDefaultTopic()).bpmnProcessId("anId").version(-10).execute();
}
Aggregations