use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class ImportExportTest method testConvertXMLToModel.
public void testConvertXMLToModel() throws Exception {
BpmnModel bpmnModel = readXMLFile();
bpmnModel = exportAndReadXMLFile(bpmnModel);
byte[] xml = new BpmnXMLConverter().convertToXML(bpmnModel);
org.activiti.engine.repository.Deployment deployment = processEngine.getRepositoryService().createDeployment().name("test1").addString("test1.bpmn20.xml", new String(xml)).deploy();
String processInstanceKey = runtimeService.startProcessInstanceByKey("process").getId();
Execution execution = runtimeService.createExecutionQuery().processInstanceId(processInstanceKey).messageEventSubscriptionName("InterruptMessage").singleResult();
assertNotNull(execution);
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class MultiInstanceTest method testMultiInstanceParallelReceiveTask.
@Deployment
public void testMultiInstanceParallelReceiveTask() {
runtimeService.startProcessInstanceByKey("multi-instance-receive");
List<Execution> executions = runtimeService.createExecutionQuery().activityId("theReceiveTask").list();
assertEquals(4, executions.size());
// Complete all four of the executions
for (Execution execution : executions) {
runtimeService.signal(execution.getId());
}
// There is one task after the task
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
taskService.complete(task.getId());
assertEquals(0, runtimeService.createExecutionQuery().count());
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class MultiInstanceTest method testParallelSubProcessAllAutomatic.
@Deployment
public void testParallelSubProcessAllAutomatic() {
String procId = runtimeService.startProcessInstanceByKey("miParallelSubprocessAllAutomatics", CollectionUtil.singletonMap("nrOfLoops", 5)).getId();
Execution waitState = runtimeService.createExecutionQuery().singleResult();
assertEquals(10, runtimeService.getVariable(waitState.getId(), "sum"));
runtimeService.signal(waitState.getId());
assertProcessEnded(procId);
}
use of org.activiti.engine.runtime.Execution 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());
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class MultiInstanceTest method testParallelUserTasksExecutionAndTaskListeners.
@Deployment
public void testParallelUserTasksExecutionAndTaskListeners() {
runtimeService.startProcessInstanceByKey("miParallelUserTasks");
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
Execution waitState = runtimeService.createExecutionQuery().singleResult();
assertEquals(3, runtimeService.getVariable(waitState.getId(), "taskListenerCounter"));
assertEquals(3, runtimeService.getVariable(waitState.getId(), "executionListenerCounter"));
}
Aggregations