use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class PlaybackRunTest method checkStatus.
private void checkStatus(ProcessEngine processEngine) {
HistoryService historyService = processEngine.getHistoryService();
final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().includeProcessVariables().singleResult();
assertNotNull(historicProcessInstance);
RepositoryService repositoryService = processEngine.getRepositoryService();
final ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(historicProcessInstance.getProcessDefinitionId()).singleResult();
assertEquals(SIMPLEST_PROCESS, processDefinition.getKey());
assertEquals(1, historicProcessInstance.getProcessVariables().size());
assertEquals(TEST_VALUE, historicProcessInstance.getProcessVariables().get(TEST_VARIABLE));
assertEquals(BUSINESS_KEY, historicProcessInstance.getBusinessKey());
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class SimpleSimulationRunTest method checkStatus.
private void checkStatus(HistoryService historyService) {
final HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().finished().singleResult();
assertNotNull(historicProcessInstance);
assertEquals("oneTaskProcessBusinessKey", historicProcessInstance.getBusinessKey());
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("userTask").singleResult();
assertEquals("user1", historicTaskInstance.getAssignee());
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class FullHistoryTest method testQueryHistoricProcessInstanceIncludeBinaryVariable.
/**
* Test confirming fix for ACT-1731
*/
@Deployment(resources = { "org/activiti/engine/test/history/oneTaskProcess.bpmn20.xml" })
public void testQueryHistoricProcessInstanceIncludeBinaryVariable() throws Exception {
// Start process with a binary variable
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess", Collections.singletonMap("binaryVariable", (Object) "It is I, le binary".getBytes()));
Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(task);
// Complete task to end process
taskService.complete(task.getId());
// Query task, including processVariables
HistoricProcessInstance historicProcess = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).includeProcessVariables().singleResult();
assertNotNull(historicProcess);
assertNotNull(historicProcess.getProcessVariables());
byte[] bytes = (byte[]) historicProcess.getProcessVariables().get("binaryVariable");
assertEquals("It is I, le binary", new String(bytes));
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class HistoricProcessInstanceQueryEscapeClauseTest method testQueryByProcessInstanceNameLike.
@Test
public void testQueryByProcessInstanceNameLike() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
// processInstanceNameLike
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceNameLike("%\\%%").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance1.getId(), historicProcessInstance.getId());
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceNameLike("%\\_%").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance2.getId(), historicProcessInstance.getId());
// orQuery
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceNameLike("%\\%%").processDefinitionId("undefined").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance1.getId(), historicProcessInstance.getId());
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceNameLike("%\\_%").processDefinitionId("undefined").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance2.getId(), historicProcessInstance.getId());
}
}
use of org.activiti.engine.history.HistoricProcessInstance in project Activiti by Activiti.
the class HistoricProcessInstanceQueryEscapeClauseTest method testQueryByTenantIdLike.
@Test
public void testQueryByTenantIdLike() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
// tenantIdLike
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceTenantIdLike("%\\%%").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance1.getId(), historicProcessInstance.getId());
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceTenantIdLike("%\\_%").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance2.getId(), historicProcessInstance.getId());
// orQuery
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceTenantIdLike("%\\%%").processDefinitionId("undefined").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance1.getId(), historicProcessInstance.getId());
historicProcessInstance = historyService.createHistoricProcessInstanceQuery().or().processInstanceTenantIdLike("%\\_%").processDefinitionId("undefined").singleResult();
assertNotNull(historicProcessInstance);
assertEquals(processInstance2.getId(), historicProcessInstance.getId());
}
}
Aggregations