use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class ConnectProcessEnginePluginTest method testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent.
@Deployment(resources = "org/camunda/connect/plugin/ConnectProcessEnginePluginTest.testConnectorWithThrownExceptionInScriptResourceInputOutputMapping.bpmn")
public void testConnectorBpmnErrorThrownInScriptResourceOutputMappingIsHandledByBoundaryEvent() {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("throwInMapping", "out");
variables.put("exception", new BpmnError("error"));
runtimeService.startProcessInstanceByKey("testProcess", variables);
// we will only reach the user task if the BPMNError from the script was handled by the boundary event
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testMultiInstanceEventsAfterExternalTrigger.
@Test
@Deployment
public void testMultiInstanceEventsAfterExternalTrigger() {
runtimeService.startProcessInstanceByKey("process");
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(3, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
// 6: three user task instances (complete + end)
// 1: one mi body instance (end)
// 1: one sequence flow instance (take)
// 2: one end event instance (start + end)
// = 5
Set<BusinessProcessEvent> eventsReceived = listenerBean.getEventsReceived();
assertThat(eventsReceived.size(), is(10));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testMultiInstanceEvents.
@Test
@Deployment
public void testMultiInstanceEvents() {
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
assertThat(listenerBean.getEventsReceived().size(), is(0));
runtimeService.startProcessInstanceByKey("process1");
waitForJobExecutorToProcessAllJobs(TimeUnit.SECONDS.toMillis(5L), 500L);
Task task = taskService.createTaskQuery().singleResult();
assertThat(task.getName(), is("User Task"));
// 2: start event (start + end)
// 1: transition to first mi activity
// 2: first mi body (start + end)
// 4: two instances of the inner activity (start + end)
// 1: transition to second mi activity
// 2: second mi body (start + end)
// 4: two instances of the inner activity (start + end)
// 1: transition to the user task
// 2: user task (start + task create event)
// = 19
assertThat(listenerBean.getEventsReceived().size(), is(19));
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class EventNotificationTest method testReceiveAll.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/cdi/test/impl/event/EventNotificationTest.process1.bpmn20.xml" })
public void testReceiveAll() {
TestEventListener listenerBean = getBeanInstance(TestEventListener.class);
listenerBean.reset();
// assert that the bean has received 0 events
assertEquals(0, listenerBean.getEventsReceived().size());
runtimeService.startProcessInstanceByKey("process1");
// complete user task
Task task = taskService.createTaskQuery().singleResult();
taskService.complete(task.getId());
assertEquals(16, listenerBean.getEventsReceived().size());
}
use of org.camunda.bpm.engine.task.Task in project camunda-bpm-platform by camunda.
the class TaskRestServiceInteractionTest method testPostCreateTaskDelegationStateResolved.
@Test
public void testPostCreateTaskDelegationStateResolved() {
Map<String, Object> json = new HashMap<String, Object>();
json.put("delegationState", "RESOLVED");
Task newTask = mock(Task.class);
when(taskServiceMock.newTask(anyString())).thenReturn(newTask);
given().body(json).contentType(ContentType.JSON).header("accept", MediaType.APPLICATION_JSON).expect().statusCode(Status.NO_CONTENT.getStatusCode()).when().post(TASK_CREATE_URL);
verify(taskServiceMock).newTask(null);
verify(newTask).setDelegationState(DelegationState.valueOf((String) json.get("delegationState")));
verify(taskServiceMock).saveTask(newTask);
}
Aggregations