Search in sources :

Example 21 with IdmRoleFilter

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

the class RoleWorkflowAdSyncTest method n8_testSyncWithWfSituationMissingEntityOneFolderCatalog.

@Test
public void n8_testSyncWithWfSituationMissingEntityOneFolderCatalog() {
    configurationService.setValue("idm.pub.acc.syncRole.roles.allToOneCatalog", CATALOG_FOLDER);
    SysSystemDto system = initData();
    IdmRoleFilter roleFilter = new IdmRoleFilter();
    roleFilter.setText(ROLE_NAME);
    List<IdmRoleDto> roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(0, roles.size());
    Assert.assertNotNull(system);
    SysSyncRoleConfigDto config = doCreateSyncConfig(system);
    config.setLinkedActionWfKey(wfExampleKey);
    config.setMissingAccountActionWfKey(wfExampleKey);
    config.setMissingEntityActionWfKey(wfExampleKey);
    config.setUnlinkedActionWfKey(wfExampleKey);
    config = (SysSyncRoleConfigDto) syncConfigService.save(config);
    // Start sync
    helper.startSynchronization(config);
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.MISSING_ENTITY, 1, OperationResultType.WF);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    IdmRoleDto role = roles.get(0);
    List<IdmFormValueDto> dnValues = formService.getValues(role, ATTRIBUTE_DN);
    Assert.assertEquals(1, dnValues.size());
    Assert.assertEquals(ATTRIBUTE_DN_VALUE, dnValues.get(0).getValue());
    IdmRoleCatalogueDto catalogueFirst = getCatalogueByCode(CATALOG_FOLDER);
    Assert.assertNotNull(catalogueFirst);
    Assert.assertFalse(!isRoleInCatalogue(role.getId(), CATALOG_FOLDER));
    // Delete log
    syncLogService.delete(log);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 22 with IdmRoleFilter

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

the class RoleWorkflowAdSyncTest method n5_testSyncWithWfSituationMissingEntity.

@Test
public void n5_testSyncWithWfSituationMissingEntity() {
    SysSystemDto system = initData();
    IdmRoleFilter roleFilter = new IdmRoleFilter();
    roleFilter.setText(ROLE_NAME);
    List<IdmRoleDto> roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(0, roles.size());
    Assert.assertNotNull(system);
    SysSyncRoleConfigDto config = doCreateSyncConfig(system);
    config.setLinkedActionWfKey(wfExampleKey);
    config.setMissingAccountActionWfKey(wfExampleKey);
    config.setMissingEntityActionWfKey(wfExampleKey);
    config.setUnlinkedActionWfKey(wfExampleKey);
    config = (SysSyncRoleConfigDto) syncConfigService.save(config);
    // Start sync
    helper.startSynchronization(config);
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.MISSING_ENTITY, 1, OperationResultType.WF);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    IdmRoleDto role = roles.get(0);
    List<IdmFormValueDto> dnValues = formService.getValues(role, ATTRIBUTE_DN);
    Assert.assertEquals(1, dnValues.size());
    Assert.assertEquals(ATTRIBUTE_DN_VALUE, dnValues.get(0).getValue());
    IdmRoleCatalogueDto catalogueFirst = getCatalogueByCode(CATALOGUE_CODE_FIRST);
    IdmRoleCatalogueDto catalogueSecond = getCatalogueByCode(CATALOGUE_CODE_SECOND);
    Assert.assertNotNull(catalogueFirst);
    Assert.assertNotNull(catalogueSecond);
    // Delete log
    syncLogService.delete(log);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 23 with IdmRoleFilter

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

the class RoleWorkflowAdSyncTest method n9_testSyncWithWfSituationMissingEntityAddResource.

@Test
public void n9_testSyncWithWfSituationMissingEntityAddResource() {
    String USER_SYSTEM_NAME = "TestName001";
    String overridedAttributeName = "EAV_ATTRIBUTE";
    configurationService.setValue("idm.pub.acc.syncRole.provisioningOfIdentities.system.code", USER_SYSTEM_NAME);
    configurationService.setValue("idm.pub.acc.syncRole.system.mapping.attributeMemberOf", helper.getSchemaColumnName(overridedAttributeName));
    SysSystemDto userSystem = initData(USER_SYSTEM_NAME, true);
    SysSystemDto system = initData();
    IdmRoleFilter roleFilter = new IdmRoleFilter();
    roleFilter.setText(ROLE_NAME);
    List<IdmRoleDto> roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(0, roles.size());
    Assert.assertNotNull(system);
    SysSyncRoleConfigDto config = doCreateSyncConfig(system);
    config.setLinkedActionWfKey(wfExampleKey);
    config.setMissingAccountActionWfKey(wfExampleKey);
    config.setMissingEntityActionWfKey(wfExampleKey);
    config.setUnlinkedActionWfKey(wfExampleKey);
    config = (SysSyncRoleConfigDto) syncConfigService.save(config);
    // Start sync
    helper.startSynchronization(config);
    SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.MISSING_ENTITY, 1, OperationResultType.WF);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    IdmRoleDto role = roles.get(0);
    List<IdmFormValueDto> dnValues = formService.getValues(role, ATTRIBUTE_DN);
    Assert.assertEquals(1, dnValues.size());
    Assert.assertEquals(ATTRIBUTE_DN_VALUE, dnValues.get(0).getValue());
    // resource existing
    SysRoleSystemAttributeDto systemAttribute = getSystemAttribute(userSystem.getId(), overridedAttributeName, role.getId());
    Assert.assertNotNull(systemAttribute);
    String transformationScript = "\"" + ATTRIBUTE_DN_VALUE + "\"";
    Assert.assertEquals(systemAttribute.getTransformToResourceScript(), transformationScript);
    // Delete log
    syncLogService.delete(log);
    configurationService.deleteValue("idm.pub.acc.syncRole.provisioningOfIdentities.system.code");
    configurationService.deleteValue("idm.pub.acc.syncRole.system.mapping.attributeMemberOf");
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) SysRoleSystemAttributeDto(eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 24 with IdmRoleFilter

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

the class RoleWorkflowAdSyncTest method n5_testSyncWithWfSituationMissingAccount.

@Test
public void n5_testSyncWithWfSituationMissingAccount() {
    createRolesInSystem();
    this.getBean().deleteAllResourceData();
    IdmRoleFilter roleFilter = new IdmRoleFilter();
    roleFilter.setText(ROLE_NAME);
    List<IdmRoleDto> roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    SysSystemDto systemDto = systemService.getByCode(SYSTEM_NAME);
    Assert.assertNotNull(systemDto);
    SysSyncConfigFilter filter = new SysSyncConfigFilter();
    filter.setSystemId(systemDto.getId());
    List<AbstractSysSyncConfigDto> syncConfig = syncConfigService.find(filter, null).getContent();
    Assert.assertEquals(1, syncConfig.size());
    // Start sync
    helper.startSynchronization(syncConfig.get(0));
    SysSyncLogDto log = checkSyncLog(syncConfig.get(0), SynchronizationActionType.MISSING_ACCOUNT, 1, OperationResultType.WF);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(0, roles.size());
    // Delete log
    syncLogService.delete(log);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 25 with IdmRoleFilter

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

the class RoleWorkflowAdSyncTest method n5_testSyncWithWfSituationLinked.

@Test
public void n5_testSyncWithWfSituationLinked() {
    createRolesInSystem();
    final String newDN = "CN=" + ROLE_NAME + ",OU=Flat,OU=Pardubice,DC=bcvsolutions,DC=eu";
    this.getBean().initIdentityData(ROLE_NAME, newDN);
    IdmRoleFilter roleFilter = new IdmRoleFilter();
    roleFilter.setText(ROLE_NAME);
    List<IdmRoleDto> roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    SysSystemDto systemDto = systemService.getByCode(SYSTEM_NAME);
    Assert.assertNotNull(systemDto);
    SysSyncConfigFilter filter = new SysSyncConfigFilter();
    filter.setSystemId(systemDto.getId());
    List<AbstractSysSyncConfigDto> syncConfig = syncConfigService.find(filter, null).getContent();
    Assert.assertEquals(1, syncConfig.size());
    // Start sync
    helper.startSynchronization(syncConfig.get(0));
    SysSyncLogDto log = checkSyncLog(syncConfig.get(0), SynchronizationActionType.LINKED, 1, OperationResultType.WF);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    roles = roleService.find(roleFilter, null).getContent();
    Assert.assertEquals(1, roles.size());
    IdmRoleDto role = roles.get(0);
    List<IdmFormValueDto> dnValues = formService.getValues(role, ATTRIBUTE_DN);
    Assert.assertEquals(1, dnValues.size());
    Assert.assertEquals(newDN, dnValues.get(0).getValue());
    IdmRoleCatalogueDto catalogueFirst = getCatalogueByCode("Flat");
    IdmRoleCatalogueDto catalogueSecond = getCatalogueByCode("Pardubice");
    Assert.assertNotNull(catalogueFirst);
    Assert.assertNotNull(catalogueSecond);
    // Delete log
    syncLogService.delete(log);
}
Also used : IdmRoleDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmRoleFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

IdmRoleFilter (eu.bcvsolutions.idm.core.api.dto.filter.IdmRoleFilter)54 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)46 Test (org.junit.Test)41 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)22 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)17 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)17 IdmRoleCatalogueDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto)16 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)14 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)14 IdmRole (eu.bcvsolutions.idm.core.model.entity.IdmRole)10 IdmFormValueDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto)9 List (java.util.List)9 Assert (org.junit.Assert)9 Autowired (org.springframework.beans.factory.annotation.Autowired)9 SysSyncRoleConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto)8 UUID (java.util.UUID)8 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)7 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)7 CoreGroupPermission (eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission)7 TestHelper (eu.bcvsolutions.idm.test.api.TestHelper)7