use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsQueryTest method testMultipleRunningTasks.
@Deployment
public void testMultipleRunningTasks() {
String processDefinitionId = getProcessDefinitionId();
startProcesses(5);
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).orderByActivityId().asc();
List<HistoricActivityStatistics> statistics = query.list();
assertEquals(4, query.count());
assertEquals(4, statistics.size());
// innerTask
HistoricActivityStatistics innerTask = statistics.get(0);
assertEquals("innerTask", innerTask.getId());
assertEquals(25, innerTask.getInstances());
// subprocess
HistoricActivityStatistics subProcess = statistics.get(1);
assertEquals("subprocess", subProcess.getId());
assertEquals(25, subProcess.getInstances());
// subprocess multi instance body
HistoricActivityStatistics subProcessMiBody = statistics.get(2);
assertEquals("subprocess#multiInstanceBody", subProcessMiBody.getId());
assertEquals(5, subProcessMiBody.getInstances());
// task
HistoricActivityStatistics task = statistics.get(3);
assertEquals("task", task.getId());
assertEquals(5, task.getInstances());
completeProcessInstances();
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsQueryTest method testSingleTask.
@Deployment
public void testSingleTask() {
String processDefinitionId = getProcessDefinitionId();
startProcesses(5);
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId);
List<HistoricActivityStatistics> statistics = query.list();
assertEquals(1, query.count());
assertEquals(1, statistics.size());
HistoricActivityStatistics statistic = statistics.get(0);
assertEquals("task", statistic.getId());
assertEquals(5, statistic.getInstances());
completeProcessInstances();
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsQueryTest method testSorting.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityStatisticsQueryTest.testSingleTask.bpmn20.xml")
public void testSorting() {
String processDefinitionId = getProcessDefinitionId();
startProcesses(5);
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId);
assertEquals(1, query.orderByActivityId().asc().list().size());
assertEquals(1, query.orderByActivityId().desc().list().size());
assertEquals(1, query.orderByActivityId().asc().count());
assertEquals(1, query.orderByActivityId().desc().count());
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsQueryTest method testQueryByCompleteScopeAfterFinishingSomeInstances.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityStatisticsQueryTest.testSingleTask.bpmn20.xml")
public void testQueryByCompleteScopeAfterFinishingSomeInstances() {
String processDefinitionId = getProcessDefinitionId();
// start five instances
startProcesses(5);
// complete two task, so that two process instances are finished
List<Task> tasks = taskService.createTaskQuery().list();
for (int i = 0; i < 2; i++) {
taskService.complete(tasks.get(i).getId());
}
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeCompleteScope().orderByActivityId().asc();
List<HistoricActivityStatistics> statistics = query.list();
assertEquals(2, query.count());
assertEquals(2, statistics.size());
// end
HistoricActivityStatistics end = statistics.get(0);
assertEquals("end", end.getId());
assertEquals(0, end.getInstances());
assertEquals(2, end.getCompleteScope());
// task
HistoricActivityStatistics task = statistics.get(1);
assertEquals("task", task.getId());
assertEquals(3, task.getInstances());
assertEquals(0, task.getCompleteScope());
completeProcessInstances();
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsQueryTest method testQueryByCanceledAfterCancelingSomeInstances.
@Deployment(resources = "org/camunda/bpm/engine/test/history/HistoricActivityStatisticsQueryTest.testSingleTask.bpmn20.xml")
public void testQueryByCanceledAfterCancelingSomeInstances() {
String processDefinitionId = getProcessDefinitionId();
startProcesses(3);
// cancel running process instances
List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list();
for (ProcessInstance processInstance : processInstances) {
runtimeService.deleteProcessInstance(processInstance.getId(), "test");
}
startProcesses(2);
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeCanceled();
List<HistoricActivityStatistics> statistics = query.list();
assertEquals(1, query.count());
assertEquals(1, statistics.size());
// task
HistoricActivityStatistics task = statistics.get(0);
assertEquals("task", task.getId());
assertEquals(2, task.getInstances());
assertEquals(3, task.getCanceled());
completeProcessInstances();
}
Aggregations