use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingIncidentsAndFailedJobsWithReadInstancePermissionOnProcessDefinition.
public void testQueryIncludingIncidentsAndFailedJobsWithReadInstancePermissionOnProcessDefinition() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ, READ_INSTANCE);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeIncidents().includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, statistics.getInstances());
assertEquals(3, statistics.getFailedJobs());
assertFalse(statistics.getIncidentStatistics().isEmpty());
IncidentStatistics incidentStatistics = statistics.getIncidentStatistics().get(0);
assertEquals(3, incidentStatistics.getIncidentCount());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingIncidentsAndFailedJobsWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingIncidentsAndFailedJobsWithReadPermissionOnAnyProcessInstance() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, ANY, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeIncidents().includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, statistics.getInstances());
assertEquals(3, statistics.getFailedJobs());
assertFalse(statistics.getIncidentStatistics().isEmpty());
IncidentStatistics incidentStatistics = statistics.getIncidentStatistics().get(0);
assertEquals(3, incidentStatistics.getIncidentCount());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingIncidentsWithReadPermissionOnOneProcessInstance.
public void testQueryIncludingIncidentsWithReadPermissionOnOneProcessInstance() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
disableAuthorization();
String processInstanceId = runtimeService.createProcessInstanceQuery().list().get(0).getId();
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeIncidents().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(1, statistics.getInstances());
assertEquals(0, statistics.getFailedJobs());
assertFalse(statistics.getIncidentStatistics().isEmpty());
IncidentStatistics incidentStatistics = statistics.getIncidentStatistics().get(0);
assertEquals(1, incidentStatistics.getIncidentCount());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingIncidentsAndFailedJobsWithReadPermissionOnOneProcessInstance.
public void testQueryIncludingIncidentsAndFailedJobsWithReadPermissionOnOneProcessInstance() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
disableAuthorization();
String processInstanceId = runtimeService.createProcessInstanceQuery().list().get(0).getId();
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeIncidents().includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(1, statistics.getInstances());
assertEquals(1, statistics.getFailedJobs());
assertFalse(statistics.getIncidentStatistics().isEmpty());
IncidentStatistics incidentStatistics = statistics.getIncidentStatistics().get(0);
assertEquals(1, incidentStatistics.getIncidentCount());
}
use of org.camunda.bpm.engine.management.IncidentStatistics in project camunda-bpm-platform by camunda.
the class ProcessDefinitionStatisticsResultDto method fromProcessDefinitionStatistics.
public static ProcessDefinitionStatisticsResultDto fromProcessDefinitionStatistics(ProcessDefinitionStatistics statistics) {
ProcessDefinitionStatisticsResultDto dto = new ProcessDefinitionStatisticsResultDto();
dto.definition = ProcessDefinitionDto.fromProcessDefinition(statistics);
dto.id = statistics.getId();
dto.instances = statistics.getInstances();
dto.failedJobs = statistics.getFailedJobs();
dto.incidents = new ArrayList<IncidentStatisticsResultDto>();
for (IncidentStatistics incident : statistics.getIncidentStatistics()) {
IncidentStatisticsResultDto incidentDto = IncidentStatisticsResultDto.fromIncidentStatistics(incident);
dto.incidents.add(incidentDto);
}
return dto;
}
Aggregations