use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceStateTest method testEndTerminateEventCancel.
@Deployment
public void testEndTerminateEventCancel() {
ProcessInstance processInstance = startProcess();
runtimeService.correlateMessage("continue");
assertProcessEnded(processInstance.getId());
List<HistoricActivityInstance> allInstances = getAllActivityInstances();
assertIsCanceledActivityInstances(allInstances, "userTask", 1);
assertNonCompletingActivityInstance(allInstances, "userTask");
assertNonCanceledActivityInstance(allInstances, "terminateEnd");
assertIsCompletingActivityInstances(allInstances, "terminateEnd", 1);
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceSequenceCounterTest method verifyOrder.
protected void verifyOrder(HistoricActivityInstanceQuery query, String... expectedOrder) {
assertEquals(expectedOrder.length, query.count());
List<HistoricActivityInstance> activityInstances = query.list();
for (int i = 0; i < expectedOrder.length; i++) {
HistoricActivityInstance activityInstance = activityInstances.get(i);
String currentActivityId = activityInstance.getActivityId();
String expectedActivityId = expectedOrder[i];
assertEquals(expectedActivityId, currentActivityId);
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testMultiInstanceReceiveActivity.
@Deployment
public void testMultiInstanceReceiveActivity() {
runtimeService.startProcessInstanceByKey("process");
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
HistoricActivityInstance miBodyInstance = query.activityId("receiveTask#multiInstanceBody").singleResult();
query.activityId("receiveTask");
assertEquals(5, query.count());
List<HistoricActivityInstance> result = query.list();
for (HistoricActivityInstance instance : result) {
assertEquals(miBodyInstance.getId(), instance.getParentActivityInstanceId());
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceQuery.
@Deployment
public void testHistoricActivityInstanceQuery() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("noopProcess");
assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityId("nonExistingActivityId").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("noop").list().size());
assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityType("nonExistingActivityType").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityType("serviceTask").list().size());
assertEquals(0, historyService.createHistoricActivityInstanceQuery().activityName("nonExistingActivityName").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityName("No operation").list().size());
assertEquals(0, historyService.createHistoricActivityInstanceQuery().taskAssignee("nonExistingAssignee").list().size());
assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId("nonExistingExecutionId").list().size());
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
assertEquals(3, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size());
} else {
assertEquals(0, historyService.createHistoricActivityInstanceQuery().executionId(processInstance.getId()).list().size());
}
assertEquals(0, historyService.createHistoricActivityInstanceQuery().processInstanceId("nonExistingProcessInstanceId").list().size());
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
assertEquals(3, historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).list().size());
} else {
assertEquals(0, historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).list().size());
}
assertEquals(0, historyService.createHistoricActivityInstanceQuery().processDefinitionId("nonExistingProcessDefinitionId").list().size());
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
assertEquals(3, historyService.createHistoricActivityInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list().size());
} else {
assertEquals(0, historyService.createHistoricActivityInstanceQuery().processDefinitionId(processInstance.getProcessDefinitionId()).list().size());
}
assertEquals(0, historyService.createHistoricActivityInstanceQuery().unfinished().list().size());
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
assertEquals(3, historyService.createHistoricActivityInstanceQuery().finished().list().size());
} else {
assertEquals(0, historyService.createHistoricActivityInstanceQuery().finished().list().size());
}
if (processEngineConfiguration.getHistoryLevel().getId() >= ProcessEngineConfigurationImpl.HISTORYLEVEL_ACTIVITY) {
HistoricActivityInstance historicActivityInstance = historyService.createHistoricActivityInstanceQuery().list().get(0);
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityInstanceId(historicActivityInstance.getId()).list().size());
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testAssigneeSavedWhenTaskSaved.
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.testHistoricActivityInstanceProperties.bpmn20.xml" })
public void testAssigneeSavedWhenTaskSaved() {
// given
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery().activityId("theTask");
runtimeService.startProcessInstanceByKey("taskAssigneeProcess");
HistoricActivityInstance historicActivityInstance = query.singleResult();
Task task = taskService.createTaskQuery().singleResult();
// assume
assertEquals("kermit", historicActivityInstance.getAssignee());
// when
task.setAssignee("gonzo");
taskService.saveTask(task);
// then
historicActivityInstance = query.singleResult();
assertEquals("gonzo", historicActivityInstance.getAssignee());
}
Aggregations