use of org.camunda.bpm.engine.history.HistoricCaseActivityStatistics in project camunda-bpm-platform by camunda.
the class HistoricCaseDefinitionRestServiceImpl method getHistoricCaseActivityStatistics.
public List<HistoricCaseActivityStatisticsDto> getHistoricCaseActivityStatistics(String caseDefinitionId) {
HistoryService historyService = processEngine.getHistoryService();
List<HistoricCaseActivityStatistics> statistics = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId).list();
List<HistoricCaseActivityStatisticsDto> result = new ArrayList<HistoricCaseActivityStatisticsDto>();
for (HistoricCaseActivityStatistics currentStatistics : statistics) {
result.add(HistoricCaseActivityStatisticsDto.fromHistoricCaseActivityStatistics(currentStatistics));
}
return result;
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatistics in project camunda-bpm-platform by camunda.
the class MockProvider method createMockHistoricCaseActivityStatistics.
public static List<HistoricCaseActivityStatistics> createMockHistoricCaseActivityStatistics() {
HistoricCaseActivityStatistics statistics = mock(HistoricCaseActivityStatistics.class);
when(statistics.getId()).thenReturn(EXAMPLE_ACTIVITY_ID);
when(statistics.getActive()).thenReturn(EXAMPLE_ACTIVE_LONG);
when(statistics.getAvailable()).thenReturn(EXAMPLE_AVAILABLE_LONG);
when(statistics.getCompleted()).thenReturn(EXAMPLE_COMPLETED_LONG);
when(statistics.getDisabled()).thenReturn(EXAMPLE_DISABLED_LONG);
when(statistics.getEnabled()).thenReturn(EXAMPLE_ENABLED_LONG);
when(statistics.getTerminated()).thenReturn(EXAMPLE_TERMINATED_LONG);
HistoricCaseActivityStatistics anotherStatistics = mock(HistoricCaseActivityStatistics.class);
when(anotherStatistics.getId()).thenReturn(ANOTHER_EXAMPLE_ACTIVITY_ID);
when(anotherStatistics.getActive()).thenReturn(ANOTHER_EXAMPLE_ACTIVE_LONG);
when(anotherStatistics.getAvailable()).thenReturn(ANOTHER_EXAMPLE_AVAILABLE_LONG);
when(anotherStatistics.getCompleted()).thenReturn(ANOTHER_EXAMPLE_COMPLETED_LONG);
when(anotherStatistics.getDisabled()).thenReturn(ANOTHER_EXAMPLE_DISABLED_LONG);
when(anotherStatistics.getEnabled()).thenReturn(ANOTHER_EXAMPLE_ENABLED_LONG);
when(anotherStatistics.getTerminated()).thenReturn(ANOTHER_EXAMPLE_TERMINATED_LONG);
List<HistoricCaseActivityStatistics> activityResults = new ArrayList<HistoricCaseActivityStatistics>();
activityResults.add(statistics);
activityResults.add(anotherStatistics);
return activityResults;
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatistics in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityStatisticsQueryTest method testMultipleTasks.
@Test
@Deployment
public void testMultipleTasks() {
// given
String caseDefinitionId = getCaseDefinition().getId();
createCaseByKey(5, "case");
disableByActivity("DISABLED");
completeByActivity("COMPLETED");
terminateByActivity("TERMINATED");
// when
HistoricCaseActivityStatisticsQuery query = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId);
// then
List<HistoricCaseActivityStatistics> statistics = query.list();
assertThat(statistics.size(), is(6));
assertEquals(query.count(), 6);
assertStatisitcs(statistics.get(0), "ACTIVE", 5, 0, 0, 0, 0, 0);
assertStatisitcs(statistics.get(1), "AVAILABLE", 0, 5, 0, 0, 0, 0);
assertStatisitcs(statistics.get(2), "COMPLETED", 0, 0, 5, 0, 0, 0);
assertStatisitcs(statistics.get(3), "DISABLED", 0, 0, 0, 5, 0, 0);
assertStatisitcs(statistics.get(4), "ENABLED", 0, 0, 0, 0, 5, 0);
assertStatisitcs(statistics.get(5), "TERMINATED", 0, 0, 0, 0, 0, 5);
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatistics in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityStatisticsQueryTest method testStateCount.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.testMultipleTasks.cmmn" })
public void testStateCount() {
// given
String caseDefinitionId = getCaseDefinition().getId();
createCaseByKey(3, "case");
completeByActivity("ACTIVE");
manuallyStartByActivity("AVAILABLE");
completeByActivity("AVAILABLE");
createCaseByKey(5, "case");
completeByActivity("ACTIVE");
disableByActivity("AVAILABLE");
reenableByActivity("AVAILABLE");
manuallyStartByActivity("AVAILABLE");
terminateByActivity("AVAILABLE");
createCaseByKey(5, "case");
terminateByActivity("ACTIVE");
manuallyStartByActivity("ENABLED");
completeByActivity("ENABLED");
manuallyStartByActivity("DISABLED");
terminateByActivity("DISABLED");
createCaseByKey(2, "case");
disableByActivity("DISABLED");
// when
HistoricCaseActivityStatisticsQuery query = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId);
// then
List<HistoricCaseActivityStatistics> statistics = query.list();
assertThat(statistics.size(), is(6));
assertEquals(query.count(), 6);
assertStatisitcs(statistics.get(0), "ACTIVE", 2, 0, 8, 0, 0, 5);
assertStatisitcs(statistics.get(1), "AVAILABLE", 0, 7, 3, 0, 0, 5);
assertStatisitcs(statistics.get(2), "COMPLETED", 15, 0, 0, 0, 0, 0);
assertStatisitcs(statistics.get(3), "DISABLED", 0, 0, 0, 2, 0, 13);
assertStatisitcs(statistics.get(4), "ENABLED", 0, 0, 13, 0, 2, 0);
assertStatisitcs(statistics.get(5), "TERMINATED", 15, 0, 0, 0, 0, 0);
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatistics in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityStatisticsQueryTest method testSingleTask.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn")
public void testSingleTask() {
// given
String caseDefinitionId = getCaseDefinition().getId();
createCaseByKey(5, "oneTaskCase");
// when
HistoricCaseActivityStatisticsQuery query = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId);
// then
List<HistoricCaseActivityStatistics> statistics = query.list();
assertEquals(1, query.count());
assertThat(statistics.size(), is(1));
assertStatisitcs(statistics.get(0), "PI_HumanTask_1", 5, 0, 0, 0, 0, 0);
}
Aggregations