use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsQueryTest method testSubprocessActivityStatisticsQuery.
@Test
@Deployment(resources = "org/camunda/bpm/engine/test/api/mgmt/StatisticsTest.testSubprocessStatisticsQuery.bpmn20.xml")
public void testSubprocessActivityStatisticsQuery() {
runtimeService.startProcessInstanceByKey("ExampleProcess");
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(1, result.getInstances());
Assert.assertEquals("subProcessTask", result.getId());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class NonInterruptingBoundaryEventScenarioTest method testInitActivityInstanceStatistics.
@Test
@ScenarioUnderTest("init.1")
public void testInitActivityInstanceStatistics() {
// given
ProcessInstance processInstance = rule.processInstance();
// when
List<ActivityStatistics> activityStatistics = rule.getManagementService().createActivityStatisticsQuery(processInstance.getProcessDefinitionId()).list();
// then
Assert.assertEquals(2, activityStatistics.size());
ActivityStatistics outerTaskStatistics = getStatistics(activityStatistics, "outerTask");
Assert.assertNotNull(outerTaskStatistics);
Assert.assertEquals("outerTask", outerTaskStatistics.getId());
Assert.assertEquals(1, outerTaskStatistics.getInstances());
ActivityStatistics afterBoundaryStatistics = getStatistics(activityStatistics, "afterBoundaryTask");
Assert.assertNotNull(afterBoundaryStatistics);
Assert.assertEquals("afterBoundaryTask", afterBoundaryStatistics.getId());
Assert.assertEquals(1, afterBoundaryStatistics.getInstances());
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingInstancesWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingInstancesWithReadPermissionOnAnyProcessInstance() {
// 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).singleResult();
// then
assertNotNull(statistics);
assertEquals("scriptTask", statistics.getId());
assertEquals(3, 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 testQueryIncludingIncidentsAndFailedJobsWithoutAuthorizationOnProcessInstance.
// including incidents and failed jobs //////////////////////////////////////////////////////////
public void testQueryIncludingIncidentsAndFailedJobsWithoutAuthorizationOnProcessInstance() {
// 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().includeFailedJobs().singleResult();
// then
assertNull(statistics);
}
use of org.camunda.bpm.engine.management.ActivityStatistics in project camunda-bpm-platform by camunda.
the class ActivityStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithoutAuthorizationOnProcessInstance.
// including failed jobs //////////////////////////////////////////////////////////////
public void testQueryIncludingFailedJobsWithoutAuthorizationOnProcessInstance() {
// given
String processDefinitionId = selectProcessDefinitionByKey(ONE_INCIDENT_PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ);
// when
ActivityStatistics statistics = managementService.createActivityStatisticsQuery(processDefinitionId).includeFailedJobs().singleResult();
// then
assertNull(statistics);
}
Aggregations