Search in sources :

Example 21 with IncidentStatistics

use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.

the class DeploymentStatisticsQueryTest method testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByFailedJobsAndIncidentsWithFailedTimerStartEvent() {
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeFailedJobs().includeIncidents().list();
    assertEquals(1, statistics.size());
    DeploymentStatistics 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());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 22 with IncidentStatistics

use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.

the class DeploymentStatisticsQueryTest method testQueryByIncidentTypeWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentTypeWithFailedTimerStartEvent() {
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidentsForType(Incident.FAILED_JOB_HANDLER_TYPE).list();
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    // there is no running 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());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 23 with IncidentStatistics

use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.

the class ActivityStatisticsQueryTest method testQueryByIncidentTypeWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentTypeWithFailedTimerStartEvent() {
    ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process").singleResult();
    executeAvailableJobs();
    List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeIncidentsForType(Incident.FAILED_JOB_HANDLER_TYPE).list();
    assertEquals(1, statistics.size());
    ActivityStatistics result = statistics.get(0);
    // there is no running 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());
}
Also used : ActivityStatistics(org.camunda.bpm.engine.management.ActivityStatistics) IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 24 with IncidentStatistics

use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.

the class ActivityStatisticsQueryTest method testActivityStatisticsQueryWithIncidentsWithoutFailedJobs.

@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml")
public void testActivityStatisticsQueryWithIncidentsWithoutFailedJobs() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("callExampleSubProcess");
    executeAvailableJobs();
    List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId()).includeIncidents().includeFailedJobs().list();
    Assert.assertEquals(1, statistics.size());
    ActivityStatistics activityResult = statistics.get(0);
    Assert.assertEquals("callSubProcess", activityResult.getId());
    // has no failed jobs
    Assert.assertEquals(0, activityResult.getFailedJobs());
    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());
    // ... but has one incident
    assertEquals(1, incident.getIncidentCount());
}
Also used : ActivityStatistics(org.camunda.bpm.engine.management.ActivityStatistics) IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with IncidentStatistics

use of org.camunda.bpm.engine.management.IncidentStatistics 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());
}
Also used : ActivityStatistics(org.camunda.bpm.engine.management.ActivityStatistics) IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) HashMap(java.util.HashMap) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

IncidentStatistics (org.camunda.bpm.engine.management.IncidentStatistics)35 Deployment (org.camunda.bpm.engine.test.Deployment)23 Test (org.junit.Test)16 ActivityStatistics (org.camunda.bpm.engine.management.ActivityStatistics)14 HashMap (java.util.HashMap)11 ProcessDefinitionStatistics (org.camunda.bpm.engine.management.ProcessDefinitionStatistics)10 DeploymentStatistics (org.camunda.bpm.engine.management.DeploymentStatistics)9 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)4 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)4 ArrayList (java.util.ArrayList)2 HistoricActivityStatistics (org.camunda.bpm.engine.history.HistoricActivityStatistics)1 HistoricCaseActivityStatistics (org.camunda.bpm.engine.history.HistoricCaseActivityStatistics)1