use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testCallActivityProcessDefinitionStatisticsQuery.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testCallActivityWithIncidentsWithoutFailedJobs.bpmn20.xml")
public void testCallActivityProcessDefinitionStatisticsQuery() {
runtimeService.startProcessInstanceByKey("callExampleSubProcess");
executeAvailableJobs();
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeFailedJobs().list();
Assert.assertEquals(2, statistics.size());
for (ProcessDefinitionStatistics result : statistics) {
if (result.getKey().equals("ExampleProcess")) {
Assert.assertEquals(1, result.getInstances());
Assert.assertEquals(1, result.getFailedJobs());
} else if (result.getKey().equals("callExampleSubProcess")) {
Assert.assertEquals(1, result.getInstances());
Assert.assertEquals(0, result.getFailedJobs());
} else {
fail(result + " was not expected.");
}
}
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testProcessDefinitionStatisticsQueryWithoutRunningInstances.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQueryWithFailedJobs.bpmn20.xml")
public void testProcessDefinitionStatisticsQueryWithoutRunningInstances() {
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeFailedJobs().includeIncidents().list();
Assert.assertEquals(1, statistics.size());
ProcessDefinitionStatistics definitionResult = statistics.get(0);
Assert.assertEquals(0, definitionResult.getInstances());
Assert.assertEquals(0, definitionResult.getFailedJobs());
statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidents().list();
assertTrue(definitionResult.getIncidentStatistics().isEmpty());
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics 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.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testProcessDefinitionStatisticsProperties.
public void testProcessDefinitionStatisticsProperties() {
String resourceName = "org/camunda/bpm/engine/test/api/mgmt/ProcessDefinitionStatisticsQueryTest.testProcessDefinitionStatisticsProperties.bpmn20.xml";
String deploymentId = deploymentForTenant("tenant1", resourceName);
ProcessDefinitionStatistics processDefinitionStatistics = managementService.createProcessDefinitionStatisticsQuery().singleResult();
assertEquals("testProcess", processDefinitionStatistics.getKey());
assertEquals("process name", processDefinitionStatistics.getName());
assertEquals("Examples", processDefinitionStatistics.getCategory());
// it is not parsed for the statistics query
assertEquals(null, processDefinitionStatistics.getDescription());
assertEquals("tenant1", processDefinitionStatistics.getTenantId());
assertEquals("v0.1.0", processDefinitionStatistics.getVersionTag());
assertEquals(deploymentId, processDefinitionStatistics.getDeploymentId());
assertEquals(resourceName, processDefinitionStatistics.getResourceName());
assertEquals(null, processDefinitionStatistics.getDiagramResourceName());
assertEquals(1, processDefinitionStatistics.getVersion());
assertEquals(0, processDefinitionStatistics.getInstances());
assertEquals(0, processDefinitionStatistics.getFailedJobs());
assertTrue(processDefinitionStatistics.getIncidentStatistics().isEmpty());
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics 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