use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsQueryTest method testQueryByIncidentsWithFailedTimerStartEvent.
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testFailedTimerStartEvent.bpmn20.xml")
public void testQueryByIncidentsWithFailedTimerStartEvent() {
executeAvailableJobs();
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidents().list();
assertEquals(1, statistics.size());
ProcessDefinitionStatistics 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());
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class MultiTenancySharedProcessDefinitionStatisticsQueryTest method instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant.
@Test
public void instancesFailedJobsAndIncidentsCountWithAuthenticatedTenant() {
testRule.deploy(failingProcess);
startProcessInstances(FAILED_JOBS_PROCESS_DEFINITION_KEY);
testRule.executeAvailableJobs();
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
List<ProcessDefinitionStatistics> processDefinitionsStatistics = managementService.createProcessDefinitionStatisticsQuery().includeFailedJobs().includeIncidents().list();
// then
assertEquals(1, processDefinitionsStatistics.size());
ProcessDefinitionStatistics processDefinitionStatistics = processDefinitionsStatistics.get(0);
assertEquals(2, processDefinitionStatistics.getInstances());
assertEquals(2, processDefinitionStatistics.getFailedJobs());
List<IncidentStatistics> incidentStatistics = processDefinitionStatistics.getIncidentStatistics();
assertEquals(1, incidentStatistics.size());
assertEquals(2, incidentStatistics.get(0).getIncidentCount());
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsAuthorizationTest method testQueryWithReadPermissionOnAnyProcessDefinition.
public void testQueryWithReadPermissionOnAnyProcessDefinition() {
// given
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ);
// when
ProcessDefinitionStatisticsQuery query = managementService.createProcessDefinitionStatisticsQuery();
// then
verifyQueryResults(query, 2);
List<ProcessDefinitionStatistics> statistics = query.list();
for (ProcessDefinitionStatistics result : statistics) {
verifyStatisticsResult(result, 0, 0, 0);
}
}
use of org.camunda.bpm.engine.management.ProcessDefinitionStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsAuthorizationTest method testQueryIncludingIncidentsWithoutProcessInstanceAuthorizations.
// including incidents //////////////////////////////////////////////////////////////////////////
public void testQueryIncludingIncidentsWithoutProcessInstanceAuthorizations() {
// given
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessInstanceByKey(ONE_TASK_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ);
// when
List<ProcessDefinitionStatistics> statistics = managementService.createProcessDefinitionStatisticsQuery().includeIncidents().list();
// then
assertEquals(2, statistics.size());
ProcessDefinitionStatistics oneTaskProcessStatistics = getStatisticsByKey(statistics, ONE_TASK_PROCESS_KEY);
verifyStatisticsResult(oneTaskProcessStatistics, 2, 0, 0);
ProcessDefinitionStatistics oneIncidentProcessStatistics = getStatisticsByKey(statistics, ONE_INCIDENT_PROCESS_KEY);
verifyStatisticsResult(oneIncidentProcessStatistics, 3, 0, 3);
}
Aggregations