Search in sources :

Example 91 with SysSystemAttributeMappingFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterBySchemaName.

@Test
public void testFilterBySchemaName() {
    SysSystemDto system = this.getHelper().createTestResourceSystem(true, getHelper().createName());
    // Generate second system for add mapped attributes
    this.getHelper().createTestResourceSystem(true, getHelper().createName());
    SysSystemMappingFilter filterMapping = new SysSystemMappingFilter();
    filterMapping.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(filterMapping, null).getContent();
    assertEquals(1, mappings.size());
    SysSystemMappingDto mappingDto = mappings.get(0);
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemMappingId(mappingDto.getId());
    filter.setName(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME);
    List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
    assertEquals(1, attributeMappings.size());
    SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
    assertEquals(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME, attributeMappingDto.getName());
    assertEquals(mappingDto.getId(), attributeMappingDto.getSystemMapping());
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 92 with SysSystemAttributeMappingFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByOperationTypeFound.

@Test
public void testFilterByOperationTypeFound() {
    SysSystemDto system = this.getHelper().createTestResourceSystem(true, getHelper().createName());
    // Generate second system for add mapped attributes
    this.getHelper().createTestResourceSystem(true, getHelper().createName());
    SysSystemMappingFilter filterMapping = new SysSystemMappingFilter();
    filterMapping.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(filterMapping, null).getContent();
    assertEquals(1, mappings.size());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemId(system.getId());
    filter.setOperationType(SystemOperationType.PROVISIONING);
    List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
    // Six is default for standard test resource
    assertEquals(6, attributeMappings.size());
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 93 with SysSystemAttributeMappingFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByNameNotFound.

@Test
public void testFilterByNameNotFound() {
    SysSystemDto system = this.getHelper().createTestResourceSystem(true, getHelper().createName());
    // Generate second system for add mapped attributes
    this.getHelper().createTestResourceSystem(true, getHelper().createName());
    SysSystemMappingFilter filterMapping = new SysSystemMappingFilter();
    filterMapping.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(filterMapping, null).getContent();
    assertEquals(1, mappings.size());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemId(system.getId());
    filter.setName(IdmIdentity_.state.getName());
    List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
    assertEquals(0, attributeMappings.size());
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 94 with SysSystemAttributeMappingFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.

the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByOperationTypeNotFound.

@Test
public void testFilterByOperationTypeNotFound() {
    SysSystemDto system = this.getHelper().createTestResourceSystem(true, getHelper().createName());
    // Generate second system for add mapped attributes
    this.getHelper().createTestResourceSystem(true, getHelper().createName());
    SysSystemMappingFilter filterMapping = new SysSystemMappingFilter();
    filterMapping.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(filterMapping, null).getContent();
    assertEquals(1, mappings.size());
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSystemId(system.getId());
    filter.setOperationType(SystemOperationType.SYNCHRONIZATION);
    List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
    assertEquals(0, attributeMappings.size());
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 95 with SysSystemAttributeMappingFilter

use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.

the class DefaultTreeSynchronizationServiceTest method syncCorellationAttribute.

@Test
public void syncCorellationAttribute() {
    this.getBean().deleteAllResourceData();
    this.getBean().initTreeData();
    SysSyncConfigFilter configFilter = new SysSyncConfigFilter();
    configFilter.setName(SYNC_CONFIG_NAME);
    List<AbstractSysSyncConfigDto> syncConfigs = syncConfigService.find(configFilter, null).getContent();
    Assert.assertEquals(1, syncConfigs.size());
    AbstractSysSyncConfigDto syncConfigCustom = syncConfigs.get(0);
    Assert.assertFalse(syncConfigService.isRunning(syncConfigCustom));
    IdmTreeTypeDto treeTypeOne = getHelper().createTreeType();
    IdmTreeTypeDto treeTypeTwo = getHelper().createTreeType();
    // Set tree type to the mapping
    SysSystemMappingDto mappingDto = DtoUtils.getEmbedded(syncConfigCustom, SysSyncConfig_.systemMapping.getName(), SysSystemMappingDto.class);
    mappingDto.setTreeType(treeTypeOne.getId());
    systemMappingService.save(mappingDto);
    // Set sync config
    syncConfigCustom.setLinkedAction(SynchronizationLinkedActionType.IGNORE);
    syncConfigCustom.setUnlinkedAction(SynchronizationUnlinkedActionType.LINK);
    syncConfigCustom.setMissingEntityAction(SynchronizationMissingEntityActionType.IGNORE);
    syncConfigCustom.setMissingAccountAction(ReconciliationMissingAccountActionType.IGNORE);
    syncConfigCustom.setRootsFilterScript(null);
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(syncConfigCustom.getSystemMapping());
    attributeMappingFilter.setIdmPropertyName(IdmTreeNode_.code.getName());
    // Set correlation attribute
    List<SysSystemAttributeMappingDto> attributes = attributeMappingService.find(attributeMappingFilter, null).getContent();
    Assert.assertEquals(1, attributes.size());
    SysSystemAttributeMappingDto correlationAttribute = attributes.get(0);
    syncConfigCustom.setCorrelationAttribute(correlationAttribute.getId());
    syncConfigService.save(syncConfigCustom);
    // Check state before sync
    // For first tree type
    IdmTreeNodeFilter nodeFilter = new IdmTreeNodeFilter();
    nodeFilter.setProperty(IdmTreeNode_.code.getName());
    nodeFilter.setValue("111");
    nodeFilter.setTreeTypeId(treeTypeOne.getId());
    List<IdmTreeNodeDto> nodes = treeNodeService.find(nodeFilter, null).getContent();
    Assert.assertEquals(0, nodes.size());
    // For second tree type
    nodeFilter.setTreeTypeId(treeTypeTwo.getId());
    nodes = treeNodeService.find(nodeFilter, null).getContent();
    Assert.assertEquals(0, nodes.size());
    IdmTreeNodeDto node = new IdmTreeNodeDto();
    node.setTreeType(treeTypeTwo.getId());
    node.setName("111");
    node.setCode(node.getName());
    node = treeNodeService.save(node);
    nodes = treeNodeService.find(nodeFilter, null).getContent();
    Assert.assertEquals(1, nodes.size());
    // Start sync
    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());
    SysSyncActionLogFilter actionLogFilter = new SysSyncActionLogFilter();
    actionLogFilter.setSynchronizationLogId(log.getId());
    List<SysSyncActionLogDto> actions = syncActionLogService.find(actionLogFilter, null).getContent();
    boolean linkActionLogExists = actions.stream().filter(action -> {
        return SynchronizationActionType.LINK == action.getSyncAction();
    }).findFirst().isPresent();
    // Must be false, because node is in the different tree type!
    assertFalse(linkActionLogExists);
    // Delete log
    syncLogService.delete(log);
    treeNodeService.delete(node);
    // Create node for tree type One
    node = new IdmTreeNodeDto();
    node.setTreeType(treeTypeOne.getId());
    node.setName("111");
    node.setCode(node.getName());
    node = treeNodeService.save(node);
    nodeFilter.setTreeTypeId(treeTypeOne.getId());
    nodes = treeNodeService.find(nodeFilter, null).getContent();
    Assert.assertEquals(1, nodes.size());
    // Start sync again
    helper.startSynchronization(syncConfigCustom);
    logFilter = new SysSyncLogFilter();
    logFilter.setSynchronizationConfigId(syncConfigCustom.getId());
    logs = syncLogService.find(logFilter, null).getContent();
    Assert.assertEquals(1, logs.size());
    log = logs.get(0);
    Assert.assertFalse(log.isRunning());
    Assert.assertFalse(log.isContainsError());
    actionLogFilter = new SysSyncActionLogFilter();
    actionLogFilter.setSynchronizationLogId(log.getId());
    actions = syncActionLogService.find(actionLogFilter, null).getContent();
    SysSyncActionLogDto linkActionLog = actions.stream().filter(action -> {
        return SynchronizationActionType.LINK == action.getSyncAction();
    }).findFirst().get();
    // Must exists, because node is in the tree type One!
    assertNotNull(linkActionLog);
    assertEquals(1, linkActionLog.getOperationCount().intValue());
    SysSchemaObjectClassDto schemaObjectDto = DtoUtils.getEmbedded(mappingDto, SysSystemMapping_.objectClass.getName(), SysSchemaObjectClassDto.class);
    AccTreeAccountFilter treeAccountFilter = new AccTreeAccountFilter();
    treeAccountFilter.setSystemId(schemaObjectDto.getSystem());
    treeAccountFilter.setTreeNodeId(node.getId());
    List<AccTreeAccountDto> treeAccounts = treeAccountService.find(treeAccountFilter, null).getContent();
    assertEquals(1, treeAccounts.size());
    // Delete log
    syncLogService.delete(log);
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmTreeNodeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmTreeNodeFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmTreeNodeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeNodeDto) IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSyncActionLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncActionLogDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) AccTreeAccountDto(eu.bcvsolutions.idm.acc.dto.AccTreeAccountDto) AccTreeAccountFilter(eu.bcvsolutions.idm.acc.dto.filter.AccTreeAccountFilter) SysSyncLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncLogFilter) SysSyncActionLogFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncActionLogFilter) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)138 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)125 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)93 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)86 Test (org.junit.Test)85 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)82 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)53 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)37 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)36 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)34 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)32 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)27 AccIdentityAccountFilter (eu.bcvsolutions.idm.acc.dto.filter.AccIdentityAccountFilter)24 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)24 ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)23 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)22 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)22 UUID (java.util.UUID)22 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)18 SysSystemAttributeMappingService (eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService)18