use of org.camunda.bpm.engine.management.DeploymentStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testQueryNoAuthenticatedTenantsForDeploymentStatistics.
public void testQueryNoAuthenticatedTenantsForDeploymentStatistics() {
identityService.setAuthentication("user", null, null);
DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
assertThat(query.count(), is(1L));
Set<String> tenantIds = collectDeploymentTenantIds(query.list());
assertThat(tenantIds.size(), is(1));
assertThat(tenantIds.iterator().next(), is(nullValue()));
}
use of org.camunda.bpm.engine.management.DeploymentStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testQueryAuthenticatedTenantForDeploymentStatistics.
public void testQueryAuthenticatedTenantForDeploymentStatistics() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery();
assertThat(query.count(), is(2L));
Set<String> tenantIds = collectDeploymentTenantIds(query.list());
assertThat(tenantIds.size(), is(2));
assertThat(tenantIds, hasItems(null, TENANT_ONE));
}
use of org.camunda.bpm.engine.management.DeploymentStatisticsQuery in project camunda-bpm-platform by camunda.
the class DeploymentStatisticsAuthorizationTest method testQueryIncludingFailedJobsAndIncidentsWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingFailedJobsAndIncidentsWithReadPermissionOnAnyProcessInstance() {
// 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_INSTANCE, ANY, userId, READ);
// when
DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery().includeFailedJobs().includeIncidents();
// then
List<DeploymentStatistics> statistics = query.list();
for (DeploymentStatistics deploymentStatistics : statistics) {
String id = deploymentStatistics.getId();
if (id.equals(firstDeploymentId)) {
verifyStatisticsResult(deploymentStatistics, 3, 3, 3);
} else if (id.equals(secondDeploymentId)) {
verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
} else if (id.equals(thirdDeploymentId)) {
verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
} else {
fail("Unexpected deployment");
}
}
}
use of org.camunda.bpm.engine.management.DeploymentStatisticsQuery in project camunda-bpm-platform by camunda.
the class DeploymentStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithReadPermissionOnAnyProcessInstance.
public void testQueryIncludingFailedJobsWithReadPermissionOnAnyProcessInstance() {
// 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_INSTANCE, ANY, userId, READ);
// 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, 3, 0, 0);
} else if (id.equals(thirdDeploymentId)) {
verifyStatisticsResult(deploymentStatistics, 3, 0, 0);
} else {
fail("Unexpected deployment");
}
}
}
use of org.camunda.bpm.engine.management.DeploymentStatisticsQuery in project camunda-bpm-platform by camunda.
the class DeploymentStatisticsAuthorizationTest method testQueryIncludingFailedJobsWithReadPermissionOnProcessInstance.
// deployment statistics query (including failed jobs) /////////////////////////////////////////////
public void testQueryIncludingFailedJobsWithReadPermissionOnProcessInstance() {
// 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().includeFailedJobs();
// then
List<DeploymentStatistics> statistics = query.list();
for (DeploymentStatistics deploymentStatistics : statistics) {
String id = deploymentStatistics.getId();
if (id.equals(firstDeploymentId)) {
verifyStatisticsResult(deploymentStatistics, 1, 1, 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");
}
}
}
Aggregations