use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingFailedJobsWithReadPermissionOnAnyProcessInstance() {
// 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).includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, statistics.getInstances());
assertEquals(3, 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 testQueryIncludingFailedJobsWithReadInstancePermissionOnProcessDefinition.
public void testQueryIncludingFailedJobsWithReadInstancePermissionOnProcessDefinition() {
// 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).includeFailedJobs().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, statistics.getInstances());
assertEquals(3, 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 testQueryIncludingIncidentsWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingIncidentsWithReadPermissionOnAnyProcessInstance() {
// 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().singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, statistics.getInstances());
assertEquals(0, 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 ActivityStatisticsQueryTest method FAILING_testActivityStatisticsQueryWithNoInstances.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testStatisticsQuery.bpmn20.xml")
public void FAILING_testActivityStatisticsQueryWithNoInstances() {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("ExampleProcess").singleResult();
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).list();
Assert.assertEquals(1, statistics.size());
ActivityStatistics result = statistics.get(0);
Assert.assertEquals("theTask", result.getId());
Assert.assertEquals(0, result.getInstances());
Assert.assertEquals(0, result.getFailedJobs());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testActivityStatisticsQueryPagination.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testParallelGatewayStatisticsQuery.bpmn20.xml")
public void testActivityStatisticsQueryPagination() {
ProcessDefinition definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("ParGatewayExampleProcess").singleResult();
runtimeService.startProcessInstanceById(definition.getId());
List<ActivityStatistics> statistics = managementService.createActivityStatisticsQuery(definition.getId()).includeFailedJobs().includeIncidents().listPage(0, 1);
Assert.assertEquals(1, statistics.size());
}
Aggregations