Search in sources :

Example 31 with ConnectorTypeDto

use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.

the class AdUserConnectorTypeTest method testStepFour.

@Test
public void testStepFour() {
    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);
    connectorTypeDto.setWizardStepName(MockAdUserConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockSchema(systemDto);
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    // Check containers on the system's operationOptions.
    systemDto = systemService.get(systemDto.getId());
    IdmFormDefinitionDto operationOptionsFormDefinition = systemService.getOperationOptionsConnectorFormDefinition(systemDto);
    String newUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.NEW_USER_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(newUserContainerMock, newUserContainer);
    String deletedUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.DELETE_USER_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    // Protected mode is not active -> delete user container should be null.
    assertNull(deletedUserContainer);
    String searchUserContainer = getValueFromConnectorInstance(MockAdUserConnectorType.USER_SEARCH_CONTAINER_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(userContainerMock, searchUserContainer);
    String domain = getValueFromConnectorInstance(MockAdUserConnectorType.DOMAIN_KEY, systemDto, operationOptionsFormDefinition);
    assertEquals(domainMock, domain);
    // Check created schema attributes.
    SysSchemaAttributeFilter schemaAttributeFilter = new SysSchemaAttributeFilter();
    schemaAttributeFilter.setSystemId(systemDto.getId());
    List<SysSchemaAttributeDto> attributes = schemaAttributeService.find(schemaAttributeFilter, null).getContent();
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.NAME.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.PASSWORD.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> IcAttributeInfo.ENABLE.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName())));
    assertTrue(attributes.stream().anyMatch(attribute -> MockAdUserConnectorType.SAM_ACCOUNT_NAME_ATTRIBUTE.equals(attribute.getName())));
    // Check created schema attributes.
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemId(systemDto.getId());
    List<SysSystemAttributeMappingDto> attributeMappingDtos = attributeMappingService.find(attributeMappingFilter, null).getContent();
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.NAME.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.PASSWORD.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> IcAttributeInfo.ENABLE.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.LDAP_GROUPS_ATTRIBUTE.equals(attribute.getName()) && AttributeMappingStrategyType.MERGE == attribute.getStrategyType()));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> MockAdUserConnectorType.SAM_ACCOUNT_NAME_ATTRIBUTE.equals(attribute.getName())));
    // Pairing sync wasn't created.
    SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
    syncConfigFilter.setSystemId(systemDto.getId());
    int syncCount = syncConfigService.find(syncConfigFilter, null).getContent().size();
    assertEquals(0, syncCount);
    // Clean
    systemService.delete(systemDto);
}
Also used : AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SynchronizationInactiveOwnerBehaviorType(eu.bcvsolutions.idm.acc.domain.SynchronizationInactiveOwnerBehaviorType) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) IcObjectClassInfo(eu.bcvsolutions.idm.ic.api.IcObjectClassInfo) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) After(org.junit.After) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmEntityStateService(eu.bcvsolutions.idm.core.api.service.IdmEntityStateService) Before(org.junit.Before) IcAttributeInfo(eu.bcvsolutions.idm.ic.api.IcAttributeInfo) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) Assert.assertTrue(org.junit.Assert.assertTrue) Test(org.junit.Test) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) List(java.util.List) Assert.assertNull(org.junit.Assert.assertNull) ConnectorManager(eu.bcvsolutions.idm.acc.service.api.ConnectorManager) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) Transactional(org.springframework.transaction.annotation.Transactional) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 32 with ConnectorTypeDto

use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.

the class AdUserConnectorTypeTest method testPairingSync.

@Test
public void testPairingSync() {
    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);
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(systemDto.getId());
    mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    List<SysSystemMappingDto> mappingDtos = mappingService.find(mappingFilter, null).getContent();
    assertEquals(1, mappingDtos.size());
    // Protected mode is activated.
    assertTrue(mappingDtos.get(0).isProtectionEnabled());
    // Provisioning context is used.
    assertTrue(mappingDtos.get(0).isAddContextConnectorObject());
    mappingFilter.setOperationType(SystemOperationType.SYNCHRONIZATION);
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    mappingDtos = mappingService.find(mappingFilter, null).getContent();
    // Sync mapping must exists.
    assertEquals(1, mappingDtos.size());
    // Pairing sync should be created.
    SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
    syncConfigFilter.setSystemId(systemDto.getId());
    List<AbstractSysSyncConfigDto> configDtos = syncConfigService.find(syncConfigFilter, null).getContent();
    assertEquals(1, configDtos.size());
    SysSyncIdentityConfigDto sync = (SysSyncIdentityConfigDto) configDtos.get(0);
    // Protected mode is activated.
    assertEquals(SynchronizationInactiveOwnerBehaviorType.LINK_PROTECTED, sync.getInactiveOwnerBehavior());
    assertNotNull(sync.getDefaultRole());
    // Clean
    systemService.delete(systemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 33 with ConnectorTypeDto

use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.

the class CrossDomainAdUserConnectorTypeTest method initSystem.

private SysSystemDto initSystem(ConnectorType connectorType) {
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(connectorType.getId() + "_" + this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    String newUserContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.NEW_USER_CONTAINER_KEY, newUserContainerMock);
    String userContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.USER_SEARCH_CONTAINER_KEY, userContainerMock);
    String deletedUserContainerMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.DELETE_USER_CONTAINER_KEY, deletedUserContainerMock);
    String domainMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.DOMAIN_KEY, domainMock);
    String defaultRoleMock = this.getHelper().createName();
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.NEW_ROLE_WITH_SYSTEM_CODE, defaultRoleMock);
    connectorTypeDto.setWizardStepName(MockCrossDomainAdUserConnectorType.STEP_FOUR);
    // Activate pairing sync.
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.PAIRING_SYNC_SWITCH_KEY, "true");
    // Activate protected sync.
    connectorTypeDto.getMetadata().put(MockCrossDomainAdUserConnectorType.PROTECTED_MODE_SWITCH_KEY, "true");
    // Generate mock schema.
    generateMockSchema(systemDto);
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    return systemDto;
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) GuardedString(org.identityconnectors.common.security.GuardedString) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 34 with ConnectorTypeDto

use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.

the class AbstractJdbcConnectorTypeTest method testJdbcFirstStep.

public void testJdbcFirstStep() {
    // If not, whole test will be skipped.
    if (!getJdbcConnectorTypeDriverName().equals(getDriver())) {
        // Skip test.
        return;
    }
    ConnectorTypeDto mockPostgresqlConnectorTypeDto = getConnectorTypeDto();
    mockPostgresqlConnectorTypeDto.setReopened(false);
    mockPostgresqlConnectorTypeDto.setId(this.getJdbcConnectorType());
    ConnectorTypeDto jdbcConnectorTypeDto = connectorManager.load(mockPostgresqlConnectorTypeDto);
    assertNotNull(jdbcConnectorTypeDto);
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.HOST, this.getHost());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.PORT, this.getPort());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.DATABASE, this.getDatabase());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.USER, this.getUsername());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.PASSWORD, this.getPassword());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.TABLE, "idm_identity");
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.KEY_COLUMN, "username");
    jdbcConnectorTypeDto.setWizardStepName(AbstractJdbcConnectorType.STEP_ONE_CREATE_SYSTEM);
    // Execute the first step.
    ConnectorTypeDto stepExecutedResult = connectorManager.execute(jdbcConnectorTypeDto);
    // The system had to be created.
    BaseDto system = stepExecutedResult.getEmbedded().get(AbstractJdbcConnectorType.SYSTEM_DTO_KEY);
    assertTrue(system instanceof SysSystemDto);
    SysSystemDto systemDto = systemService.get(system.getId());
    assertNotNull(systemDto);
    // Load connector properties from created system.
    IcConnectorInstance connectorInstance = systemService.getConnectorInstance(systemDto);
    assertEquals("net.tirasa.connid.bundles.db.table.DatabaseTableConnector", connectorInstance.getConnectorKey().getConnectorName());
    IdmFormDefinitionDto connectorFormDef = this.systemService.getConnectorFormDefinition(systemDto);
    // Check host.
    Assert.assertEquals(this.getHost(), getValueFromConnectorInstance(AbstractJdbcConnectorType.HOST, systemDto, connectorFormDef));
    // Check port.
    Assert.assertEquals(this.getPort(), getValueFromConnectorInstance(AbstractJdbcConnectorType.PORT, systemDto, connectorFormDef));
    // Check database.
    Assert.assertEquals(this.getDatabase(), getValueFromConnectorInstance(AbstractJdbcConnectorType.DATABASE, systemDto, connectorFormDef));
    // Check user.
    Assert.assertEquals(this.getUsername(), getValueFromConnectorInstance(AbstractJdbcConnectorType.USER, systemDto, connectorFormDef));
    // Check password.
    assertEquals("idm_identity", getValueFromConnectorInstance(AbstractJdbcConnectorType.TABLE, systemDto, connectorFormDef));
    // Delete created system.
    systemService.delete(systemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) IcConnectorInstance(eu.bcvsolutions.idm.ic.api.IcConnectorInstance) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 35 with ConnectorTypeDto

use of eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto in project CzechIdMng by bcvsolutions.

the class AbstractJdbcConnectorTypeTest method testReopenSystemInWizard.

public void testReopenSystemInWizard() {
    // If not, whole test will be skipped.
    if (!getJdbcConnectorTypeDriverName().equals(getDriver())) {
        // Skip test.
        return;
    }
    ConnectorTypeDto mockPostgresqlConnectorTypeDto = getConnectorTypeDto();
    mockPostgresqlConnectorTypeDto.setReopened(false);
    mockPostgresqlConnectorTypeDto.setId(this.getJdbcConnectorType());
    ConnectorTypeDto jdbcConnectorTypeDto = connectorManager.load(mockPostgresqlConnectorTypeDto);
    assertNotNull(jdbcConnectorTypeDto);
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.HOST, this.getHost());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.PORT, this.getPort());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.DATABASE, this.getDatabase());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.USER, this.getUsername());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.PASSWORD, this.getPassword());
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.TABLE, "idm_identity");
    jdbcConnectorTypeDto.getMetadata().put(AbstractJdbcConnectorType.KEY_COLUMN, "username");
    jdbcConnectorTypeDto.setWizardStepName(AbstractJdbcConnectorType.STEP_ONE_CREATE_SYSTEM);
    // Execute the first step.
    ConnectorTypeDto stepExecutedResult = connectorManager.execute(jdbcConnectorTypeDto);
    // The system had to be created.
    BaseDto system = stepExecutedResult.getEmbedded().get(AbstractJdbcConnectorType.SYSTEM_DTO_KEY);
    assertTrue(system instanceof SysSystemDto);
    SysSystemDto systemDto = systemService.get(system.getId());
    assertNotNull(systemDto);
    // Load wizard data for existed system;
    ConnectorType connectorTypeBySystem = connectorManager.findConnectorTypeBySystem(systemDto);
    ConnectorTypeDto reopenSystem = getConnectorTypeDto();
    reopenSystem.setReopened(true);
    reopenSystem.setId(connectorTypeBySystem.getId());
    reopenSystem.getEmbedded().put(PostgresqlConnectorType.SYSTEM_DTO_KEY, systemDto);
    reopenSystem = connectorManager.load(reopenSystem);
    assertNotNull(reopenSystem);
    assertEquals(systemDto.getName(), reopenSystem.getMetadata().get(AbstractJdbcConnectorType.SYSTEM_NAME));
    Assert.assertEquals(this.getHost(), reopenSystem.getMetadata().get(AbstractJdbcConnectorType.HOST));
    Assert.assertEquals(this.getPort(), reopenSystem.getMetadata().get(AbstractJdbcConnectorType.PORT));
    Assert.assertEquals(this.getDatabase(), reopenSystem.getMetadata().get(AbstractJdbcConnectorType.DATABASE));
    Assert.assertEquals(this.getUsername(), reopenSystem.getMetadata().get(AbstractJdbcConnectorType.USER));
    // Password cannot be returned!
    Assert.assertNull(reopenSystem.getMetadata().get(AbstractJdbcConnectorType.PASSWORD));
    assertEquals("idm_identity", reopenSystem.getMetadata().get(AbstractJdbcConnectorType.TABLE));
    // Delete created system.
    systemService.delete(systemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AbstractJdbcConnectorType(eu.bcvsolutions.idm.acc.connector.AbstractJdbcConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) PostgresqlConnectorType(eu.bcvsolutions.idm.acc.connector.PostgresqlConnectorType) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) 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