use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testReopenSystem.
@Test
public void testReopenSystem() {
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);
connectorType = connectorManager.getConnectorType(MockAdUserConnectorType.NAME);
connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
connectorTypeDto.setReopened(true);
connectorTypeDto.getEmbedded().put(MockAdUserConnectorType.SYSTEM_DTO_KEY, systemDto);
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
ConnectorTypeDto loadedConnectorTypeDto = connectorManager.load(connectorTypeDto);
assertNotNull(loadedConnectorTypeDto);
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.PORT));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.HOST));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.USER));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.SSL_SWITCH));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.DOMAIN_KEY));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.NEW_USER_CONTAINER_KEY));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.DELETE_USER_CONTAINER_KEY));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.MAPPING_ID));
assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdUserConnectorType.PAIRING_SYNC_ID));
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testDeleteUser.
@Test
public void testDeleteUser() {
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());
connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_CREATE_USER_TEST);
// Execute step for testing permissions to create user.
ConnectorTypeDto stepExecutedResult = connectorManager.execute(connectorTypeDto);
String entityStateId = stepExecutedResult.getMetadata().get(MockAdUserConnectorType.ENTITY_STATE_WITH_TEST_CREATED_USER_DN_KEY);
assertNotNull(entityStateId);
IdmEntityStateDto entityStateDto = entityStateService.get(UUID.fromString(entityStateId));
assertNotNull(entityStateDto);
connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_DELETE_USER_TEST);
// Execute step for testing permissions to delete user.
connectorManager.execute(connectorTypeDto);
entityStateDto = entityStateService.get(UUID.fromString(entityStateId));
assertNull(entityStateDto);
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class CsvConnectorType method deployCsv.
@Transactional
public ConnectorTypeDto deployCsv(IdmAttachmentDto attachment, String goal) {
Path source = Paths.get(attachmentManager.getStoragePath(), attachment.getContentPath());
String finalPath = source.toString();
if (Strings.isNotBlank(goal)) {
Path goalPath = Paths.get(goal);
String lastPart = goalPath.getFileName().toString();
if (lastPart != null && lastPart.contains(".")) {
// Last part is file -> we need cut of it.
goalPath = goalPath.getParent();
}
Path target = Paths.get(goalPath.toString(), attachment.getName());
// Move CSV to path defined by user.
try {
finalPath = Files.move(source, target, StandardCopyOption.REPLACE_EXISTING).toString();
} catch (IOException e) {
throw new ResultCodeException(AccResultCode.WIZARD_CSV_CONNECTOR_UPLOAD_FAILED, e);
}
}
ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(this);
connectorTypeDto.getMetadata().put(FILE_PATH, finalPath);
return connectorTypeDto;
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class DefaultConnectorManager method convertTypeToDto.
@Override
public ConnectorTypeDto convertTypeToDto(ConnectorType connectorType) {
ConnectorTypeDto connectorTypeDto = new ConnectorTypeDto();
connectorTypeDto.setId(connectorType.getId());
connectorTypeDto.setName(connectorType.getId());
connectorTypeDto.setModule(connectorType.getModule());
connectorTypeDto.setConnectorName(connectorType.getConnectorName());
connectorTypeDto.setIconKey(connectorType.getIconKey());
connectorTypeDto.setMetadata(connectorType.getMetadata());
connectorTypeDto.setHideParentConnector(connectorType.hideParentConnector());
connectorTypeDto.setOrder(connectorType.getOrder());
return connectorTypeDto;
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class CrossDomainAdUserConnectorTypeTest method createSystem.
private SysSystemDto createSystem(String systemName, ConnectorTypeDto connectorTypeDto) {
connectorTypeDto.setReopened(false);
connectorManager.load(connectorTypeDto);
assertNotNull(connectorTypeDto);
String fakeHost = this.getHelper().createName();
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.HOST, fakeHost);
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.PORT, "636");
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.USER, fakeHost);
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.PASSWORD, fakeHost);
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.SSL_SWITCH, "false");
connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.SYSTEM_NAME, systemName);
connectorTypeDto.setWizardStepName(MockCrossDomainAdUserConnectorType.STEP_ONE);
// Execute the first step.
ConnectorTypeDto stepExecutedResult = connectorManager.execute(connectorTypeDto);
BaseDto systemDto = stepExecutedResult.getEmbedded().get(MockCrossDomainAdUserConnectorType.SYSTEM_DTO_KEY);
assertNotNull("System ID cannot be null!", systemDto);
SysSystemDto system = systemService.get(systemDto.getId());
assertNotNull(system);
return system;
}
Aggregations