use of org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery 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.HistoricCaseActivityStatisticsQuery 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.HistoricCaseActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityStatisticsQueryTest method testMultipleCaseDefinitions.
@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn", "org/camunda/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.testMultipleTasks.cmmn" })
public void testMultipleCaseDefinitions() {
// given
String caseDefinitionId1 = getCaseDefinition("oneTaskCase").getId();
String caseDefinitionId2 = getCaseDefinition("case").getId();
createCaseByKey(5, "oneTaskCase");
createCaseByKey(10, "case");
// when
HistoricCaseActivityStatisticsQuery query1 = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId1);
HistoricCaseActivityStatisticsQuery query2 = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId2);
// then
assertThat(query1.list().size(), is(1));
assertThat(query2.list().size(), is(6));
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityStatisticsQueryTest method testNoCaseActivityInstances.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn")
public void testNoCaseActivityInstances() {
// given
String caseDefinitionId = getCaseDefinition().getId();
// when
HistoricCaseActivityStatisticsQuery query = historyService.createHistoricCaseActivityStatisticsQuery(caseDefinitionId);
// then
assertEquals(0, query.count());
assertThat(query.list().size(), is(0));
}
use of org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery 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