use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingInstancesWithMany.
public void testQueryIncludingInstancesWithMany() {
// 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_DEFINITION, ANY, userId, READ);
createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(1, statistics.getInstances());
assertEquals(0, statistics.getFailedJobs());
assertTrue(statistics.getIncidentStatistics().isEmpty());
}
use of org.camunda.bpm.engine.management.ActivityStatistics 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.ActivityStatistics 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.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingIncidentsWithoutAuthorizationOnProcessInstance.
// including incidents //////////////////////////////////////////////////////////////
public void testQueryIncludingIncidentsWithoutAuthorizationOnProcessInstance() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeIncidents().singleResult();
// then
assertNull(statistics);
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithReadPermissionOnOneProcessInstance.
public void testQueryIncludingFailedJobsWithReadPermissionOnOneProcessInstance() {
// 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).includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(1, statistics.getInstances());
assertEquals(1, statistics.getFailedJobs());
assertTrue(statistics.getIncidentStatistics().isEmpty());
}
Aggregations