Search in sources :

Example 31 with DeploymentStatistics

use of org.camunda.bpm.engine.management.DeploymentStatistics in project camunda-bpm-platform by camunda.

the class DeploymentStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithReadInstancePermissionOnProcessDefinition.

public void testQueryIncludingFailedJobsWithReadInstancePermissionOnProcessDefinition() {
    // given
    createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_START_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ONE_INCIDENT_PROCESS_KEY, userId, READ_INSTANCE);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery().includeFailedJobs();
    // then
    List<DeploymentStatistics> statistics = query.list();
    for (DeploymentStatistics deploymentStatistics : statistics) {
        String id = deploymentStatistics.getId();
        if (id.equals(firstDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 3, 0);
        } else if (id.equals(secondDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 0, 0, 0);
        } else if (id.equals(thirdDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 0, 0, 0);
        } else {
            fail("Unexpected deployment");
        }
    }
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics)

Aggregations

DeploymentStatistics (org.camunda.bpm.engine.management.DeploymentStatistics)31 DeploymentStatisticsQuery (org.camunda.bpm.engine.management.DeploymentStatisticsQuery)18 Deployment (org.camunda.bpm.engine.test.Deployment)11 IncidentStatistics (org.camunda.bpm.engine.management.IncidentStatistics)9 Test (org.junit.Test)9 HashMap (java.util.HashMap)5 Calendar (java.util.Calendar)1