Search in sources :

Example 1 with DeploymentStatisticsQuery

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

the class DeploymentStatisticsAuthorizationTest method testQueryIncludingIncidentsWithReadPermissionOnProcessInstance.

// deployment statistics query (including incidents) /////////////////////////////////////////////
public void testQueryIncludingIncidentsWithReadPermissionOnProcessInstance() {
    // given
    createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY);
    String processInstanceId = startProcessAndExecuteJob(ONE_INCIDENT_PROCESS_KEY).getId();
    createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ);
    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);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery().includeIncidents();
    // then
    List<DeploymentStatistics> statistics = query.list();
    for (DeploymentStatistics deploymentStatistics : statistics) {
        String id = deploymentStatistics.getId();
        if (id.equals(firstDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 1, 0, 1);
        } 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)

Example 2 with DeploymentStatisticsQuery

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

the class DeploymentStatisticsAuthorizationTest method testQueryIncludingIncidentsWithReadInstancePermissionOnProcessDefinition.

public void testQueryIncludingIncidentsWithReadInstancePermissionOnProcessDefinition() {
    // 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().includeIncidents();
    // then
    List<DeploymentStatistics> statistics = query.list();
    for (DeploymentStatistics deploymentStatistics : statistics) {
        String id = deploymentStatistics.getId();
        if (id.equals(firstDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 3);
        } 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)

Example 3 with DeploymentStatisticsQuery

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

the class DeploymentStatisticsAuthorizationTest method testQueryWithReadPermissionOnAnyDeployment.

public void testQueryWithReadPermissionOnAnyDeployment() {
    // given
    createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
    // then
    verifyQueryResults(query, 3);
    List<DeploymentStatistics> result = query.list();
    for (DeploymentStatistics statistics : result) {
        verifyStatisticsResult(statistics, 0, 0, 0);
    }
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics)

Example 4 with DeploymentStatisticsQuery

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

the class DeploymentStatisticsAuthorizationTest method testQueryWithReadInstancePermissionOnAnyProcessDefinition.

public void testQueryWithReadInstancePermissionOnAnyProcessDefinition() {
    // 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, ANY, userId, READ_INSTANCE);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
    // then
    List<DeploymentStatistics> statistics = query.list();
    for (DeploymentStatistics deploymentStatistics : statistics) {
        String id = deploymentStatistics.getId();
        if (id.equals(firstDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
        } else if (id.equals(secondDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
        } else if (id.equals(thirdDeploymentId)) {
            verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
        } else {
            fail("Unexpected deployment");
        }
    }
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery) DeploymentStatistics(org.camunda.bpm.engine.management.DeploymentStatistics)

Example 5 with DeploymentStatisticsQuery

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

the class DeploymentStatisticsAuthorizationTest method testQueryWithMultiple.

public void testQueryWithMultiple() {
    // given
    createGrantAuthorization(DEPLOYMENT, firstDeploymentId, userId, READ);
    createGrantAuthorization(DEPLOYMENT, ANY, userId, READ);
    // when
    DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
    // then
    verifyQueryResults(query, 3);
}
Also used : DeploymentStatisticsQuery(org.camunda.bpm.engine.management.DeploymentStatisticsQuery)

Aggregations

DeploymentStatisticsQuery (org.camunda.bpm.engine.management.DeploymentStatisticsQuery)24 DeploymentStatistics (org.camunda.bpm.engine.management.DeploymentStatistics)18