use of org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project Activiti by Activiti.
the class HistoricVariableInstanceTest method testTwoSubProcessInParallelWithinSubProcess.
@Deployment
public void testTwoSubProcessInParallelWithinSubProcess() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess");
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list();
assertEquals(2, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("myVar", historicVariable.getName());
assertEquals("test101112", historicVariable.getTextValue());
HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1);
assertEquals("myVar1", historicVariable1.getName());
assertEquals("test789", historicVariable1.getTextValue());
assertEquals(18, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(7, historyService.createHistoricDetailQuery().count());
}
}
use of org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project Activiti by Activiti.
the class HistoricVariableInstanceTest method testSimpleNoWaitState.
@Deployment
public void testSimpleNoWaitState() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
assertEquals(1, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("test456", historicVariable.getTextValue());
assertEquals(4, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(2, historyService.createHistoricDetailQuery().count());
}
}
use of org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project Activiti by Activiti.
the class HistoricVariableInstanceTest method testRestrictByExecutionId.
@Deployment
public void testRestrictByExecutionId() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.FULL)) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
TaskQuery taskQuery = taskService.createTaskQuery();
Task userTask = taskQuery.singleResult();
assertEquals("userTask1", userTask.getName());
taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().executionId(processInstance.getId()).list();
assertEquals(1, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("test456", historicVariable.getTextValue());
assertEquals(5, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(3, historyService.createHistoricDetailQuery().count());
}
}
use of org.activiti.engine.impl.persistence.entity.HistoricVariableInstanceEntity in project Activiti by Activiti.
the class HistoricJPAVariableTest method testGetJPAEntityAsHistoricLog.
@Deployment
public void testGetJPAEntityAsHistoricLog() {
setupJPAEntities();
// -----------------------------------------------------------------------------
// Simple test, Start process with JPA entities as variables
// -----------------------------------------------------------------------------
Map<String, Object> variables = new HashMap<String, Object>();
variables.put("simpleEntityFieldAccess", simpleEntityFieldAccess);
// Start the process with the JPA-entities as variables. They will be stored in the DB.
this.processInstanceId = runtimeService.startProcessInstanceByKey("JPAVariableProcess", variables).getId();
// Finish tasks
for (Task task : taskService.createTaskQuery().includeTaskLocalVariables().list()) {
taskService.complete(task.getId());
}
// Get JPAEntity Variable by ProcessInstanceHistoryLogQuery
ProcessInstanceHistoryLog log = historyService.createProcessInstanceHistoryLogQuery(processInstanceId).includeVariables().singleResult();
List<HistoricData> events = log.getHistoricData();
for (HistoricData event : events) {
Object value = ((HistoricVariableInstanceEntity) event).getValue();
assertTrue(value instanceof FieldAccessJPAEntity);
assertEquals(((FieldAccessJPAEntity) value).getValue(), simpleEntityFieldAccess.getValue());
}
}
Aggregations