use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testNonInterruptingBoundaryEventActivityStatisticsQuery.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testNonInterruptingBoundaryEventStatisticsQuery.bpmn20.xml")
public void testNonInterruptingBoundaryEventActivityStatisticsQuery() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("process");
Job boundaryJob = managementService.createJobQuery().singleResult();
managementService.executeJob(boundaryJob.getId());
// when
List<ActivityStatistics> activityStatistics = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId()).list();
// then
assertEquals(2, activityStatistics.size());
ActivityStatistics userTaskStatistics = getStatistics(activityStatistics, "task");
assertNotNull(userTaskStatistics);
assertEquals("task", userTaskStatistics.getId());
assertEquals(1, userTaskStatistics.getInstances());
ActivityStatistics afterBoundaryStatistics = getStatistics(activityStatistics, "afterBoundaryTask");
assertNotNull(afterBoundaryStatistics);
assertEquals("afterBoundaryTask", afterBoundaryStatistics.getId());
assertEquals(1, afterBoundaryStatistics.getInstances());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testQueryByFailedJobsWithFailedTimerStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByFailedJobsWithFailedTimerStartEvent() {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult();
executeAvailableJobs();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeFailedJobs().list();
assertEquals(1, statistics.size());
ActivityStatistics result = statistics.get(0);
// there is no running instance
assertEquals(0, result.getInstances());
// but there is one failed timer job
assertEquals(1, result.getFailedJobs());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testActivityStatisticsQuery.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQuery.bpmn20.xml")
public void testActivityStatisticsQuery() {
runtimeService.startProcessInstanceByKey("ExampleProcess");
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("ExampleProcess").singleResult();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeFailedJobs().includeIncidents().list();
Assert.assertEquals(1, statistics.size());
ActivityStatistics activityResult = statistics.get(0);
Assert.assertEquals(1, activityResult.getInstances());
Assert.assertEquals("theTask", activityResult.getId());
Assert.assertEquals(0, activityResult.getFailedJobs());
assertTrue(activityResult.getIncidentStatistics().isEmpty());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testActivityStatisticsQueryWithInvalidIncidentType.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml")
public void testActivityStatisticsQueryWithInvalidIncidentType() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("fail", true);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
executeAvailableJobs();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId()).includeIncidentsForType("invalid").list();
Assert.assertEquals(1, statistics.size());
ActivityStatistics activityResult = statistics.get(0);
List<IncidentStatistics> incidentStatistics = activityResult.getIncidentStatistics();
assertTrue(incidentStatistics.isEmpty());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testActivityStatisticsQueryWithIncidents.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml")
public void testActivityStatisticsQueryWithIncidents() {
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("fail", true);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
executeAvailableJobs();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId()).includeIncidents().list();
Assert.assertEquals(1, statistics.size());
ActivityStatistics activityResult = statistics.get(0);
List<IncidentStatistics> incidentStatistics = activityResult.getIncidentStatistics();
assertFalse(incidentStatistics.isEmpty());
assertEquals(1, incidentStatistics.size());
IncidentStatistics incident = incidentStatistics.get(0);
assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incident.getIncidentType());
assertEquals(1, incident.getIncidentCount());
}
Aggregations