ProcessAllAutomaticRoleByAttributeTaskExecutor extends AbstractSchedulableTaskExecutor<Boolean> { @Override public String getName() { return TASK_NAME; }  @Override String getName(); @Override Boolean process(); @Override boolean isRecoverable(); static final String TASK_NAME; }
@Test public void testAssignRoles() { ProcessAllAutomaticRoleByAttributeTaskExecutor autoRolecalculation = new ProcessAllAutomaticRoleByAttributeTaskExecutor(); longRunningTaskManager.executeSync(autoRolecalculation); String automaticRoleValue = this.getHelper().createName(); IdmAutomaticRoleAttributeDto automaticRole = this.getHelper().createAutomaticRole(this.getHelper().createRole().getId()); this.getHelper().createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY, IdmIdentity_.description.getName(), null, automaticRoleValue); List<IdmIdentityDto> identities = new ArrayList<IdmIdentityDto>(); for (int index = 0; index < 154; index++) { IdmIdentityDto identity = this.getHelper().createIdentity((GuardedString)null); identities.add(identity); identity.setDescription(automaticRoleValue); identity = saveIdentityWithouRecalculation(identity); checkIdentityRoles(identity, 0, null); } autoRolecalculation = new ProcessAllAutomaticRoleByAttributeTaskExecutor(); longRunningTaskManager.executeSync(autoRolecalculation); for (IdmIdentityDto identity : identities) { checkIdentityRoles(identity, 1, automaticRole.getId()); } }
@Test public void testRemoveRoles() { ProcessAllAutomaticRoleByAttributeTaskExecutor autoRolecalculation = new ProcessAllAutomaticRoleByAttributeTaskExecutor(); longRunningTaskManager.executeSync(autoRolecalculation); String automaticRoleValue = this.getHelper().createName(); IdmAutomaticRoleAttributeDto automaticRole = this.getHelper().createAutomaticRole(this.getHelper().createRole().getId()); this.getHelper().createAutomaticRoleRule(automaticRole.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY, IdmIdentity_.description.getName(), null, automaticRoleValue); List<IdmIdentityDto> identities = new ArrayList<IdmIdentityDto>(); for (int index = 0; index < 134; index++) { IdmIdentityDto identity = this.getHelper().createIdentity((GuardedString)null); identities.add(identity); identity.setDescription(automaticRoleValue); identityService.save(identity); identity = identityService.save(identity); checkIdentityRoles(identity, 1, automaticRole.getId()); } for (IdmIdentityDto identity : identities) { identity.setDescription(null); identity = saveIdentityWithouRecalculation(identity); checkIdentityRoles(identity, 1, automaticRole.getId()); } autoRolecalculation = new ProcessAllAutomaticRoleByAttributeTaskExecutor(); longRunningTaskManager.executeSync(autoRolecalculation); for (IdmIdentityDto identity : identities) { checkIdentityRoles(identity, 0, null); } }