use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class AdGroupConnectorTypeTest method testOfFullSync.
@Test
public void testOfFullSync() {
ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
// Create system with members.
SysSystemDto memberSystemDto = createMemberSystem();
SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
mappingFilter.setSystemId(memberSystemDto.getId());
mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
mappingFilter.setEntityType(SystemEntityType.IDENTITY);
SysSystemMappingDto mappingDto = mappingService.find(mappingFilter, null).getContent().stream().findFirst().orElse(null);
assertNotNull(mappingDto);
StringBuilder sb = new StringBuilder();
sb.append(this.getHelper().createName());
sb.append(AdGroupConnectorType.LINE_SEPARATOR);
sb.append(this.getHelper().createName());
String groupContainersMock = sb.toString();
connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.GROUP_CONTAINER_KEY, groupContainersMock);
connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MEMBER_SYSTEM_MAPPING, mappingDto.getId().toString());
connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
// Generate mock schema.
generateMockSchema(systemDto);
IdmRoleCatalogueDto mainCatalog = getHelper().createRoleCatalogue(getHelper().createName());
// Enable wizard switches.
connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.membershipSwitch.getName(), Boolean.TRUE.toString());
connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignCatalogueSwitch.getName(), Boolean.TRUE.toString());
connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleSwitch.getName(), Boolean.TRUE.toString());
connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleRemoveSwitch.getName(), Boolean.TRUE.toString());
connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.removeCatalogueRoleSwitch.getName(), Boolean.TRUE.toString());
connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MAIN_ROLE_CATALOG, mainCatalog.getId().toString());
// Execute step four.
connectorManager.execute(connectorTypeDto);
SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
syncConfigFilter.setSystemId(systemDto.getId());
AbstractSysSyncConfigDto syncConfigDto = syncConfigService.find(syncConfigFilter, null).getContent().stream().findFirst().orElse(null);
assertTrue(syncConfigDto instanceof SysSyncRoleConfigDto);
SysSyncRoleConfigDto syncRoleConfigDto = (SysSyncRoleConfigDto) syncConfigDto;
assertTrue(syncRoleConfigDto.isMembershipSwitch());
assertTrue(syncRoleConfigDto.isRemoveCatalogueRoleSwitch());
assertTrue(syncRoleConfigDto.isAssignRoleRemoveSwitch());
assertTrue(syncRoleConfigDto.isAssignRoleSwitch());
assertTrue(syncRoleConfigDto.isAssignCatalogueSwitch());
assertNotNull(syncRoleConfigDto.getAssignCatalogueMappingAttribute());
assertNotNull(syncRoleConfigDto.getSkipValueIfExcludedMappingAttribute());
assertNotNull(syncRoleConfigDto.getForwardAcmMappingAttribute());
assertNotNull(syncRoleConfigDto.getRoleMembersMappingAttribute());
assertNotNull(syncRoleConfigDto.getRoleIdentifiersMappingAttribute());
assertNotNull(syncRoleConfigDto.getMemberIdentifierAttribute());
assertNotNull(syncRoleConfigDto.getMemberOfAttribute());
// Clean
systemService.delete(systemDto);
systemService.delete(memberSystemDto);
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class SynchronizationSchedulableTaskExecutorIntegrationTest method testFormInstance.
@Test
public void testFormInstance() {
ConfigurationMap properties = new ConfigurationMap();
//
Assert.assertNull(executor.getFormInstance(properties));
//
UUID synchronizationId = UUID.randomUUID();
properties.put(SynchronizationService.PARAMETER_SYNCHRONIZATION_ID, synchronizationId);
//
IdmFormInstanceDto formInstance = executor.getFormInstance(properties);
Assert.assertNotNull(formInstance);
Assert.assertNotNull(formInstance.getValues().stream().anyMatch(v -> v.getUuidValue().equals(synchronizationId) && v.getEmbedded().get(IdmFormValueDto.PROPERTY_UUID_VALUE) != null));
//
SysSystemDto system = getHelper().createTestResourceSystem(true);
SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
mappingFilter.setSystemId(system.getId());
List<SysSystemMappingDto> mappings = systemMappingService.find(mappingFilter, null).getContent();
SysSystemMappingDto mapping = mappings.get(0);
SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
attributeMappingFilter.setSystemMappingId(mapping.getId());
List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
SysSystemAttributeMappingDto nameAttribute = attributes.stream().filter(attribute -> {
return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_NAME);
}).findFirst().get();
// Create default synchronization config.
AbstractSysSyncConfigDto syncConfigCustom = new SysSyncIdentityConfigDto();
syncConfigCustom.setCustomFilter(true);
syncConfigCustom.setSystemMapping(mapping.getId());
syncConfigCustom.setCorrelationAttribute(nameAttribute.getId());
syncConfigCustom.setName(getHelper().createName());
AbstractSysSyncConfigDto syncConfig = syncConfigService.save(syncConfigCustom);
properties.put(SynchronizationService.PARAMETER_SYNCHRONIZATION_ID, syncConfig.getId());
//
formInstance = executor.getFormInstance(properties);
Assert.assertNotNull(formInstance);
Assert.assertNotNull(formInstance.getValues().stream().anyMatch(v -> v.getUuidValue().equals(syncConfig.getId()) && v.getEmbedded().get(IdmFormValueDto.PROPERTY_UUID_VALUE) != null));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class SystemMappingSaveProcessor method getMapping.
private List<SysSystemMappingDto> getMapping(SystemEntityType entityType, UUID systemId, UUID treeTypeId) {
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setEntityType(entityType);
filter.setTreeTypeId(treeTypeId);
filter.setOperationType(SystemOperationType.PROVISIONING);
filter.setSystemId(systemId);
return systemMappingService.find(filter, null).getContent();
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysRoleSystemAttributeService method getSystemMapping.
@Transactional
@Override
public SysSystemMappingDto getSystemMapping(UUID systemId, String objectClassName, SystemOperationType operationType) {
Assert.notNull(systemId, "SystemId cannot be null!");
Assert.notNull(objectClassName, "ObjectClassName cannot be null!");
Assert.notNull(operationType, "OperationType cannot be null!");
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(systemId);
filter.setOperationType(operationType);
filter.setObjectClassId(getObjectClassId(systemId, objectClassName));
List<SysSystemMappingDto> systemMappings = systemMappingService.find(filter, null).getContent();
if (systemMappings.isEmpty()) {
throw new ResultCodeException(AccResultCode.SYSTEM_MAPPING_NOT_FOUND, ImmutableMap.of("systemId", systemId, "objectClassName", objectClassName));
}
return systemMappings.get(0);
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultRoleSynchronizationExecutorTest method createUserSyncConfig.
public SysSyncIdentityConfigDto createUserSyncConfig(SysSystemDto system) {
SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
mappingFilter.setEntityType(SystemEntityType.IDENTITY);
mappingFilter.setSystemId(system.getId());
mappingFilter.setOperationType(SystemOperationType.SYNCHRONIZATION);
List<SysSystemMappingDto> mappings = systemMappingService.find(mappingFilter, null).getContent();
Assert.assertEquals(1, mappings.size());
SysSystemMappingDto mapping = mappings.get(0);
SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
attributeMappingFilter.setSystemMappingId(mapping.getId());
List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
SysSystemAttributeMappingDto uidAttribute = attributes.stream().filter(attribute -> {
return attribute.isUid();
}).findFirst().orElse(null);
// Create default synchronization config
SysSyncIdentityConfigDto syncConfigCustom = new SysSyncIdentityConfigDto();
syncConfigCustom.setReconciliation(true);
syncConfigCustom.setCustomFilter(false);
syncConfigCustom.setSystemMapping(mapping.getId());
syncConfigCustom.setCorrelationAttribute(uidAttribute.getId());
syncConfigCustom.setName(getHelper().createName());
syncConfigCustom.setLinkedAction(SynchronizationLinkedActionType.UPDATE_ENTITY);
syncConfigCustom.setUnlinkedAction(SynchronizationUnlinkedActionType.IGNORE);
syncConfigCustom.setMissingEntityAction(SynchronizationMissingEntityActionType.CREATE_ENTITY);
syncConfigCustom.setMissingAccountAction(ReconciliationMissingAccountActionType.IGNORE);
syncConfigCustom.setCreateDefaultContract(true);
return (SysSyncIdentityConfigDto) syncConfigService.save(syncConfigCustom);
}
Aggregations