use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class MultiInstanceTest method testSequentialSubProcessWithTimer.
@Deployment
public void testSequentialSubProcessWithTimer() {
String procId = runtimeService.startProcessInstanceByKey("miSequentialSubprocessWithTimer").getId();
// Complete one subprocess
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(2, tasks.size());
taskService.complete(tasks.get(0).getId());
taskService.complete(tasks.get(1).getId());
tasks = taskService.createTaskQuery().list();
assertEquals(2, tasks.size());
// Fire timer
Job timer = managementService.createJobQuery().singleResult();
managementService.executeJob(timer.getId());
Task taskAfterTimer = taskService.createTaskQuery().singleResult();
assertEquals("taskAfterTimer", taskAfterTimer.getTaskDefinitionKey());
taskService.complete(taskAfterTimer.getId());
assertProcessEnded(procId);
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class MultiInstanceTest method testNestedParallelUserTasks.
@Deployment
public void testNestedParallelUserTasks() {
String procId = runtimeService.startProcessInstanceByKey("miNestedParallelUserTasks").getId();
List<Task> tasks = taskService.createTaskQuery().taskAssignee("kermit").list();
for (Task task : tasks) {
assertEquals("My Task", task.getName());
taskService.complete(task.getId());
}
assertProcessEnded(procId);
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class MultiInstanceTest method checkParallelUserTasksCustomExtensions.
private void checkParallelUserTasksCustomExtensions(String processDefinitionKey) {
Map<String, Object> vars = new HashMap<String, Object>();
List<String> assigneeList = Arrays.asList("kermit", "gonzo", "fozzie");
vars.put("assigneeList", assigneeList);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey, vars);
List<Task> tasks = taskService.createTaskQuery().orderByTaskName().asc().list();
assertEquals(3, tasks.size());
assertEquals("My Task 0", tasks.get(0).getName());
assertEquals("My Task 1", tasks.get(1).getName());
assertEquals("My Task 2", tasks.get(2).getName());
tasks = taskService.createTaskQuery().orderByTaskAssignee().asc().list();
assertEquals("fozzie", tasks.get(0).getAssignee());
assertEquals("gonzo", tasks.get(1).getAssignee());
assertEquals("kermit", tasks.get(2).getAssignee());
// Completing 3 tasks will trigger completioncondition
taskService.complete(tasks.get(0).getId());
taskService.complete(tasks.get(1).getId());
taskService.complete(tasks.get(2).getId());
assertEquals(0, taskService.createTaskQuery().count());
assertProcessEnded(processInstance.getProcessInstanceId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class MultiInstanceTest method testSequentialMultiInstanceCallActivityWithErrorBoundaryEvent.
@Deployment(resources = { "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.callActivityWithBoundaryErrorEventSequential.bpmn20.xml", "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.throwingErrorEventSubProcess.bpmn20.xml" })
public void testSequentialMultiInstanceCallActivityWithErrorBoundaryEvent() {
Map<String, Object> variableMap = new HashMap<String, Object>();
variableMap.put("assignees", Arrays.asList("kermit", "gonzo"));
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process", variableMap);
List<Task> tasks = taskService.createTaskQuery().list();
assertEquals(1, tasks.size());
// finish first call activity with error
variableMap = new HashMap<String, Object>();
variableMap.put("done", false);
taskService.complete(tasks.get(0).getId(), variableMap);
tasks = taskService.createTaskQuery().list();
assertEquals(1, tasks.size());
taskService.complete(tasks.get(0).getId());
List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().processDefinitionKey("process").list();
assertEquals(0, processInstances.size());
assertProcessEnded(processInstance.getId());
}
use of org.activiti.engine.task.Task in project Activiti by Activiti.
the class MultiInstanceTest method testMultiInstanceParalelReceiveTaskWithTimer.
@Deployment
public void testMultiInstanceParalelReceiveTaskWithTimer() {
Date startTime = new Date();
processEngineConfiguration.getClock().setCurrentTime(startTime);
runtimeService.startProcessInstanceByKey("multiInstanceReceiveWithTimer");
List<Execution> executions = runtimeService.createExecutionQuery().activityId("theReceiveTask").list();
assertEquals(3, executions.size());
// Signal only one execution. Then the timer will fire
runtimeService.signal(executions.get(1).getId());
processEngineConfiguration.getClock().setCurrentTime(new Date(startTime.getTime() + 60000L));
waitForJobExecutorToProcessAllJobs(10000L, 1000L);
// The process should now be in the task after the timer
Task task = taskService.createTaskQuery().singleResult();
assertEquals("Task after timer", task.getName());
// Completing it should end the process
taskService.complete(task.getId());
assertEquals(0, runtimeService.createExecutionQuery().count());
}
Aggregations