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;
}
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());
}
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());
}
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());
}
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;
}
Aggregations