use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class ProcessInstanceMigrationTest method testSetProcessDefinitionVersionActivityMissing.
@Deployment(resources = { TEST_PROCESS })
public void testSetProcessDefinitionVersionActivityMissing() {
// start process instance
ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask");
// check that receive task has been reached
Execution execution = runtimeService.createExecutionQuery().activityId("waitState1").singleResult();
assertNotNull(execution);
// deploy new version of the process definition
org.activiti.engine.repository.Deployment deployment = repositoryService.createDeployment().addClasspathResource(TEST_PROCESS_ACTIVITY_MISSING).deploy();
assertEquals(2, repositoryService.createProcessDefinitionQuery().count());
// migrate process instance to new process definition version
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
SetProcessDefinitionVersionCmd setProcessDefinitionVersionCmd = new SetProcessDefinitionVersionCmd(pi.getId(), 2);
try {
commandExecutor.execute(setProcessDefinitionVersionCmd);
fail("ActivitiException expected");
} catch (ActivitiException ae) {
assertTextPresent("The new process definition (key = 'receiveTask') does not contain the current activity (id = 'waitState1') of the process instance (id = '", ae.getMessage());
}
// undeploy "manually" deployed process definition
repositoryService.deleteDeployment(deployment.getId(), true);
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class TransactionSubProcessTest method testMultiInstanceTxSuccessful.
@Deployment(resources = { "org/activiti/engine/test/bpmn/subprocess/transaction/TransactionSubProcessTest.testMultiInstanceTx.bpmn20.xml" })
public void testMultiInstanceTxSuccessful() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("transactionProcess");
// there are now 5 instances of the transaction:
List<EventSubscriptionEntity> EventSubscriptionEntitys = createEventSubscriptionQuery().eventType("compensate").list();
// there are 10 compensation event subscriptions
assertEquals(10, EventSubscriptionEntitys.size());
// the event subscriptions are all under the same execution (the execution of the multi-instance wrapper)
String executionId = EventSubscriptionEntitys.get(0).getExecutionId();
for (EventSubscriptionEntity EventSubscriptionEntity : EventSubscriptionEntitys) {
if (!executionId.equals(EventSubscriptionEntity.getExecutionId())) {
fail("subscriptions not under same execution");
}
}
// first complete the inner user-tasks
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.setVariable(task.getId(), "confirmed", true);
taskService.complete(task.getId());
}
// now complete the inner receive tasks
List<Execution> executions = runtimeService.createExecutionQuery().activityId("receive").list();
for (Execution execution : executions) {
runtimeService.signal(execution.getId());
}
runtimeService.signal(runtimeService.createExecutionQuery().activityId("afterSuccess").singleResult().getId());
assertEquals(0, createEventSubscriptionQuery().count());
assertProcessEnded(processInstance.getId());
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class MultiInstanceTest method testParallelSubProcessAllAutomaticCompletionCondition.
@Deployment(resources = { "org/activiti/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelSubProcessAllAutomatic.bpmn20.xml" })
public void testParallelSubProcessAllAutomaticCompletionCondition() {
String procId = runtimeService.startProcessInstanceByKey("miParallelSubprocessAllAutomatics", CollectionUtil.singletonMap("nrOfLoops", 10)).getId();
Execution waitState = runtimeService.createExecutionQuery().singleResult();
assertEquals(12, 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 testParallelScriptTasksCompletionCondition.
@Deployment
public void testParallelScriptTasksCompletionCondition() {
runtimeService.startProcessInstanceByKey("miParallelScriptTaskCompletionCondition");
Execution waitStateExecution = runtimeService.createExecutionQuery().singleResult();
int sum = (Integer) runtimeService.getVariable(waitStateExecution.getId(), "sum");
assertEquals(2, sum);
}
use of org.activiti.engine.runtime.Execution in project Activiti by Activiti.
the class MultiInstanceTest method testSequentialScriptTasksCompletionCondition.
@Deployment
public void testSequentialScriptTasksCompletionCondition() {
runtimeService.startProcessInstanceByKey("miSequentialScriptTaskCompletionCondition").getId();
Execution waitStateExecution = runtimeService.createExecutionQuery().singleResult();
int sum = (Integer) runtimeService.getVariable(waitStateExecution.getId(), "sum");
assertEquals(5, sum);
}
Aggregations