Search in sources :

Example 16 with ConnectorTypeDto

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);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 17 with ConnectorTypeDto

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);
}
Also used : IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 18 with ConnectorTypeDto

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;
}
Also used : Path(java.nio.file.Path) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) IOException(java.io.IOException) Transactional(org.springframework.transaction.annotation.Transactional)

Example 19 with 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;
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)

Example 20 with 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;
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) GuardedString(org.identityconnectors.common.security.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Aggregations

ConnectorTypeDto (eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)51 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)43 Test (org.junit.Test)36 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)34 ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)33 MockAdUserConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType)22 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)18 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)16 AdGroupConnectorType (eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType)14 MockAdGroupConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType)14 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)13 IdmFormDefinitionDto (eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto)11 AbstractConnectorType (eu.bcvsolutions.idm.acc.connector.AbstractConnectorType)8 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)8 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)8 CsvConnectorType (eu.bcvsolutions.idm.acc.connector.CsvConnectorType)7 DefaultConnectorType (eu.bcvsolutions.idm.acc.connector.DefaultConnectorType)7 PostgresqlConnectorType (eu.bcvsolutions.idm.acc.connector.PostgresqlConnectorType)7 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)7 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)7