use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.
the class AdGroupConnectorTypeTest method testStepOne.
@Test
public void testStepOne() {
ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.
the class AdGroupConnectorTypeTest method testReopenSystemWithoutOptionsAttributes.
@Test
public void testReopenSystemWithoutOptionsAttributes() {
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());
IdmFormDefinitionDto operationOptionsConnectorFormDefinition = systemService.getOperationOptionsConnectorFormDefinition(systemDto);
// Try to find attribute for one of container. If exist -> change code = simulate delete.
IdmFormAttributeDto userSearchContainerAttribute = operationOptionsConnectorFormDefinition.getMappedAttributeByCode(MockAdGroupConnectorType.USER_SEARCH_CONTAINER_KEY);
if (userSearchContainerAttribute != null) {
userSearchContainerAttribute.setCode(getHelper().createName());
formService.saveAttribute(userSearchContainerAttribute);
}
connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
connectorTypeDto.setReopened(true);
connectorTypeDto.getEmbedded().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto);
connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
ConnectorTypeDto loadedConnectorTypeDto = connectorManager.load(connectorTypeDto);
assertNotNull(loadedConnectorTypeDto);
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.
the class AdGroupConnectorTypeTest method testOfDefaultSync.
@Test
public void testOfDefaultSync() {
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());
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.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
// Generate mock schema.
generateMockSchema(systemDto);
// 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;
assertFalse(syncRoleConfigDto.isMembershipSwitch());
assertFalse(syncRoleConfigDto.isAssignRoleSwitch());
assertFalse(syncRoleConfigDto.isAssignCatalogueSwitch());
assertFalse(syncRoleConfigDto.isForwardAcmSwitch());
assertFalse(syncRoleConfigDto.isSkipValueIfExcludedSwitch());
assertNotNull(syncRoleConfigDto.getAssignCatalogueMappingAttribute());
assertNotNull(syncRoleConfigDto.getSkipValueIfExcludedMappingAttribute());
assertNotNull(syncRoleConfigDto.getForwardAcmMappingAttribute());
assertNotNull(syncRoleConfigDto.getRoleMembersMappingAttribute());
assertNotNull(syncRoleConfigDto.getRoleIdentifiersMappingAttribute());
assertNull(syncRoleConfigDto.getMemberIdentifierAttribute());
assertNull(syncRoleConfigDto.getMemberOfAttribute());
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.
the class DefaultConnectorManager method load.
@Override
@Transactional
public ConnectorTypeDto load(ConnectorTypeDto connectorType) {
Assert.notNull(connectorType, "Connector type cannot be null!");
Assert.notNull(connectorType.getId(), "Connector type ID cannot be null!");
ConnectorType connectorTypeDef = this.getConnectorType(connectorType.getId());
Assert.notNull(connectorTypeDef, "Connector type definition was not found!");
return connectorTypeDef.load(connectorType);
}
use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.
the class CsvConnectorTypeTest method testReopenSystemInWizard.
@Test
public void testReopenSystemInWizard() {
ConnectorTypeDto mockCsvConnectorTypeDto = new ConnectorTypeDto();
mockCsvConnectorTypeDto.setReopened(false);
mockCsvConnectorTypeDto.setId(CsvConnectorType.NAME);
mockCsvConnectorTypeDto.setConnectorName(csvConnectorType.getConnectorName());
ConnectorTypeDto csvConnectorTypeDto = connectorManager.load(mockCsvConnectorTypeDto);
assertNotNull(csvConnectorTypeDto);
csvConnectorTypeDto.getMetadata().put(CsvConnectorType.FILE_PATH, CSV_TEST_FILE);
csvConnectorTypeDto.setWizardStepName(CsvConnectorType.STEP_ONE_CREATE_SYSTEM);
// Execute the first step.
ConnectorTypeDto stepExecutedResult = connectorManager.execute(csvConnectorTypeDto);
// The system had to be created.
BaseDto system = stepExecutedResult.getEmbedded().get(CsvConnectorType.SYSTEM_DTO_KEY);
assertTrue(system instanceof SysSystemDto);
SysSystemDto systemDto = systemService.get(system.getId());
assertNotNull(systemDto);
SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
schemaAttributeFilter.setSystemId(systemDto.getId());
schemaAttributeFilter.setName("username");
SysSchemaAttributeDto usernameAttributeDto = schemaAttributeService.find(schemaAttributeFilter, null).getContent().stream().findFirst().orElse(null);
assertNotNull(usernameAttributeDto);
// Set username attribute as primary attribute for second wizard step.
stepExecutedResult.getMetadata().put(CsvConnectorType.PRIMARY_SCHEMA_ATTRIBUTE, usernameAttributeDto.getId().toString());
// Execute the second step.
csvConnectorTypeDto.setWizardStepName(CsvConnectorType.STEP_TWO_SELECT_PK);
csvConnectorTypeDto.getMetadata().put(CsvConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
connectorManager.execute(csvConnectorTypeDto);
// Load wizard data for existed system;
ConnectorType connectorTypeBySystem = connectorManager.findConnectorTypeBySystem(systemDto);
ConnectorTypeDto reopenSystem = new ConnectorTypeDto();
reopenSystem.setReopened(true);
reopenSystem.setId(connectorTypeBySystem.getId());
reopenSystem.getEmbedded().put(CsvConnectorType.SYSTEM_DTO_KEY, systemDto);
reopenSystem = connectorManager.load(reopenSystem);
assertNotNull(reopenSystem);
assertEquals(systemDto.getName(), reopenSystem.getMetadata().get(CsvConnectorType.SYSTEM_NAME));
assertEquals(";", reopenSystem.getMetadata().get(CsvConnectorType.SEPARATOR));
assertEquals(usernameAttributeDto.getId().toString(), reopenSystem.getMetadata().get(CsvConnectorType.PRIMARY_SCHEMA_ATTRIBUTE));
// Delete created system.
systemService.delete(systemDto);
}
Aggregations