use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testQueryByIncidentsWithFailedTimerStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentsWithFailedTimerStartEvent() {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult();
executeAvailableJobs();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeIncidents().list();
assertEquals(1, statistics.size());
ActivityStatistics result = statistics.get(0);
assertEquals("theStart", result.getId());
// there is no running activity instance
assertEquals(0, result.getInstances());
List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
// but there is one incident for the failed timer job
assertEquals(1, incidentStatistics.size());
IncidentStatistics incidentStatistic = incidentStatistics.get(0);
assertEquals(1, incidentStatistic.getIncidentCount());
assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incidentStatistic.getIncidentType());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testActivityStatisticsQueryWithIncidentType.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml")
public void testActivityStatisticsQueryWithIncidentType() {
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("failedJob").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());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent() {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult();
executeAvailableJobs();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeFailedJobs().includeIncidents().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());
List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
// and there is one incident for the failed timer job
assertEquals(1, incidentStatistics.size());
IncidentStatistics incidentStatistic = incidentStatistics.get(0);
assertEquals(1, incidentStatistic.getIncidentCount());
assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incidentStatistic.getIncidentType());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent() {
executeAvailableJobs();
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeFailedJobs().includeIncidents().list();
assertEquals(1, statistics.size());
ProcessDefinitionStatistics result = statistics.get(0);
// there is no running instance
assertEquals(0, result.getInstances());
// but there is one failed timer job
assertEquals(1, result.getFailedJobs());
List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
// and there is one incident for the failed timer job
assertEquals(1, incidentStatistics.size());
IncidentStatistics incidentStatistic = incidentStatistics.get(0);
assertEquals(1, incidentStatistic.getIncidentCount());
assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incidentStatistic.getIncidentType());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testProcessDefinitionStatisticsQueryWithIncidentType.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml")
public void testProcessDefinitionStatisticsQueryWithIncidentType() {
runtimeService.startProcessInstanceByKey("ExampleProcess");
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("fail", true);
runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
executeAvailableJobs();
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidentsForType("failedJob").list();
Assert.assertEquals(1, statistics.size());
ProcessDefinitionStatistics definitionResult = statistics.get(0);
Assert.assertEquals(2, definitionResult.getInstances());
assertFalse(definitionResult.getIncidentStatistics().isEmpty());
assertEquals(1, definitionResult.getIncidentStatistics().size());
IncidentStatistics incidentStatistics = definitionResult.getIncidentStatistics().get(0);
Assert.assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incidentStatistics.getIncidentType());
Assert.assertEquals(1, incidentStatistics.getIncidentCount());
}
Aggregations