public virtual void testQueryAuthenticatedTenantForDeploymentStatistics() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery(); assertThat(query.count(), @is(2L)); ISet <string> tenantIds = collectDeploymentTenantIds(query.list()); assertThat(tenantIds.Count, @is(2)); assertThat(tenantIds, hasItems(null, TENANT_ONE)); }
public virtual void testQueryNoAuthenticatedTenantsForDeploymentStatistics() { identityService.setAuthentication("user", null, null); DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery(); assertThat(query.count(), @is(1L)); ISet <string> tenantIds = collectDeploymentTenantIds(query.list()); assertThat(tenantIds.Count, @is(1)); assertThat(tenantIds.GetEnumerator().next(), @is(nullValue())); }
public virtual void testQueryDisabledTenantCheckForDeploymentStatistics() { processEngineConfiguration.TenantCheckEnabled = false; identityService.setAuthentication("user", null, null); DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery(); assertThat(query.count(), @is(3L)); ISet <string> tenantIds = collectDeploymentTenantIds(query.list()); assertThat(tenantIds.Count, @is(3)); assertThat(tenantIds, hasItems(null, TENANT_ONE, TENANT_TWO)); }
public virtual void testQueryIncludingFailedJobsAndIncidentsWithReadInstancePermissionOnAnyProcessDefinition() { // 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().includeFailedJobs().includeIncidents(); // then IList <DeploymentStatistics> statistics = query.list(); foreach (DeploymentStatistics deploymentStatistics in statistics) { string id = deploymentStatistics.Id; 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"); } } }
// deployment statistics query (including process instances) ///////////////////////////////////////////// public virtual void testQueryWithReadPermissionOnProcessInstance() { // 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); string processInstanceId = startProcessInstanceByKey(TIMER_BOUNDARY_PROCESS_KEY).Id; createGrantAuthorization(PROCESS_INSTANCE, processInstanceId, userId, READ); // when DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery(); // then IList <DeploymentStatistics> statistics = query.list(); foreach (DeploymentStatistics deploymentStatistics in statistics) { string id = deploymentStatistics.Id; if (id.Equals(firstDeploymentId)) { verifyStatisticsResult(deploymentStatistics, 0, 0, 0); } else if (id.Equals(secondDeploymentId)) { verifyStatisticsResult(deploymentStatistics, 0, 0, 0); } else if (id.Equals(thirdDeploymentId)) { verifyStatisticsResult(deploymentStatistics, 1, 0, 0); } else { fail("Unexpected deployment"); } } }
public virtual void testQueryWithReadPermissionOnAnyDeployment() { // given createGrantAuthorization(DEPLOYMENT, ANY, userId, READ); // when DeploymentStatisticsQuery query = managementService.createDeploymentStatisticsQuery(); // then verifyQueryResults(query, 3); IList <DeploymentStatistics> result = query.list(); foreach (DeploymentStatistics statistics in result) { verifyStatisticsResult(statistics, 0, 0, 0); } }
public virtual void testDeploymentStatisticsIgnoreReadInstance() { // given processEngineConfiguration.DisabledPermissions = Arrays.asList(READ_INSTANCE.name()); runtimeService.startProcessInstanceByKey("timerBoundaryProcess"); authRule.enableAuthorization(USER_ID); // when DeploymentStatisticsQuery query = engineRule.ManagementService.createDeploymentStatisticsQuery(); // then IList <DeploymentStatistics> statistics = query.list(); foreach (DeploymentStatistics deploymentStatistics in statistics) { assertEquals("Instances", 1, deploymentStatistics.Instances); assertEquals("Failed Jobs", 0, deploymentStatistics.FailedJobs); IList <IncidentStatistics> incidentStatistics = deploymentStatistics.IncidentStatistics; assertTrue("Incidents supposed to be empty", incidentStatistics.Count == 0); } }