Search in sources :

Example 86 with IdmBulkActionDto

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);
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 87 with IdmBulkActionDto

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);
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 88 with IdmBulkActionDto

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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) GuardedString(eu.bcvsolutions.idm.core.security.api.domain.GuardedString) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmAutomaticRoleAttributeDto(eu.bcvsolutions.idm.core.api.dto.IdmAutomaticRoleAttributeDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test) ChangeIdentityPermissionTest(eu.bcvsolutions.idm.core.workflow.permissions.ChangeIdentityPermissionTest)

Example 89 with IdmBulkActionDto

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);
    }
}
Also used : DataFilter(eu.bcvsolutions.idm.core.api.dto.filter.DataFilter) IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmConfigurationDto(eu.bcvsolutions.idm.core.api.dto.IdmConfigurationDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 90 with IdmBulkActionDto

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());
    }
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) HashMap(java.util.HashMap) IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) AbstractDto(eu.bcvsolutions.idm.core.api.dto.AbstractDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Aggregations

IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)262 Test (org.junit.Test)238 AbstractBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractBulkActionTest)220 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)142 UUID (java.util.UUID)129 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)98 HashMap (java.util.HashMap)72 IdmIdentityContractDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto)64 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)52 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)41 IdmIdentityRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto)38 ResultModels (eu.bcvsolutions.idm.core.api.dto.ResultModels)35 HashSet (java.util.HashSet)33 List (java.util.List)29 Autowired (org.springframework.beans.factory.annotation.Autowired)26 IdmFormAttributeDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto)24 After (org.junit.After)21 Assert (org.junit.Assert)21 Before (org.junit.Before)21 IdmTreeNodeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto)20