use of eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto in project CzechIdMng by bcvsolutions.
the class RoleExportBulkActionIntegrationTest method testExportAndImportRolePolicy.
@Test
public void testExportAndImportRolePolicy() {
IdmRoleDto role = createRole();
IdmAuthorizationPolicyDto policy = this.getHelper().createAuthorizationPolicy(role.getId(), CoreGroupPermission.SCHEDULER, IdmLongRunningTask.class, SelfLongRunningTaskEvaluator.class, IdmBasePermission.READ);
// Make export, upload and import
IdmExportImportDto importBatch = executeExportAndImport(role, RoleExportBulkAction.NAME, ImmutableMap.of(EXECUTE_BEFORE_DTO_DELETE, this::deleteAllSubroles));
role = roleService.get(role.getId());
Assert.assertNotNull(role);
List<IdmAuthorizationPolicyDto> policies = this.findPolicy(role);
Assert.assertEquals(1, policies.size());
Assert.assertEquals(policy.getId(), policies.get(0).getId());
this.getHelper().createAuthorizationPolicy(role.getId(), CoreGroupPermission.SCHEDULER, IdmLongRunningTask.class, SelfLongRunningTaskEvaluator.class, IdmBasePermission.ADMIN);
policies = this.findPolicy(role);
Assert.assertEquals(2, policies.size());
// Execute import (check authoritative mode)
importBatch = importManager.executeImport(importBatch, false);
Assert.assertNotNull(importBatch);
Assert.assertEquals(ExportImportType.IMPORT, importBatch.getType());
Assert.assertEquals(OperationState.EXECUTED, importBatch.getResult().getState());
// Second policy had to be deleted!
policies = this.findPolicy(role);
Assert.assertEquals(1, policies.size());
Assert.assertEquals(policy.getId(), policies.get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto in project CzechIdMng by bcvsolutions.
the class SystemExportBulkActionIntegrationTest method testExportAndImportSync.
@Test
public void testExportAndImportSync() {
SysSystemDto system = createSystem();
List<SysSystemMappingDto> mappings = findMappings(system);
Assert.assertEquals(1, mappings.size());
SysSystemMappingDto originalMapping = mappings.get(0);
List<SysSystemAttributeMappingDto> originalAttributes = findAttributeMappings(system);
SysSystemAttributeMappingDto originalAttribute = originalAttributes.get(0);
SysSyncConfigDto originalSync = new SysSyncConfigDto();
originalSync.setSystemMapping(originalMapping.getId());
originalSync.setName(getHelper().createName());
originalSync.setCorrelationAttribute(originalAttribute.getId());
originalSync = (SysSyncConfigDto) synchronizationConfigService.save(originalSync);
// Make export, upload, delete system and import
IdmExportImportDto importBatch = executeExportAndImport(system, SystemExportBulkAction.NAME);
system = systemService.get(system.getId());
Assert.assertNotNull(system);
mappings = findMappings(system);
List<SysSystemAttributeMappingDto> attributes = findAttributeMappings(system);
Assert.assertEquals(1, mappings.size());
SysSystemMappingDto mapping = mappings.get(0);
Assert.assertEquals(originalMapping.getId(), mapping.getId());
Assert.assertEquals(originalAttributes.size(), attributes.size());
// Create redundant sync
SysSyncConfigDto redundantSync = new SysSyncConfigDto();
redundantSync.setSystemMapping(originalMapping.getId());
redundantSync.setName(getHelper().createName());
redundantSync.setCorrelationAttribute(originalAttribute.getId());
redundantSync = (SysSyncConfigDto) synchronizationConfigService.save(redundantSync);
// Execute import (check authoritative mode)
importBatch = importManager.executeImport(importBatch, false);
Assert.assertNotNull(importBatch);
Assert.assertEquals(ExportImportType.IMPORT, importBatch.getType());
Assert.assertEquals(OperationState.EXECUTED, importBatch.getResult().getState());
// Redundant sync had to be deleted!
redundantSync = (SysSyncConfigDto) synchronizationConfigService.get(redundantSync.getId());
Assert.assertNull(redundantSync);
}
use of eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto in project CzechIdMng by bcvsolutions.
the class SystemExportBulkActionIntegrationTest method testExportAndImportSystemSchema.
@Test
public void testExportAndImportSystemSchema() {
SysSystemDto system = createSystem();
List<SysSchemaObjectClassDto> schemas = findSchemas(system);
Assert.assertEquals(1, schemas.size());
SysSchemaObjectClassDto originalSchema = schemas.get(0);
// Make export, upload and import
IdmExportImportDto importBatch = executeExportAndImport(system, SystemExportBulkAction.NAME);
system = systemService.get(system.getId());
Assert.assertNotNull(system);
schemas = findSchemas(system);
Assert.assertEquals(1, schemas.size());
SysSchemaObjectClassDto schema = new SysSchemaObjectClassDto();
schema.setObjectClassName(getHelper().createName());
schema.setSystem(system.getId());
schema = schemaObjectClassService.save(schema);
schemas = this.findSchemas(system);
Assert.assertEquals(2, schemas.size());
// Execute import (check authoritative mode)
importBatch = importManager.executeImport(importBatch, false);
Assert.assertNotNull(importBatch);
Assert.assertEquals(ExportImportType.IMPORT, importBatch.getType());
Assert.assertEquals(OperationState.EXECUTED, importBatch.getResult().getState());
// Second incompatibility had to be deleted!
schemas = this.findSchemas(system);
Assert.assertEquals(1, schemas.size());
Assert.assertEquals(originalSchema.getId(), schemas.get(0).getId());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto in project CzechIdMng by bcvsolutions.
the class SystemExportBulkActionIntegrationTest method testExportAndImportSyncExcludedToken.
@Test
public void testExportAndImportSyncExcludedToken() {
SysSystemDto system = createSystem();
List<SysSystemMappingDto> mappings = findMappings(system);
Assert.assertEquals(1, mappings.size());
SysSystemMappingDto originalMapping = mappings.get(0);
List<SysSystemAttributeMappingDto> originalAttributes = findAttributeMappings(system);
SysSystemAttributeMappingDto originalAttribute = originalAttributes.get(0);
SysSyncConfigDto originalSync = new SysSyncConfigDto();
originalSync.setSystemMapping(originalMapping.getId());
originalSync.setName(getHelper().createName());
originalSync.setCorrelationAttribute(originalAttribute.getId());
originalSync.setToken(helper.createName());
originalSync = (SysSyncConfigDto) synchronizationConfigService.save(originalSync);
// Make export, upload, delete system and import
IdmExportImportDto importBatch = executeExportAndImport(system, SystemExportBulkAction.NAME);
system = systemService.get(system.getId());
Assert.assertNotNull(system);
// New token
originalSync.setToken(helper.createName());
originalSync = (SysSyncConfigDto) synchronizationConfigService.save(originalSync);
// Execute import (check excluded token)
importBatch = importManager.executeImport(importBatch, false);
Assert.assertNotNull(importBatch);
Assert.assertEquals(ExportImportType.IMPORT, importBatch.getType());
Assert.assertEquals(OperationState.EXECUTED, importBatch.getResult().getState());
SysSyncConfigDto currentSync = (SysSyncConfigDto) synchronizationConfigService.get(originalSync.getId());
// Token was excluded. Value in current sync was not changed.
Assert.assertEquals(originalSync.getToken(), currentSync.getToken());
}
use of eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto in project CzechIdMng by bcvsolutions.
the class SystemExportBulkActionIntegrationTest method testExportAndImportBreakRoleAdvancedPairing.
@Test
public void testExportAndImportBreakRoleAdvancedPairing() {
SysSystemDto system = createSystem();
SysProvisioningBreakConfigDto originalBreak = new SysProvisioningBreakConfigDto();
originalBreak.setSystem(system.getId());
originalBreak.setOperationType(ProvisioningEventType.CREATE);
originalBreak.setPeriod(10l);
originalBreak = provisioningBreakService.save(originalBreak);
IdmRoleDto originalRecipient = getHelper().createRole();
SysProvisioningBreakRecipientDto breakRecipient = new SysProvisioningBreakRecipientDto();
breakRecipient.setRole(originalRecipient.getId());
breakRecipient.setBreakConfig(originalBreak.getId());
breakRecipient = provisioningBreakRecipientService.save(breakRecipient);
// Make export, upload, delete system and import
IdmExportImportDto importBatch = executeExportAndImport(system, SystemExportBulkAction.NAME);
system = systemService.get(system.getId());
Assert.assertNotNull(system);
List<SysProvisioningBreakConfigDto> breaks = findBreaks(system);
Assert.assertEquals(1, breaks.size());
Assert.assertEquals(originalBreak.getId(), breaks.get(0).getId());
breakRecipient = provisioningBreakRecipientService.get(breakRecipient.getId());
Assert.assertNotNull(breakRecipient);
Assert.assertEquals(originalRecipient.getId(), breakRecipient.getRole());
// Delete original recipient and create new with same code
roleService.delete(originalRecipient);
IdmRoleDto newRecipient = getHelper().createRole(originalRecipient.getCode());
// Execute import (check advanced pairing)
importBatch = importManager.executeImport(importBatch, false);
Assert.assertNotNull(importBatch);
Assert.assertEquals(ExportImportType.IMPORT, importBatch.getType());
Assert.assertEquals(OperationState.EXECUTED, importBatch.getResult().getState());
breakRecipient = provisioningBreakRecipientService.get(breakRecipient.getId());
Assert.assertNotNull(breakRecipient);
Assert.assertEquals(newRecipient.getId(), breakRecipient.getRole());
}
Aggregations