use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class SubProcessTest method testTwoSubProcessInParallelWithinSubProcess.
@Deployment
public void testTwoSubProcessInParallelWithinSubProcess() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess");
TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(pi.getId()).orderByTaskName().asc();
List<Task> tasks = taskQuery.list();
// After process start, both tasks in the subprocesses should be active
Task taskA = tasks.get(0);
Task taskB = tasks.get(1);
assertEquals("Task in subprocess A", taskA.getName());
assertEquals("Task in subprocess B", taskB.getName());
// Completing both tasks should active the tasks outside the subprocesses
taskService.complete(taskA.getId());
taskService.complete(taskB.getId());
Task taskAfterSubProcess = taskQuery.singleResult();
assertEquals("Task after subprocess", taskAfterSubProcess.getName());
// Completing this task should end the process
taskService.complete(taskAfterSubProcess.getId());
assertProcessEnded(pi.getId());
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class SubProcessTest method testNestedSubProcessesWithoutEndEvents.
/**
* @see <a href="https://activiti.atlassian.net/browse/ACT-1072">https://activiti.atlassian.net/browse/ACT-1072</a>
*/
@Deployment
public void testNestedSubProcessesWithoutEndEvents() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("testNestedSubProcessesWithoutEndEvents");
assertProcessEnded(pi.getId());
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class SubProcessTest method testNestedSimpleSubprocessWithTimerOnInnerSubProcess.
@Deployment
public void testNestedSimpleSubprocessWithTimerOnInnerSubProcess() {
Date startTime = new Date();
// After staring the process, the task in the subprocess should be active
ProcessInstance pi = runtimeService.startProcessInstanceByKey("nestedSubProcessWithTimer");
Task subProcessTask = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Task in subprocess", subProcessTask.getName());
// Setting the clock forward 1 hour 1 second (timer fires in 1 hour) and fire up the job executor
processEngineConfiguration.getClock().setCurrentTime(new Date(startTime.getTime() + (60 * 60 * 1000) + 1000));
waitForJobExecutorToProcessAllJobs(5000L, 50L);
// The inner subprocess should be destoyed, and the escalated task should be active
Task escalationTask = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Escalated task", escalationTask.getName());
// Completing the escalated task, destroys the outer scope and activates the task after the subprocess
taskService.complete(escalationTask.getId());
Task taskAfterSubProcess = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
assertEquals("Task after subprocesses", taskAfterSubProcess.getName());
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class MultiInstanceTest method testNestedParallelCallActivityCompletionCondition.
@Deployment(resources = { "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testNestedParallelCallActivityCompletionCondition.bpmn20.xml", "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.externalSubProcess.bpmn20.xml" })
public void testNestedParallelCallActivityCompletionCondition() {
String procId = runtimeService.startProcessInstanceByKey("miNestedParallelCallActivityCompletionCondition").getId();
assertEquals(8, taskService.createTaskQuery().count());
for (int i = 0; i < 2; i++) {
ProcessInstance nextSubProcessInstance = runtimeService.createProcessInstanceQuery().processDefinitionKey("externalSubProcess").listPage(0, 1).get(0);
List<Task> tasks = taskService.createTaskQuery().processInstanceId(nextSubProcessInstance.getId()).list();
assertEquals(2, tasks.size());
for (Task task : tasks) {
taskService.complete(task.getId());
}
}
assertProcessEnded(procId);
}
use of org.activiti.engine.runtime.ProcessInstance in project Activiti by Activiti.
the class MultiInstanceTest method testZeroLoopCardinalityOnParallelUserTask.
@Deployment
public void testZeroLoopCardinalityOnParallelUserTask() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.AUDIT)) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("parallelUserTaskMi");
assertEquals(1L, historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).finished().count());
}
}
Aggregations