use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest 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(MockAdUserConnectorType.HOST, fakeHost);
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.PORT, "636");
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.USER, fakeHost);
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.PASSWORD, fakeHost);
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.SSL_SWITCH, "false");
connectorTypeDto.getMetadata().put(MockAdUserConnectorType.SYSTEM_NAME, systemName);
connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_ONE);
// Execute the first step.
ConnectorTypeDto stepExecutedResult = connectorManager.execute(connectorTypeDto);
BaseDto systemDto = stepExecutedResult.getEmbedded().get(MockAdUserConnectorType.SYSTEM_DTO_KEY);
assertNotNull("System ID cannot be null!", systemDto);
SysSystemDto system = systemService.get(systemDto.getId());
assertNotNull(system);
return system;
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testStepOne.
@Test
public void testStepOne() {
ConnectorType connectorType = connectorManager.getConnectorType(MockAdUserConnectorType.NAME);
ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testAssignUserToGroup.
@Test
public void testAssignUserToGroup() {
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_ASSIGN_GROUP_TEST);
// Execute step for testing permissions to assign user to the group.
connectorManager.execute(connectorTypeDto);
entityStateDto = entityStateService.get(UUID.fromString(entityStateId));
assertNotNull(entityStateDto);
// Clean
entityStateService.delete(entityStateDto);
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testReopenSystemWithoutOptionsAttributes.
@Test
public void testReopenSystemWithoutOptionsAttributes() {
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());
IdmFormDefinitionDto operationOptionsConnectorFormDefinition = systemService.getOperationOptionsConnectorFormDefinition(systemDto);
// Try to find attribute for one of container. If exist -> change code = simulate delete.
IdmFormAttributeDto userSearchContainerAttribute = operationOptionsConnectorFormDefinition.getMappedAttributeByCode(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY);
if (userSearchContainerAttribute != null) {
userSearchContainerAttribute.setCode(getHelper().createName());
formService.saveAttribute(userSearchContainerAttribute);
}
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);
// Clean
systemService.delete(systemDto);
}
use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.
the class AdUserConnectorTypeTest method testCreateUser.
@Test
public void testCreateUser() {
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);
String testUserName = stepExecutedResult.getMetadata().get(MockAdUserConnectorType.TEST_USERNAME_KEY);
String createdTestUserName = stepExecutedResult.getMetadata().get(MockAdUserConnectorType.TEST_CREATED_USER_DN_KEY);
assertNotNull(createdTestUserName);
assertEquals(testUserName, createdTestUserName);
// Clean
systemService.delete(systemDto);
}
Aggregations