Search in sources :

Example 6 with IncidentStatistics

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

the class MultiTenancySharedDeploymentStatisticsQueryTest method instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant.

@Test
public void instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant() {
    testRule.deploy(failingProcess, anotherFailingProcess);
    startProcessInstances(FAILED_JOBS_PROCESS_DEFINITION_KEY);
    startProcessInstances(ANOTHER_FAILED_JOBS_PROCESS_DEFINITION_KEY);
    testRule.executeAvailableJobs();
    identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
    List<DeploymentStatistics> deploymentStatistics = managementService.createDeploymentStatisticsQuery().includeFailedJobs().includeIncidents().list();
    // then
    assertEquals(1, deploymentStatistics.size());
    DeploymentStatistics singleDeploymentStatistics = deploymentStatistics.get(0);
    assertEquals(4, singleDeploymentStatistics.getInstances());
    assertEquals(4, singleDeploymentStatistics.getFailedJobs());
    List<IncidentStatistics> incidentStatistics = singleDeploymentStatistics.getIncidentStatistics();
    assertEquals(1, incidentStatistics.size());
    assertEquals(4, incidentStatistics.get(0).getIncidentCount());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) Test(org.junit.Test)

Example 7 with IncidentStatistics

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

the class DeploymentStatisticsQueryTest method testDeploymentStatisticsQueryWithIncidentType.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testMultiInstanceStatisticsQuery.bpmn20.xml", "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml" })
public void testDeploymentStatisticsQueryWithIncidentType() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("fail", true);
    runtimeService.startProcessInstanceByKey("MIExampleProcess");
    runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidentsForType("failedJob").list();
    assertFalse(statistics.isEmpty());
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    List<IncidentStatistics> incidentStatistics = result.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());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) HashMap(java.util.HashMap) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 8 with IncidentStatistics

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

the class DeploymentStatisticsQueryTest method testQueryByIncidentsWithFailedTimerStartEvent.

@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentsWithFailedTimerStartEvent() {
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidents().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 9 with IncidentStatistics

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

the class DeploymentStatisticsQueryTest method testDeploymentStatisticsQueryWithIncidents.

@Test
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testMultiInstanceStatisticsQuery.bpmn20.xml", "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml" })
public void testDeploymentStatisticsQueryWithIncidents() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("fail", true);
    runtimeService.startProcessInstanceByKey("MIExampleProcess");
    runtimeService.startProcessInstanceByKey("ExampleProcess", parameters);
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidents().list();
    assertFalse(statistics.isEmpty());
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    List<IncidentStatistics> incidentStatistics = result.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());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) HashMap(java.util.HashMap) Test(org.junit.Test) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 10 with IncidentStatistics

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

the class DeploymentStatisticsQueryTest method testDeploymentStatisticsQueryWithTwoIncidentsAndOneFailedJobs.

@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml")
public void testDeploymentStatisticsQueryWithTwoIncidentsAndOneFailedJobs() {
    runtimeService.startProcessInstanceByKey("callExampleSubProcess");
    executeAvailableJobs();
    List<DeploymentStatistics> statistics = managementService.createDeploymentStatisticsQuery().includeIncidents().includeFailedJobs().list();
    assertFalse(statistics.isEmpty());
    assertEquals(1, statistics.size());
    DeploymentStatistics result = statistics.get(0);
    // has one failed job
    Assert.assertEquals(1, result.getFailedJobs());
    List<IncidentStatistics> incidentStatistics = result.getIncidentStatistics();
    assertFalse(incidentStatistics.isEmpty());
    assertEquals(1, incidentStatistics.size());
    IncidentStatistics incident = incidentStatistics.get(0);
    assertEquals(Incident.FAILED_JOB_HANDLER_TYPE, incident.getIncidentType());
    // ...but two incidents
    assertEquals(2, incident.getIncidentCount());
}
Also used : IncidentStatistics(org.camunda.bpm.engine.management.IncidentStatistics) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics) 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