use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.
the class IncidentTest method shouldDeleteIncidentWhenWorkflowInstanceIsCanceled.
@Test
public void shouldDeleteIncidentWhenWorkflowInstanceIsCanceled() {
// given
clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
final WorkflowInstanceEvent workflowInstance = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").execute();
waitUntil(() -> eventRecorder.hasIncidentEvent(incidentEvent("CREATED")));
// when
clientRule.workflows().cancel(workflowInstance).execute();
// then
waitUntil(() -> eventRecorder.hasIncidentEvent(incidentEvent("DELETED")));
}
use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.
the class IncidentTest method shouldCreateAndResolveInputMappingIncident.
@Test
public void shouldCreateAndResolveInputMappingIncident() {
// given
clientRule.workflows().deploy(clientRule.getDefaultTopic()).addWorkflowModel(WORKFLOW, "workflow.bpmn").execute();
clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").execute();
waitUntil(() -> eventRecorder.hasIncidentEvent(incidentEvent("CREATED")));
final WorkflowInstanceEvent activityInstanceEvent = eventRecorder.getSingleWorkflowInstanceEvent(w -> "ACTIVITY_READY".equals(w.getState()));
// when
clientRule.workflows().updatePayload(activityInstanceEvent).payload(PAYLOAD).execute();
// then
waitUntil(() -> eventRecorder.hasTaskEvent(taskEvent("CREATED")));
waitUntil(() -> eventRecorder.hasIncidentEvent(incidentEvent("RESOLVED")));
}
use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.
the class CancelWorkflowInstanceTest method shouldFailToLockTaskAfterCancel.
@Test
public void shouldFailToLockTaskAfterCancel() {
// given
final WorkflowInstanceEvent workflowInstance = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").execute();
waitUntil(() -> eventRecorder.hasTaskEvent(taskEvent("CREATED")));
clientRule.workflows().cancel(workflowInstance).execute();
final PollableTaskSubscription taskSubscription = clientRule.tasks().newPollableTaskSubscription(clientRule.getDefaultTopic()).taskType("test").lockOwner("owner").lockTime(Duration.ofMinutes(1)).open();
// when
final int completedTasks = taskSubscription.poll((c, t) -> c.complete(t).withoutPayload().execute());
// then
assertThat(completedTasks).isEqualTo(0);
waitUntil(() -> eventRecorder.hasTaskEvent(taskEvent("LOCK_REJECTED")));
assertThat(eventRecorder.hasTaskEvent(taskEvent("CANCELED")));
assertThat(eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_CANCELED")));
}
use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.
the class CancelWorkflowInstanceTest method shouldCancelWorkflowInstance.
@Test
public void shouldCancelWorkflowInstance() {
// given
final WorkflowInstanceEvent workflowInstance = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").execute();
// when
clientRule.workflows().cancel(workflowInstance).execute();
// then
waitUntil(() -> eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_CANCELED")));
}
use of io.zeebe.client.event.WorkflowInstanceEvent in project zeebe by zeebe-io.
the class CancelWorkflowInstanceTest method shouldFailToCompleteTaskAfterCancel.
@Test
public void shouldFailToCompleteTaskAfterCancel() {
// given
final WorkflowInstanceEvent workflowInstance = clientRule.workflows().create(clientRule.getDefaultTopic()).bpmnProcessId("process").execute();
final PollableTaskSubscription taskSubscription = clientRule.tasks().newPollableTaskSubscription(clientRule.getDefaultTopic()).taskType("test").lockOwner("owner").lockTime(Duration.ofMinutes(1)).open();
waitUntil(() -> eventRecorder.hasTaskEvent(taskEvent("LOCKED")));
clientRule.workflows().cancel(workflowInstance).execute();
// when
taskSubscription.poll((c, t) -> c.complete(t).withoutPayload().execute());
// then
waitUntil(() -> eventRecorder.hasTaskEvent(taskEvent("COMPLETE_REJECTED")));
assertThat(eventRecorder.hasTaskEvent(taskEvent("CANCELED")));
assertThat(eventRecorder.hasWorkflowInstanceEvent(wfInstanceEvent("WORKFLOW_INSTANCE_CANCELED")));
}
Aggregations