@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);
	}
}