use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testParallelSubProcessHistory.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelSubProcess.bpmn20.xml" })
public void testParallelSubProcessHistory() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("miParallelSubprocess");
// Validate history
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("miSubProcess").list();
assertEquals(2, historicActivityInstances.size());
for (HistoricActivityInstance hai : historicActivityInstances) {
assertNotNull(hai.getStartTime());
// now end time is null
assertNull(hai.getEndTime());
assertNotNull(pi.getId(), hai.getParentActivityInstanceId());
}
}
for (Task task : taskService.createTaskQuery().list()) {
taskService.complete(task.getId());
}
// Validate history
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityId("miSubProcess").list();
assertEquals(2, historicActivityInstances.size());
for (HistoricActivityInstance hai : historicActivityInstances) {
assertNotNull(hai.getStartTime());
assertNotNull(hai.getEndTime());
assertNotNull(pi.getId(), hai.getParentActivityInstanceId());
}
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testSequentialScriptTasksHistory.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testSequentialScriptTasks.bpmn20.xml" })
public void testSequentialScriptTasksHistory() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("sum", 0);
vars.put("nrOfLoops", 7);
runtimeService.startProcessInstanceByKey("miSequentialScriptTask", vars);
// Validate history
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
List<HistoricActivityInstance> historicInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").orderByActivityId().asc().list();
assertEquals(7, historicInstances.size());
for (int i = 0; i < 7; i++) {
HistoricActivityInstance hai = historicInstances.get(i);
assertEquals("scriptTask", hai.getActivityType());
assertNotNull(hai.getStartTime());
assertNotNull(hai.getEndTime());
}
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class MultiInstanceTest method testParallelScriptTasksHistory.
@Deployment(resources = { "org/camunda/bpm/engine/test/bpmn/multiinstance/MultiInstanceTest.testParallelScriptTasks.bpmn20.xml" })
public void testParallelScriptTasksHistory() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("sum", 0);
vars.put("nrOfLoops", 4);
runtimeService.startProcessInstanceByKey("miParallelScriptTask", vars);
if (processEngineConfiguration.getHistoryLevel().getId() > ProcessEngineConfigurationImpl.HISTORYLEVEL_NONE) {
List<HistoricActivityInstance> historicActivityInstances = historyService.createHistoricActivityInstanceQuery().activityType("scriptTask").list();
assertEquals(4, historicActivityInstances.size());
for (HistoricActivityInstance hai : historicActivityInstances) {
assertNotNull(hai.getStartTime());
assertNotNull(hai.getStartTime());
}
}
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testTimerEventSubprocess.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityInstanceTest.startEventTypesForEventSubprocess.bpmn20.xml")
public void testTimerEventSubprocess() {
Map<String, Object> vars = new HashMap<String, Object>();
vars.put("shouldThrowError", false);
runtimeService.startProcessInstanceByKey("process", vars);
Job timerJob = managementService.createJobQuery().singleResult();
managementService.executeJob(timerJob.getId());
HistoricActivityInstance historicActivity = historyService.createHistoricActivityInstanceQuery().activityId("timerStartEvent").singleResult();
assertEquals("startTimerEvent", historicActivity.getActivityType());
}
use of org.camunda.bpm.engine.history.HistoricActivityInstance in project camunda-bpm-platform by camunda.
the class HistoricActivityInstanceTest method testHistoricActivityInstanceForEventsQuery.
@Deployment
public void testHistoricActivityInstanceForEventsQuery() {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("eventProcess");
assertEquals(1, taskService.createTaskQuery().count());
runtimeService.signalEventReceived("signal");
assertProcessEnded(pi.getId());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("noop").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("userTask").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("start").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("end").list().size());
assertEquals(1, historyService.createHistoricActivityInstanceQuery().activityId("boundaryEvent").list().size());
HistoricActivityInstance intermediateEvent = historyService.createHistoricActivityInstanceQuery().activityId("intermediate-event").singleResult();
assertNotNull(intermediateEvent.getStartTime());
assertNotNull(intermediateEvent.getEndTime());
HistoricActivityInstance startEvent = historyService.createHistoricActivityInstanceQuery().activityId("start").singleResult();
assertNotNull(startEvent.getStartTime());
assertNotNull(startEvent.getEndTime());
HistoricActivityInstance endEvent = historyService.createHistoricActivityInstanceQuery().activityId("end").singleResult();
assertNotNull(endEvent.getStartTime());
assertNotNull(endEvent.getEndTime());
}
Aggregations