Search in sources :

Example 1 with HistoricCaseActivityStatisticsQuery

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);
}
Also used : HistoricCaseActivityStatistics(org.camunda.bpm.engine.history.HistoricCaseActivityStatistics) HistoricCaseActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 2 with HistoricCaseActivityStatisticsQuery

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);
}
Also used : HistoricCaseActivityStatistics(org.camunda.bpm.engine.history.HistoricCaseActivityStatistics) HistoricCaseActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 3 with HistoricCaseActivityStatisticsQuery

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));
}
Also used : HistoricCaseActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with HistoricCaseActivityStatisticsQuery

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));
}
Also used : HistoricCaseActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 5 with HistoricCaseActivityStatisticsQuery

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);
}
Also used : HistoricCaseActivityStatistics(org.camunda.bpm.engine.history.HistoricCaseActivityStatistics) HistoricCaseActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricCaseActivityStatisticsQuery (org.camunda.bpm.engine.history.HistoricCaseActivityStatisticsQuery)5 Deployment (org.camunda.bpm.engine.test.Deployment)5 Test (org.junit.Test)5 HistoricCaseActivityStatistics (org.camunda.bpm.engine.history.HistoricCaseActivityStatistics)3