Search in sources :

Example 6 with IdmScriptFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter in project CzechIdMng by bcvsolutions.

the class ScriptBackupBulkActionIntegrationTest method processBulkActionByFilter.

@Test
public void processBulkActionByFilter() {
    IdmScriptDto script1 = scriptService.getByCode(TEST_SCRIPT_CODE_1);
    Set<UUID> scripts = new HashSet<UUID>();
    scripts.add(script1.getId());
    script1.setDescription(CHANGED_TEST_DESC);
    script1 = scriptService.save(script1);
    IdmScriptFilter filter = new IdmScriptFilter();
    filter.setCode(TEST_SCRIPT_CODE_1);
    List<IdmScriptDto> checkScripts = scriptService.find(filter, null).getContent();
    assertEquals(1, checkScripts.size());
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmScript.class, ScriptBackupBulkAction.NAME);
    bulkAction.setTransformedFilter(filter);
    bulkAction.setFilter(toMap(filter));
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 1l, null, null);
    // test the file exits and contains set description
    testBackupFileContent(script1, loggedUser.getUsername());
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmScriptFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) UUID(java.util.UUID) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 7 with IdmScriptFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter in project CzechIdMng by bcvsolutions.

the class ScriptDeleteBulkActionIntegrationTest method processBulkActionByFilter.

@Test
public void processBulkActionByFilter() {
    scriptService.init();
    String desc = "script description" + getHelper().createName();
    IdmScriptDto script1 = scriptService.getByCode(TEST_SCRIPT_CODE_1);
    IdmScriptDto script2 = scriptService.getByCode(TEST_SCRIPT_CODE_2);
    IdmScriptDto script3 = scriptService.getByCode(TEST_SCRIPT_CODE_3);
    Set<UUID> scripts = new HashSet<UUID>();
    scripts.add(script1.getId());
    scripts.add(script2.getId());
    script1.setDescription(desc);
    script1 = scriptService.save(script1);
    script2.setDescription(desc);
    script2 = scriptService.save(script2);
    IdmScriptFilter filter = new IdmScriptFilter();
    filter.setDescription(desc);
    List<IdmScriptDto> checkScripts = scriptService.find(filter, null).getContent();
    assertEquals(2, checkScripts.size());
    IdmBulkActionDto bulkAction = this.findBulkAction(IdmScript.class, ScriptDeleteBulkAction.NAME);
    bulkAction.setTransformedFilter(filter);
    bulkAction.setFilter(toMap(filter));
    IdmBulkActionDto processAction = bulkActionManager.processAction(bulkAction);
    checkResultLrt(processAction, 2l, null, null);
    for (UUID id : scripts) {
        IdmScriptDto scriptDto = scriptService.get(id);
        assertNull(scriptDto);
    }
    assertNotNull(scriptService.get(script3.getId()));
}
Also used : IdmBulkActionDto(eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto) IdmScriptFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) UUID(java.util.UUID) HashSet(java.util.HashSet) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 8 with IdmScriptFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter in project CzechIdMng by bcvsolutions.

the class MsAdMappingIdentityAutoAttributesProcessor method createAttributeWithScript.

protected SysSystemAttributeMappingDto createAttributeWithScript(SysSystemMappingDto dto, SysSchemaAttributeDto schemaAttribute, String scriptCode, IdmScriptCategory category, boolean toResource) {
    IdmScriptFilter scriptFilter = new IdmScriptFilter();
    scriptFilter.setCode(scriptCode);
    scriptFilter.setCategory(category);
    IdmScriptDto scriptDto = scriptService.find(scriptFilter, null).getContent().stream().findFirst().orElse(null);
    if (scriptDto != null) {
        String script = this.getPluginExecutors().getPluginFor(toResource ? IdmScriptCategory.TRANSFORM_TO : IdmScriptCategory.TRANSFORM_FROM).generateTemplate(scriptDto);
        if (Strings.isNotBlank(script)) {
            return createAttributeMappingByScriptToResource(dto, schemaAttribute, script, toResource);
        }
    }
    return null;
}
Also used : IdmScriptFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto)

Example 9 with IdmScriptFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationExecutorTest method testSyncRolesCatalogueRemoveUnderMain.

@Test
public void testSyncRolesCatalogueRemoveUnderMain() {
    AbstractSysSyncConfigDto syncConfigCustom = createSyncConfig();
    SysSystemDto userSystem = helper.createTestResourceSystem(true);
    List<SysSystemMappingDto> userSystemMappings = systemMappingService.findBySystem(userSystem, SystemOperationType.PROVISIONING, SystemEntityType.IDENTITY);
    Assert.assertNotNull(userSystemMappings);
    Assert.assertEquals(1, userSystemMappings.size());
    SysSystemMappingDto userMappingDto = userSystemMappings.get(0);
    // Switch to the sync.
    userMappingDto.setOperationType(SystemOperationType.SYNCHRONIZATION);
    userMappingDto = systemMappingService.save(userMappingDto);
    List<SysSystemAttributeMappingDto> attributeMappingDtos = schemaAttributeMappingService.findBySystemMapping(userMappingDto);
    SysSystemAttributeMappingDto userEmailAttribute = attributeMappingDtos.stream().filter(attribute -> attribute.getName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_EMAIL)).findFirst().orElse(null);
    Assert.assertNotNull(userEmailAttribute);
    Assert.assertFalse(syncConfigService.isRunning(syncConfigCustom));
    Assert.assertTrue(syncConfigCustom instanceof SysSyncRoleConfigDto);
    SysSyncRoleConfigDto roleConfigDto = (SysSyncRoleConfigDto) syncConfigCustom;
    SysSystemMappingDto systemMappingDto = DtoUtils.getEmbedded(syncConfigCustom, SysSyncConfig_.systemMapping, SysSystemMappingDto.class);
    SysSchemaObjectClassDto schemaObjectClassDto = DtoUtils.getEmbedded(systemMappingDto, SysSystemMapping_.objectClass, SysSchemaObjectClassDto.class);
    UUID roleSystemId = schemaObjectClassDto.getSystem();
    Assert.assertNotNull(roleSystemId);
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(roleSystemId);
    schemaAttributeFilter.setObjectClassId(schemaObjectClassDto.getId());
    SysSchemaAttributeDto schemaAttributeDto = schemaAttributeService.find(schemaAttributeFilter, null).getContent().stream().filter(attribute -> attribute.getName().equalsIgnoreCase("name")).findFirst().orElse(null);
    Assert.assertNotNull(schemaAttributeDto);
    SysSystemDto roleSystemDto = new SysSystemDto();
    roleSystemDto.setId(roleSystemId);
    List<SysSystemMappingDto> roleSystemMappings = systemMappingService.findBySystem(roleSystemDto, SystemOperationType.SYNCHRONIZATION, SystemEntityType.ROLE);
    Assert.assertNotNull(roleSystemMappings);
    Assert.assertEquals(1, roleSystemMappings.size());
    SysSystemMappingDto roleMappingDto = roleSystemMappings.get(0);
    // Use ACC script "resolveRoleCatalogueUnderMainCatalogue".
    IdmScriptFilter scriptFilter = new IdmScriptFilter();
    scriptFilter.setCode("resolveRoleCatalogueUnderMainCatalogue");
    scriptFilter.setCategory(IdmScriptCategory.TRANSFORM_FROM);
    String catalogTransformationScript = null;
    IdmScriptDto scriptDto = scriptService.find(scriptFilter, null).getContent().stream().findFirst().orElse(null);
    if (scriptDto != null) {
        catalogTransformationScript = this.getPluginExecutors().getPluginFor(IdmScriptCategory.TRANSFORM_FROM).generateTemplate(scriptDto);
    }
    Assert.assertNotNull(catalogTransformationScript);
    // Create mapping attribute for get catalog.
    SysSystemAttributeMappingDto roleIdAttribute = new SysSystemAttributeMappingDto();
    roleIdAttribute.setEntityAttribute(true);
    roleIdAttribute.setUid(false);
    roleIdAttribute.setSystemMapping(roleMappingDto.getId());
    roleIdAttribute.setExtendedAttribute(false);
    roleIdAttribute.setIdmPropertyName(RoleSynchronizationExecutor.ROLE_CATALOGUE_FIELD);
    roleIdAttribute.setSchemaAttribute(schemaAttributeDto.getId());
    roleIdAttribute.setTransformFromResourceScript(catalogTransformationScript);
    roleIdAttribute.setName(helper.createName());
    roleIdAttribute = attributeMappingService.save(roleIdAttribute);
    IdmRoleCatalogueDto parentRoleCatalogue = getHelper().createRoleCatalogue();
    IdmRoleCatalogueDto mainRoleCatalogue = getHelper().createRoleCatalogue(getHelper().createName(), parentRoleCatalogue.getId());
    // Enable assign of role catalogue.
    roleConfigDto.setAssignCatalogueSwitch(true);
    roleConfigDto.setRemoveCatalogueRoleSwitch(false);
    roleConfigDto.setMainCatalogueRoleNode(mainRoleCatalogue.getId());
    roleConfigDto.setRemoveCatalogueRoleParentNode(mainRoleCatalogue.getId());
    syncConfigCustom = syncConfigService.save(roleConfigDto);
    // 
    helper.startSynchronization(syncConfigCustom);
    // 
    SysSyncLogFilter logFilter = new SysSyncLogFilter();
    logFilter.setSynchronizationConfigId(syncConfigCustom.getId());
    List<SysSyncLogDto> logs = syncLogService.find(logFilter, null).getContent();
    Assert.assertEquals(1, logs.size());
    SysSyncLogDto log = logs.get(0);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    helper.checkSyncLog(syncConfigCustom, SynchronizationActionType.CREATE_ENTITY, 5, OperationResultType.SUCCESS);
    AccRoleAccountFilter roleAccountFilter = new AccRoleAccountFilter();
    roleAccountFilter.setSystemId(roleSystemId);
    List<AccRoleAccountDto> roleAccountDtos = roleAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(5, roleAccountDtos.size());
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        Assert.assertEquals(1, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        getHelper().createRoleCatalogueRole(roleService.get(roleId), mainRoleCatalogue);
        getHelper().createRoleCatalogueRole(roleService.get(roleId), parentRoleCatalogue);
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        // The role is in 3 catalogs (one from system, two redundant).
        Assert.assertEquals(3, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    // Start a sync again. Remove redundant catalogs is not enabled -> Same results.
    helper.startSynchronization(syncConfigCustom);
    helper.checkSyncLog(syncConfigCustom, SynchronizationActionType.UPDATE_ENTITY, 5, OperationResultType.SUCCESS);
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        // Remove redundant catalogs is not enabled -> Same results: The role is in 3 catalogs (one from system, two redundant).
        Assert.assertEquals(3, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    roleConfigDto.setRemoveCatalogueRoleSwitch(true);
    roleConfigDto.setRemoveCatalogueRoleParentNode(mainRoleCatalogue.getId());
    syncConfigCustom = syncConfigService.save(roleConfigDto);
    // Start a sync again. Remove redundant catalogs is enabled -> Redundant relation from main catalog should be removed.
    helper.startSynchronization(syncConfigCustom);
    helper.checkSyncLog(syncConfigCustom, SynchronizationActionType.UPDATE_ENTITY, 5, OperationResultType.SUCCESS);
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        // Remove redundant catalogs is enabled -> Redundant relation from main catalog should be removed: The role is in 2 catalogs (one from system, one redundant).
        Assert.assertEquals(2, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    roleConfigDto.setRemoveCatalogueRoleSwitch(true);
    roleConfigDto.setRemoveCatalogueRoleParentNode(parentRoleCatalogue.getId());
    syncConfigCustom = syncConfigService.save(roleConfigDto);
    // Start a sync again. Remove redundant catalogs is enabled -> Redundant relation from parent catalog should be removed.
    helper.startSynchronization(syncConfigCustom);
    helper.checkSyncLog(syncConfigCustom, SynchronizationActionType.UPDATE_ENTITY, 5, OperationResultType.SUCCESS);
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        // Remove redundant catalogs is enabled ->  Redundant relation from parent catalog should be removed: The role is in 1 catalog.
        Assert.assertEquals(1, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    cleanAfterTest(syncConfigCustom, roleSystemId, log, roleAccountDtos);
}
Also used : IdmRoleCatalogueRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueRoleFilter) IdmScriptFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) SysSyncLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncLogFilter) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Example 10 with IdmScriptFilter

use of eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter in project CzechIdMng by bcvsolutions.

the class DefaultRoleSynchronizationExecutorTest method testSyncRolesCatalogueUnderMain.

@Test
public void testSyncRolesCatalogueUnderMain() {
    AbstractSysSyncConfigDto syncConfigCustom = createSyncConfig();
    SysSystemDto userSystem = helper.createTestResourceSystem(true);
    List<SysSystemMappingDto> userSystemMappings = systemMappingService.findBySystem(userSystem, SystemOperationType.PROVISIONING, SystemEntityType.IDENTITY);
    Assert.assertNotNull(userSystemMappings);
    Assert.assertEquals(1, userSystemMappings.size());
    SysSystemMappingDto userMappingDto = userSystemMappings.get(0);
    // Switch to the sync.
    userMappingDto.setOperationType(SystemOperationType.SYNCHRONIZATION);
    userMappingDto = systemMappingService.save(userMappingDto);
    List<SysSystemAttributeMappingDto> attributeMappingDtos = schemaAttributeMappingService.findBySystemMapping(userMappingDto);
    SysSystemAttributeMappingDto userEmailAttribute = attributeMappingDtos.stream().filter(attribute -> attribute.getName().equalsIgnoreCase(TestHelper.ATTRIBUTE_MAPPING_EMAIL)).findFirst().orElse(null);
    Assert.assertNotNull(userEmailAttribute);
    Assert.assertFalse(syncConfigService.isRunning(syncConfigCustom));
    Assert.assertTrue(syncConfigCustom instanceof SysSyncRoleConfigDto);
    SysSyncRoleConfigDto roleConfigDto = (SysSyncRoleConfigDto) syncConfigCustom;
    SysSystemMappingDto systemMappingDto = DtoUtils.getEmbedded(syncConfigCustom, SysSyncConfig_.systemMapping, SysSystemMappingDto.class);
    SysSchemaObjectClassDto schemaObjectClassDto = DtoUtils.getEmbedded(systemMappingDto, SysSystemMapping_.objectClass, SysSchemaObjectClassDto.class);
    UUID roleSystemId = schemaObjectClassDto.getSystem();
    Assert.assertNotNull(roleSystemId);
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(roleSystemId);
    schemaAttributeFilter.setObjectClassId(schemaObjectClassDto.getId());
    SysSchemaAttributeDto schemaAttributeDto = schemaAttributeService.find(schemaAttributeFilter, null).getContent().stream().filter(attribute -> attribute.getName().equalsIgnoreCase("name")).findFirst().orElse(null);
    Assert.assertNotNull(schemaAttributeDto);
    SysSystemDto roleSystemDto = new SysSystemDto();
    roleSystemDto.setId(roleSystemId);
    List<SysSystemMappingDto> roleSystemMappings = systemMappingService.findBySystem(roleSystemDto, SystemOperationType.SYNCHRONIZATION, SystemEntityType.ROLE);
    Assert.assertNotNull(roleSystemMappings);
    Assert.assertEquals(1, roleSystemMappings.size());
    SysSystemMappingDto roleMappingDto = roleSystemMappings.get(0);
    // Use ACC script "resolveRoleCatalogueUnderMainCatalogue".
    IdmScriptFilter scriptFilter = new IdmScriptFilter();
    scriptFilter.setCode(MsAdSyncMappingRoleAutoAttributesProcessor.RESOLVE_ROLE_CATALOG_UNDER_MAIN_SCRIPT);
    scriptFilter.setCategory(IdmScriptCategory.TRANSFORM_FROM);
    String catalogTransformationScript = null;
    IdmScriptDto scriptDto = scriptService.find(scriptFilter, null).getContent().stream().findFirst().orElse(null);
    if (scriptDto != null) {
        catalogTransformationScript = this.getPluginExecutors().getPluginFor(IdmScriptCategory.TRANSFORM_FROM).generateTemplate(scriptDto);
    }
    Assert.assertNotNull(catalogTransformationScript);
    // Create mapping attribute for get catalog.
    SysSystemAttributeMappingDto roleIdAttribute = new SysSystemAttributeMappingDto();
    roleIdAttribute.setEntityAttribute(true);
    roleIdAttribute.setUid(false);
    roleIdAttribute.setSystemMapping(roleMappingDto.getId());
    roleIdAttribute.setExtendedAttribute(false);
    roleIdAttribute.setIdmPropertyName(RoleSynchronizationExecutor.ROLE_CATALOGUE_FIELD);
    roleIdAttribute.setSchemaAttribute(schemaAttributeDto.getId());
    roleIdAttribute.setTransformFromResourceScript(catalogTransformationScript);
    roleIdAttribute.setName(helper.createName());
    roleIdAttribute = attributeMappingService.save(roleIdAttribute);
    IdmRoleCatalogueDto mainRoleCatalogue = getHelper().createRoleCatalogue();
    // Enable assign of role catalogue.
    roleConfigDto.setAssignCatalogueSwitch(true);
    roleConfigDto.setRemoveCatalogueRoleSwitch(false);
    roleConfigDto.setMainCatalogueRoleNode(mainRoleCatalogue.getId());
    syncConfigCustom = syncConfigService.save(roleConfigDto);
    // 
    helper.startSynchronization(syncConfigCustom);
    // 
    SysSyncLogFilter logFilter = new SysSyncLogFilter();
    logFilter.setSynchronizationConfigId(syncConfigCustom.getId());
    List<SysSyncLogDto> logs = syncLogService.find(logFilter, null).getContent();
    Assert.assertEquals(1, logs.size());
    SysSyncLogDto log = logs.get(0);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    helper.checkSyncLog(syncConfigCustom, SynchronizationActionType.CREATE_ENTITY, 5, OperationResultType.SUCCESS);
    AccRoleAccountFilter roleAccountFilter = new AccRoleAccountFilter();
    roleAccountFilter.setSystemId(roleSystemId);
    List<AccRoleAccountDto> roleAccountDtos = roleAccountService.find(roleAccountFilter, null).getContent();
    Assert.assertEquals(5, roleAccountDtos.size());
    roleAccountDtos.forEach(roleAccountDto -> {
        UUID roleId = roleAccountDto.getRole();
        IdmRoleCatalogueRoleFilter roleCatalogueRoleFilter = new IdmRoleCatalogueRoleFilter();
        roleCatalogueRoleFilter.setRoleId(roleId);
        List<IdmRoleCatalogueRoleDto> roleCatalogueRoleDtos = roleCatalogueRoleService.find(roleCatalogueRoleFilter, null).getContent();
        Assert.assertEquals(1, roleCatalogueRoleDtos.size());
        Assert.assertEquals(mainRoleCatalogue.getId(), roleCatalogueRoleDtos.get(0).getRoleCatalogue());
    });
    cleanAfterTest(syncConfigCustom, roleSystemId, log, roleAccountDtos);
}
Also used : IdmRoleCatalogueRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleCatalogueRoleFilter) IdmScriptFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter) IdmRoleCatalogueRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueRoleDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) AccRoleAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) AccRoleAccountDto(eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto) SysSyncLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncLogFilter) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) IdmScriptDto(eu.bcvsolutions.idm.core.api.dto.IdmScriptDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractBulkActionTest(eu.bcvsolutions.idm.test.api.AbstractBulkActionTest) Test(org.junit.Test)

Aggregations

IdmScriptFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmScriptFilter)10 IdmScriptDto (eu.bcvsolutions.idm.core.api.dto.IdmScriptDto)9 AbstractBulkActionTest (eu.bcvsolutions.idm.test.api.AbstractBulkActionTest)8 Test (org.junit.Test)8 IdmBulkActionDto (eu.bcvsolutions.idm.core.api.bulk.action.dto.IdmBulkActionDto)6 UUID (java.util.UUID)6 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)3 AccRoleAccountDto (eu.bcvsolutions.idm.acc.dto.AccRoleAccountDto)3 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)3 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)3 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)3 SysSyncRoleConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto)3 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)3 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)3 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)3 AccRoleAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccRoleAccountFilter)3 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)3 SysSyncLogFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncLogFilter)3 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)2 IdmRoleCatalogueDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)2