use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionVariablesTest method testTreeCompactionWithLocalVariableOnConcurrentExecution.
@Deployment
public void testTreeCompactionWithLocalVariableOnConcurrentExecution() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
Execution innerTaskExecution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();
Execution subProcessConcurrentExecution = runtimeService.createExecutionQuery().executionId(((ExecutionEntity) innerTaskExecution).getParentId()).singleResult();
Task task = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
// when
runtimeService.setVariableLocal(subProcessConcurrentExecution.getId(), "foo", "bar");
// and completing the concurrent task, thereby pruning the sub process concurrent execution
taskService.complete(task.getId());
// then the variable still exists
VariableInstance variable = runtimeService.createVariableInstanceQuery().singleResult();
assertNotNull(variable);
assertEquals("foo", variable.getName());
assertEquals(processInstance.getId(), variable.getExecutionId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionVariablesTest method testStableVariableInstanceIdsOnCompaction.
@Deployment(resources = "org/camunda/bpm/engine/test/api/variables/ExecutionVariablesTest.testTreeCompactionWithLocalVariableOnConcurrentExecution.bpmn20.xml")
public void testStableVariableInstanceIdsOnCompaction() {
runtimeService.startProcessInstanceByKey("process");
Execution innerTaskExecution = runtimeService.createExecutionQuery().activityId("innerTask").singleResult();
Execution subProcessConcurrentExecution = runtimeService.createExecutionQuery().executionId(((ExecutionEntity) innerTaskExecution).getParentId()).singleResult();
Task task = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
// when
runtimeService.setVariableLocal(subProcessConcurrentExecution.getId(), "foo", "bar");
VariableInstance variableBeforeCompaction = runtimeService.createVariableInstanceQuery().singleResult();
// and completing the concurrent task, thereby pruning the sub process concurrent execution
taskService.complete(task.getId());
// then the variable still exists
VariableInstance variableAfterCompaction = runtimeService.createVariableInstanceQuery().singleResult();
assertEquals(variableBeforeCompaction.getId(), variableAfterCompaction.getId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ExecutionVariablesTest method testTreeCompactionNestedForkParallelGateway.
@Deployment
public void testTreeCompactionNestedForkParallelGateway() {
// given
runtimeService.startProcessInstanceByKey("process");
Task task1 = taskService.createTaskQuery().taskDefinitionKey("task1").singleResult();
Execution task2Execution = runtimeService.createExecutionQuery().activityId("task2").singleResult();
String subProcessScopeExecutionId = ((ExecutionEntity) task2Execution).getParentId();
// when
runtimeService.setVariableLocal(task2Execution.getId(), "foo", "bar");
// and completing the other task, thereby pruning the concurrent execution
taskService.complete(task1.getId());
// then the variable still exists on the subprocess scope execution
VariableInstance variable = runtimeService.createVariableInstanceQuery().singleResult();
assertNotNull(variable);
assertEquals("foo", variable.getName());
assertEquals(subProcessScopeExecutionId, variable.getExecutionId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testActiveExecutionsInParallelTasks.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelUserTasks.bpmn20.xml" })
public void testActiveExecutionsInParallelTasks() {
runtimeService.startProcessInstanceByKey("miParallelUserTasks").getId();
ProcessInstance instance = runtimeService.createProcessInstanceQuery().singleResult();
List<Execution> executions = runtimeService.createExecutionQuery().list();
assertEquals(5, executions.size());
for (Execution execution : executions) {
ExecutionEntity entity = (ExecutionEntity) execution;
if (!entity.getId().equals(instance.getId()) && !entity.getParentId().equals(instance.getId())) {
// child executions
assertTrue(entity.isActive());
} else {
// process instance and scope execution
assertFalse(entity.isActive());
}
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MessageEventSubprocessTest method testNonInterruptingWithUserTaskAndBoundaryEventInsideEmbeddedSubProcess.
@Deployment
public void testNonInterruptingWithUserTaskAndBoundaryEventInsideEmbeddedSubProcess() {
String processInstanceId = runtimeService.startProcessInstanceByKey("process").getId();
// when
runtimeService.correlateMessage("newMessage");
// then
assertEquals(2, taskService.createTaskQuery().count());
Task task1 = taskService.createTaskQuery().taskDefinitionKey("eventSubProcessTask").singleResult();
assertNotNull(task1);
Execution task1Execution = runtimeService.createExecutionQuery().activityId("eventSubProcessTask").singleResult();
assertFalse(processInstanceId.equals(((ExecutionEntity) task1Execution).getParentId()));
Task task2 = taskService.createTaskQuery().taskDefinitionKey("task").singleResult();
assertNotNull(task2);
Execution task2Execution = runtimeService.createExecutionQuery().activityId("eventSubProcessTask").singleResult();
assertFalse(processInstanceId.equals(((ExecutionEntity) task2Execution).getParentId()));
// both have the same parent (but it is not the process instance)
assertTrue(((ExecutionEntity) task1Execution).getParentId().equals(((ExecutionEntity) task2Execution).getParentId()));
assertEquals(1, runtimeService.createEventSubscriptionQuery().count());
taskService.complete(task1.getId());
taskService.complete(task2.getId());
assertProcessEnded(processInstanceId);
}
Aggregations