super.tearDown();
}
public void testQuery() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables()
.variableValueEquals("anothertest", 123).singleResult();
Map<String, Object> variableMap = processInstance.getProcessVariables();
assertEquals(1, variableMap.size());
assertEquals(123, variableMap.get("anothertest"));
List<HistoricProcessInstance> instanceList = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().list();
assertEquals(5, instanceList.size());
instanceList = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().processDefinitionKey(PROCESS_DEFINITION_KEY).list();
assertEquals(4, instanceList.size());
processInstance = instanceList.get(0);
variableMap = processInstance.getProcessVariables();
assertEquals(2, variableMap.size());
assertEquals("test", variableMap.get("test"));
assertEquals("test2", variableMap.get("test2"));
processInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables()
.processDefinitionKey(PROCESS_DEFINITION_KEY_2).singleResult();
variableMap = processInstance.getProcessVariables();
assertEquals(1, variableMap.size());
assertEquals(123, variableMap.get("anothertest"));
processInstance = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().finished().singleResult();
variableMap = processInstance.getProcessVariables();
assertEquals(2, variableMap.size());
assertEquals("test", variableMap.get("test"));
assertEquals("test2", variableMap.get("test2"));
instanceList = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().listPage(0, 50);
assertEquals(5, instanceList.size());
assertEquals(5, historyService.createHistoricProcessInstanceQuery().includeProcessVariables().count());
instanceList = historyService.createHistoricProcessInstanceQuery()
.variableValueEquals("test", "test")
.includeProcessVariables()
.listPage(0, 50);
assertEquals(4, instanceList.size());
assertEquals(4, historyService.createHistoricProcessInstanceQuery().variableValueEquals("test", "test").includeProcessVariables().count());
instanceList = historyService.createHistoricProcessInstanceQuery().includeProcessVariables().listPage(0, 50);
assertEquals(5, instanceList.size());
assertEquals(5, historyService.createHistoricProcessInstanceQuery().includeProcessVariables().count());
instanceList = historyService.createHistoricProcessInstanceQuery()
.variableValueEquals("test", "test")
.includeProcessVariables()
.listPage(0, 1);
assertEquals(1, instanceList.size());
processInstance = instanceList.get(0);
variableMap = processInstance.getProcessVariables();
assertEquals(2, variableMap.size());
assertEquals("test", variableMap.get("test"));
assertEquals("test2", variableMap.get("test2"));
assertEquals(4, historyService.createHistoricProcessInstanceQuery().variableValueEquals("test", "test").includeProcessVariables().count());
instanceList = historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.listPage(1, 2);
assertEquals(2, instanceList.size());
processInstance = instanceList.get(0);
variableMap = processInstance.getProcessVariables();
assertEquals(2, variableMap.size());
assertEquals("test", variableMap.get("test"));
assertEquals("test2", variableMap.get("test2"));
instanceList = historyService.createHistoricProcessInstanceQuery()
.includeProcessVariables()
.processDefinitionKey(PROCESS_DEFINITION_KEY)
.listPage(3, 4);
assertEquals(1, instanceList.size());
processInstance = instanceList.get(0);
variableMap = processInstance.getProcessVariables();
assertEquals(2, variableMap.size());
assertEquals("test", variableMap.get("test"));
assertEquals("test2", variableMap.get("test2"));
instanceList = historyService.createHistoricProcessInstanceQuery()