use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByDisable.
@Test
public void testFilterByDisable() {
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_LASTNAME);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertFalse(attributeMappingDto.isDisabledAttribute());
filter.setDisabledAttribute(Boolean.FALSE);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertFalse(attributeMappingDto.isDisabledAttribute());
filter.setDisabledAttribute(Boolean.TRUE);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(0, attributeMappings.size());
attributeMappingDto.setDisabledAttribute(true);
attributeMappingDto = systemAttributeMappingService.save(attributeMappingDto);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertTrue(attributeMappingDto.isDisabledAttribute());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingServiceIntegrationTest method objectClassFilterTest.
@Test
public void objectClassFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
SysSystemDto system = createSystem();
SysSystemDto system2 = createSystem();
SysSchemaObjectClassDto objectClass = createObjectClass(system);
SysSchemaObjectClassDto objectClass2 = createObjectClass(system2);
SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass);
SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass2);
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setObjectClassId(mappingSystem1.getObjectClass());
Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
assertEquals(1, result.getTotalElements());
assertTrue(result.getContent().contains(mappingSystem1));
assertFalse(result.getContent().contains(mappingSystem2));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingServiceIntegrationTest method operationTypeFilterTest.
@Test
public void operationTypeFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
SysSystemDto system = createSystem();
SysSchemaObjectClassDto objectClass = createObjectClass(system);
SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass);
createProvisioningMappingSystem(SystemEntityType.TREE, objectClass);
SysSystemMappingDto mappingSystem3 = createProvisioningMappingSystem(entityType, objectClass);
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setOperationType(SystemOperationType.PROVISIONING);
filter.setSystemId(system.getId());
Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
assertEquals(2, result.getTotalElements());
assertTrue(result.getContent().contains(mappingSystem3));
assertFalse(result.getContent().contains(mappingSystem1));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingServiceIntegrationTest method typeFilterTest.
@Test
public void typeFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SysSystemDto system = createSystem();
SysSchemaObjectClassDto objectClass = createObjectClass(system);
SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(SystemEntityType.CONTRACT, objectClass);
SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(SystemEntityType.CONTRACT, objectClass);
SysSystemMappingDto mappingSystem3 = testHelper.createMappingSystem(SystemEntityType.TREE, objectClass);
SysSystemMappingFilter filter = new SysSystemMappingFilter();
filter.setSystemId(system.getId());
filter.setEntityType(SystemEntityType.CONTRACT);
Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
assertEquals(2, result.getTotalElements());
assertTrue(result.getContent().contains(mappingSystem1));
assertTrue(result.getContent().contains(mappingSystem2));
assertFalse(result.getContent().contains(mappingSystem3));
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testPairingSync.
@Test
public void testPairingSync() {
ConnectorType connectorType = connectorManager.getConnectorType(MockAdUserConnectorType.NAME);
ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
String newUserContainerMock = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.NEW_USER_CONTAINER_KEY, newUserContainerMock);
String userContainerMock = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY, userContainerMock);
String deletedUserContainerMock = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.DELETE_USER_CONTAINER_KEY, deletedUserContainerMock);
String domainMock = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.DOMAIN_KEY, domainMock);
String defaultRoleMock = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.NEW_ROLE_WITH_SYSTEM_CODE, defaultRoleMock);
connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_FOUR);
// Activate pairing sync.
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.PAIRING_SYNC_SWITCH_KEY, "true");
// Activate protected sync.
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.PROTECTED_MODE_SWITCH_KEY, "true");
// Generate mock schema.
generateMockSchema(systemDto);
// Execute step four.
connectorManager.execute(connectorTypeDto);
SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
mappingFilter.setSystemId(systemDto.getId());
mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
mappingFilter.setEntityType(SystemEntityType.IDENTITY);
List<SysSystemMappingDto> mappingDtos = mappingService.find(mappingFilter, null).getContent();
assertEquals(1, mappingDtos.size());
// Protected mode is activated.
assertTrue(mappingDtos.get(0).isProtectionEnabled());
// Provisioning context is used.
assertTrue(mappingDtos.get(0).isAddContextConnectorObject());
mappingFilter.setOperationType(SystemOperationType.SYNCHRONIZATION);
mappingFilter.setEntityType(SystemEntityType.IDENTITY);
mappingDtos = mappingService.find(mappingFilter, null).getContent();
// Sync mapping must exists.
assertEquals(1, mappingDtos.size());
// Pairing sync should be created.
SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
syncConfigFilter.setSystemId(systemDto.getId());
List<AbstractSysSyncConfigDto> configDtos = syncConfigService.find(syncConfigFilter, null).getContent();
assertEquals(1, configDtos.size());
SysSyncIdentityConfigDto sync = (SysSyncIdentityConfigDto) configDtos.get(0);
// Protected mode is activated.
assertEquals(SynchronizationInactiveOwnerBehaviorType.LINK_PROTECTED, sync.getInactiveOwnerBehavior());
assertNotNull(sync.getDefaultRole());
// Clean
systemService.delete(systemDto);
}
Aggregations