Search in sources :

Example 96 with SysSystemMappingDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto in project CzechIdMng by bcvsolutions.

the class PerformanceAccountManagementTest method initIdentityData.

private SysSystemDto initIdentityData() {
    // create test system
    SysSystemDto system = helper.createSystem(TestResource.TABLE_NAME);
    Assert.assertNotNull(system);
    // generate schema for system
    List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
    // Create mapping
    SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
    syncSystemMapping.setName("default_" + System.currentTimeMillis());
    syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
    syncSystemMapping.setOperationType(SystemOperationType.PROVISIONING);
    syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
    final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
    createIdentityMapping(system, syncMapping);
    return system;
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 97 with SysSystemMappingDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto in project CzechIdMng by bcvsolutions.

the class PerformanceAccountManagementTest method testAcmPerformance200WithoutRequest.

@Ignore
@Test
@Transactional
public void testAcmPerformance200WithoutRequest() {
    SysSystemDto system = initIdentityData();
    Assert.assertNotNull(system);
    SysSystemMappingDto mapping = systemMappingService.findProvisioningMapping(system.getId(), SystemEntityType.IDENTITY);
    Assert.assertNotNull(mapping);
    mapping = systemMappingService.save(mapping);
    IdmIdentityDto identity = helper.createIdentity();
    AccIdentityAccountFilter roleAccountFilter = new AccIdentityAccountFilter();
    roleAccountFilter.setEntityId(identity.getId());
    roleAccountFilter.setOwnership(Boolean.TRUE);
    roleAccountFilter.setSystemId(system.getId());
    List<AccIdentityAccountDto> identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    // None role assigned
    Assert.assertEquals(0, identityAccounts.size());
    List<IdmRoleDto> roles = this.createRolesWithSystem(system, 200);
    UUID primeContract = identityContractService.getPrimeContract(identity.getId()).getId();
    Date startAcm = new Date();
    roles.forEach(role -> {
        IdmIdentityRoleDto identityRole = new IdmIdentityRoleDto();
        identityRole.setIdentityContract(primeContract);
        identityRole.setRole(role.getId());
        identityRole = identityRoleService.save(identityRole);
        // Call hard hibernate session flush and clear
        if (getHibernateSession().isOpen()) {
            getHibernateSession().flush();
            getHibernateSession().clear();
        }
    });
    Date endAcm = new Date();
    System.out.println("testAcmPerformance200 - ACM duration: " + (endAcm.getTime() - startAcm.getTime()));
    identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(200, identityAccounts.size());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) UUID(java.util.UUID) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Date(java.util.Date) Ignore(org.junit.Ignore) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 98 with SysSystemMappingDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto in project CzechIdMng by bcvsolutions.

the class PerformanceAccountManagementTest method testAcmPerformance400.

@Ignore
@Test
@Transactional
public void testAcmPerformance400() {
    SysSystemDto system = initIdentityData();
    Assert.assertNotNull(system);
    SysSystemMappingDto mapping = systemMappingService.findProvisioningMapping(system.getId(), SystemEntityType.IDENTITY);
    Assert.assertNotNull(mapping);
    mapping = systemMappingService.save(mapping);
    IdmIdentityDto identity = helper.createIdentity();
    AccIdentityAccountFilter roleAccountFilter = new AccIdentityAccountFilter();
    roleAccountFilter.setEntityId(identity.getId());
    roleAccountFilter.setOwnership(Boolean.TRUE);
    roleAccountFilter.setSystemId(system.getId());
    List<AccIdentityAccountDto> identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    // None role assigned
    Assert.assertEquals(0, identityAccounts.size());
    List<IdmRoleDto> roles = this.createRolesWithSystem(system, 400);
    IdmIdentityContractDto primeContract = identityContractService.getPrimeContract(identity.getId());
    Date startAcm = new Date();
    IdmRoleRequestDto request = helper.createRoleRequest(primeContract, roles.toArray(new IdmRoleDto[0]));
    helper.executeRequest(request, false, true);
    Date endAcm = new Date();
    System.out.println("testAcmPerformance400 - ACM duration: " + (endAcm.getTime() - startAcm.getTime()));
    identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(400, identityAccounts.size());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Date(java.util.Date) Ignore(org.junit.Ignore) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 99 with SysSystemMappingDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto in project CzechIdMng by bcvsolutions.

the class PerformanceAccountManagementTest method testDeletePerformance200.

@Ignore
@Test
@Transactional
public void testDeletePerformance200() {
    SysSystemDto system = initIdentityData();
    Assert.assertNotNull(system);
    SysSystemMappingDto mapping = systemMappingService.findProvisioningMapping(system.getId(), SystemEntityType.IDENTITY);
    Assert.assertNotNull(mapping);
    mapping = systemMappingService.save(mapping);
    IdmIdentityDto identity = helper.createIdentity();
    AccIdentityAccountFilter roleAccountFilter = new AccIdentityAccountFilter();
    roleAccountFilter.setEntityId(identity.getId());
    roleAccountFilter.setOwnership(Boolean.TRUE);
    List<AccIdentityAccountDto> identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    List<IdmRoleDto> roles = this.createRolesWithSystem(system, 200);
    IdmIdentityContractDto primeContract = identityContractService.getPrimeContract(identity.getId());
    Date startAcm = new Date();
    IdmRoleRequestDto request = helper.createRoleRequest(primeContract, roles.toArray(new IdmRoleDto[0]));
    helper.executeRequest(request, false, true);
    Date endAcm = new Date();
    System.out.println("testDeletePerformance200 - ACM duration: " + (endAcm.getTime() - startAcm.getTime()));
    identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(200, identityAccounts.size());
    // Delete
    IdmIdentityRoleFilter identityRoleFilter = new IdmIdentityRoleFilter();
    identityRoleFilter.setIdentityContractId(primeContract.getId());
    List<IdmIdentityRoleDto> identityRoles = identityRoleService.find(identityRoleFilter, null).getContent();
    IdmRoleRequestDto requestDel = helper.createRoleRequest(identity);
    identityRoles.forEach(identityRole -> {
        IdmConceptRoleRequestDto conceptRoleRequest = new IdmConceptRoleRequestDto();
        conceptRoleRequest.setRoleRequest(requestDel.getId());
        conceptRoleRequest.setIdentityContract(primeContract.getId());
        conceptRoleRequest.setIdentityRole(identityRole.getId());
        conceptRoleRequest.setOperation(ConceptRoleRequestOperation.REMOVE);
        conceptRoleRequestService.save(conceptRoleRequest);
    });
    Date startAcmDelete = new Date();
    helper.executeRequest(requestDel, false, true);
    Date endAcmDelete = new Date();
    System.out.println("testDeletePerformance200 - Delete duration: " + (endAcmDelete.getTime() - startAcmDelete.getTime()));
    identityAccounts = identityAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(0, identityAccounts.size());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmIdentityRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityRoleFilter) AccIdentityAccountDto(eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Date(java.util.Date) AccIdentityAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter) IdmConceptRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmConceptRoleRequestDto) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityRoleDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmRoleRequestDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleRequestDto) Ignore(org.junit.Ignore) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test) Transactional(org.springframework.transaction.annotation.Transactional)

Example 100 with SysSystemMappingDto

use of eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto in project CzechIdMng by bcvsolutions.

the class DefaultAccMultipleSystemAuthenticatorIntegrationTest method createSystem.

/**
 * Create system with mapping and if exists parametr uidSuffix add this suffix into __NAME__ transforamtion to.
 * This behavior can help for create different account for same system and one identity.
 *
 * @param uidSuffix
 * @return
 */
private SysSystemDto createSystem(String uidSuffix) {
    SysSystemDto system = getHelper().createSystem(TestResource.TABLE_NAME, getHelper().createName());
    SysSystemMappingDto mapping = getHelper().createMapping(system);
    if (uidSuffix != null) {
        List<SysSystemAttributeMappingDto> attributes = systemAttributeMappingService.findBySystemMapping(mapping);
        for (SysSystemAttributeMappingDto attribute : attributes) {
            if (TestHelper.ATTRIBUTE_MAPPING_NAME.equals(attribute.getName())) {
                attribute.setTransformToResourceScript("return attributeValue + " + uidSuffix + ";");
                attribute.setAuthenticationAttribute(true);
                systemAttributeMappingService.save(attribute);
            }
        }
    }
    return system;
}
Also used : SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)359 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)269 Test (org.junit.Test)208 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)180 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)172 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)134 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)106 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)95 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)90 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)89 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)80 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)70 UUID (java.util.UUID)60 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)58 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)56 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)42 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)38 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)38 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)36 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)36