Search in sources :

Example 6 with IdmExportImportDto

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());
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmExportImportDto(eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto) IdmAuthorizationPolicyDto(eu.bcvsolutions.idm.core.api.dto.IdmAuthorizationPolicyDto) AbstractExportBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest) Test(org.junit.Test)

Example 7 with IdmExportImportDto

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);
}
Also used : IdmExportImportDto(eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractExportBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest) Test(org.junit.Test)

Example 8 with IdmExportImportDto

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());
}
Also used : IdmExportImportDto(eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractExportBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest) Test(org.junit.Test)

Example 9 with IdmExportImportDto

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());
}
Also used : IdmExportImportDto(eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractExportBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest) Test(org.junit.Test)

Example 10 with IdmExportImportDto

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());
}
Also used : SysProvisioningBreakRecipientDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakRecipientDto) IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) IdmExportImportDto(eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto) SysProvisioningBreakConfigDto(eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractExportBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest) Test(org.junit.Test)

Aggregations

IdmExportImportDto (eu.bcvsolutions.idm.core.api.dto.IdmExportImportDto)31 AbstractExportBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractExportBulkActionTest)18 Test (org.junit.Test)18 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)14 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)8 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)7 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)5 SysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncConfigDto)4 ResultCodeException (eu.bcvsolutions.idm.core.api.exception.ResultCodeException)4 IdmAttachmentDto (eu.bcvsolutions.idm.core.ecm.api.dto.IdmAttachmentDto)4 SysProvisioningBreakConfigDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakConfigDto)3 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)3 Path (java.nio.file.Path)3 Transactional (org.springframework.transaction.annotation.Transactional)3 SysProvisioningBreakRecipientDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningBreakRecipientDto)2 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)2 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)2 IdmTreeTypeDto (eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto)2 ImportContext (eu.bcvsolutions.idm.core.api.dto.ImportContext)2 DefaultEventResult (eu.bcvsolutions.idm.core.api.event.DefaultEventResult)2