use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class DefaultBulkActionManagerIntegrationTest method testActionWithoutFilterAndWithoutSelection.
@Test(expected = ResultCodeException.class)
public void testActionWithoutFilterAndWithoutSelection() {
IdmBulkActionDto dto = findBulkAction(IdmIdentity.class, MockBulkAction.NAME);
//
manager.processAction(dto);
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class DefaultBulkActionManagerIntegrationTest method testActionWithoutFilterAndWithSelectionAllImlemented.
@Test
public void testActionWithoutFilterAndWithSelectionAllImlemented() {
IdmBulkActionDto dto = findBulkAction(IdmIdentity.class, MockBulkActionShowWithoutSelection.class.getCanonicalName());
//
manager.processAction(dto);
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class IdentityRoleByIdentityDeduplicationBulkActionTest method testTwoAutomatic.
@Test
public void testTwoAutomatic() {
String automaticRoleValue = "test" + System.currentTimeMillis();
IdmIdentityDto identity = getHelper().createIdentity(new GuardedString());
identity.setDescription(automaticRoleValue);
identity.setTitleAfter(automaticRoleValue);
identity = identityService.save(identity);
IdmRoleDto role = getHelper().createRole();
IdmAutomaticRoleAttributeDto automaticRoleOne = getHelper().createAutomaticRole(role.getId());
getHelper().createAutomaticRoleRule(automaticRoleOne.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY, IdmIdentity_.description.getName(), null, automaticRoleValue);
IdmAutomaticRoleAttributeDto automaticRoleTwo = getHelper().createAutomaticRole(role.getId());
getHelper().createAutomaticRoleRule(automaticRoleTwo.getId(), AutomaticRoleAttributeRuleComparison.EQUALS, AutomaticRoleAttributeRuleType.IDENTITY, IdmIdentity_.titleAfter.getName(), null, automaticRoleValue);
getHelper().recalculateAutomaticRoleByAttribute(automaticRoleOne.getId());
getHelper().recalculateAutomaticRoleByAttribute(automaticRoleTwo.getId());
List<IdmIdentityRoleDto> roles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(2, roles.size());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmIdentity.class, IdentityRoleByIdentityDeduplicationBulkAction.NAME);
bulkAction.setIdentifiers(Sets.newHashSet(identity.getId()));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, 1l, null, null);
roles = identityRoleService.findAllByIdentity(identity.getId());
assertEquals(2, roles.size());
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class ConfigurationDeleteBulkActionIntegrationTest method processBulkActionByFilter.
@Test
public void processBulkActionByFilter() {
List<IdmConfigurationDto> configs = createConfigurationItems(testCount);
DataFilter filter = new DataFilter(IdmConfigurationDto.class);
filter.setText(commonNameRoot);
List<IdmConfigurationDto> checkConfigs = configurationService.find(filter, null).getContent();
assertEquals(testCount, checkConfigs.size());
IdmBulkActionDto bulkAction = this.findBulkAction(IdmConfiguration.class, ConfigurationDeleteBulkAction.NAME);
bulkAction.setTransformedFilter(filter);
bulkAction.setFilter(toMap(filter));
IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
checkResultLrt(processAction, (long) testCount, null, null);
for (IdmConfigurationDto config : configs) {
IdmConfigurationDto dto = configurationService.get(config.getId());
assertNull(dto);
}
}
use of eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto in project CzechIdMng by bcvsolutions.
the class IdentityAddContractGuaranteeBulkActionTest method processByIdsNoGuaranteesMoreContracts.
@Test
public void processByIdsNoGuaranteesMoreContracts() {
List<IdmIdentityDto> guarantees = this.createIdentities(3);
IdmIdentityDto employee = getHelper().createIdentity();
IdmIdentityContractDto contract1 = getHelper().getPrimeContract(employee);
IdmIdentityContractDto contract2 = getHelper().createContract(employee);
List<IdmIdentityContractDto> contracts = Arrays.asList(contract1, contract2);
IdmBulkActionDto bulkAction = this.findBulkAction(IdmIdentity.class, IdentityAddContractGuaranteeBulkAction.NAME);
Set<UUID> ids = this.getIdFromList(Arrays.asList(employee));
bulkAction.setIdentifiers(ids);
Map<String, Object> properties = new HashMap<>();
List<String> uuidStrings = guarantees.stream().map(AbstractDto::getId).map(Object::toString).collect(Collectors.toList());
properties.put(IdentityAddContractGuaranteeBulkAction.PROPERTY_NEW_GUARANTEE, uuidStrings);
bulkAction.setProperties(properties);
bulkActionManager.processAction(bulkAction);
// test guarantes on all contracts
for (IdmIdentityContractDto contract : contracts) {
// expected number of guarantees
List<IdmContractGuaranteeDto> assigned = getGuaranteesForContract(contract.getId());
Assert.assertEquals(guarantees.size(), assigned.size());
// none of expected guarantees are missing in created cintractGuarantee bindings
Assert.assertTrue(isContractGuarantee(contract, guarantees).isEmpty());
}
}
Aggregations