Search in sources :

Example 11 with ConnectorTypeDto

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;
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 12 with ConnectorTypeDto

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);
}
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 13 with ConnectorTypeDto

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);
}
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 14 with ConnectorTypeDto

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);
}
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) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 15 with ConnectorTypeDto

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);
}
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)

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