use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceScopeTest method testSetVariableOnServiceTaskInsideParallelBranch.
@Deployment
public void testSetVariableOnServiceTaskInsideParallelBranch() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
assertEquals(1, query.count());
HistoricVariableInstance variable = query.singleResult();
// the variable is in the process instance scope
assertEquals(pi.getId(), variable.getActivityInstanceId());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceScopeTest method testSetVariableLocalOnUserTask.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testSetVariableLocalOnUserTask() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("oneTaskProcess");
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
taskService.setVariableLocal(task.getId(), "testVar", "testValue");
ExecutionEntity taskExecution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
assertNotNull(taskExecution);
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
assertEquals(1, query.count());
HistoricVariableInstance variable = query.singleResult();
assertNotNull(variable);
// the variable is in the task scope
assertEquals(taskExecution.getActivityInstanceId(), variable.getActivityInstanceId());
taskService.complete(task.getId());
assertProcessEnded(pi.getId());
}
use of org.camunda.bpm.engine.history.HistoricVariableInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricVariableInstanceScopeTest method testSetVariableLocalOnTaskInsideParallelBranch.
@Deployment
public void testSetVariableLocalOnTaskInsideParallelBranch() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("process");
Task task = taskService.createTaskQuery().singleResult();
assertNotNull(task);
taskService.setVariableLocal(task.getId(), "testVar", "testValue");
ExecutionEntity taskExecution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(task.getExecutionId()).singleResult();
assertNotNull(taskExecution);
HistoricVariableInstanceQuery query = historyService.createHistoricVariableInstanceQuery();
assertEquals(1, query.count());
HistoricVariableInstance variable = query.singleResult();
// the variable is in the user task scope
assertEquals(taskExecution.getActivityInstanceId(), variable.getActivityInstanceId());
taskService.complete(task.getId());
assertProcessEnded(pi.getId());
}
Aggregations