Search in sources :

Example 46 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType 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)

Example 47 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method testReopenSystem.

@Test
public void testReopenSystem() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    StringBuilder sb = new StringBuilder();
    sb.append(this.getHelper().createName());
    sb.append(AdGroupConnectorType.LINE_SEPARATOR);
    sb.append(this.getHelper().createName());
    String groupContainersMock = sb.toString();
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.GROUP_CONTAINER_KEY, groupContainersMock);
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockSchema(systemDto);
    IdmRoleCatalogueDto mainCatalog = getHelper().createRoleCatalogue(getHelper().createName());
    // Enable wizard switches.
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.membershipSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignCatalogueSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleRemoveSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.removeCatalogueRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MAIN_ROLE_CATALOG, mainCatalog.getId().toString());
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    connectorTypeDto.setReopened(true);
    connectorTypeDto.getEmbedded().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    ConnectorTypeDto loadedConnectorTypeDto = connectorManager.load(connectorTypeDto);
    assertNotNull(loadedConnectorTypeDto);
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.PORT));
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.HOST));
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.USER));
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.SSL_SWITCH));
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.GROUP_CONTAINER_KEY));
    assertNotNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.GROUP_SYNC_ID));
    assertTrue(Boolean.parseBoolean(loadedConnectorTypeDto.getMetadata().get(SysSyncRoleConfig_.membershipSwitch.getName())));
    assertTrue(Boolean.parseBoolean(loadedConnectorTypeDto.getMetadata().get(SysSyncRoleConfig_.assignCatalogueSwitch.getName())));
    assertTrue(Boolean.parseBoolean(loadedConnectorTypeDto.getMetadata().get(SysSyncRoleConfig_.assignRoleSwitch.getName())));
    assertTrue(Boolean.parseBoolean(loadedConnectorTypeDto.getMetadata().get(SysSyncRoleConfig_.assignRoleRemoveSwitch.getName())));
    assertTrue(Boolean.parseBoolean(loadedConnectorTypeDto.getMetadata().get(SysSyncRoleConfig_.removeCatalogueRoleSwitch.getName())));
    assertNull(loadedConnectorTypeDto.getMetadata().get(MockAdGroupConnectorType.MEMBER_SYSTEM_MAPPING));
    // Clean
    systemService.delete(systemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 48 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method testOfFullSync.

@Test
public void testOfFullSync() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    // Create system with members.
    SysSystemDto memberSystemDto = createMemberSystem();
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(memberSystemDto.getId());
    mappingFilter.setOperationType(SystemOperationType.PROVISIONING);
    mappingFilter.setEntityType(SystemEntityType.IDENTITY);
    SysSystemMappingDto mappingDto = mappingService.find(mappingFilter, null).getContent().stream().findFirst().orElse(null);
    assertNotNull(mappingDto);
    StringBuilder sb = new StringBuilder();
    sb.append(this.getHelper().createName());
    sb.append(AdGroupConnectorType.LINE_SEPARATOR);
    sb.append(this.getHelper().createName());
    String groupContainersMock = sb.toString();
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.GROUP_CONTAINER_KEY, groupContainersMock);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MEMBER_SYSTEM_MAPPING, mappingDto.getId().toString());
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockSchema(systemDto);
    IdmRoleCatalogueDto mainCatalog = getHelper().createRoleCatalogue(getHelper().createName());
    // Enable wizard switches.
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.membershipSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignCatalogueSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.assignRoleRemoveSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(SysSyncRoleConfig_.removeCatalogueRoleSwitch.getName(), Boolean.TRUE.toString());
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.MAIN_ROLE_CATALOG, mainCatalog.getId().toString());
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    SysSyncConfigFilter syncConfigFilter = new SysSyncConfigFilter();
    syncConfigFilter.setSystemId(systemDto.getId());
    AbstractSysSyncConfigDto syncConfigDto = syncConfigService.find(syncConfigFilter, null).getContent().stream().findFirst().orElse(null);
    assertTrue(syncConfigDto instanceof SysSyncRoleConfigDto);
    SysSyncRoleConfigDto syncRoleConfigDto = (SysSyncRoleConfigDto) syncConfigDto;
    assertTrue(syncRoleConfigDto.isMembershipSwitch());
    assertTrue(syncRoleConfigDto.isRemoveCatalogueRoleSwitch());
    assertTrue(syncRoleConfigDto.isAssignRoleRemoveSwitch());
    assertTrue(syncRoleConfigDto.isAssignRoleSwitch());
    assertTrue(syncRoleConfigDto.isAssignCatalogueSwitch());
    assertNotNull(syncRoleConfigDto.getAssignCatalogueMappingAttribute());
    assertNotNull(syncRoleConfigDto.getSkipValueIfExcludedMappingAttribute());
    assertNotNull(syncRoleConfigDto.getForwardAcmMappingAttribute());
    assertNotNull(syncRoleConfigDto.getRoleMembersMappingAttribute());
    assertNotNull(syncRoleConfigDto.getRoleIdentifiersMappingAttribute());
    assertNotNull(syncRoleConfigDto.getMemberIdentifierAttribute());
    assertNotNull(syncRoleConfigDto.getMemberOfAttribute());
    // Clean
    systemService.delete(systemDto);
    systemService.delete(memberSystemDto);
}
Also used : ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) 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 49 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method testStepFour.

@Test
public void testStepFour() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    StringBuilder sb = new StringBuilder();
    sb.append(this.getHelper().createName());
    sb.append(AdGroupConnectorType.LINE_SEPARATOR);
    sb.append(this.getHelper().createName());
    String groupContainersMock = sb.toString();
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.GROUP_CONTAINER_KEY, groupContainersMock);
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_FOUR);
    // Generate mock schema.
    generateMockSchema(systemDto);
    // Execute step four.
    connectorManager.execute(connectorTypeDto);
    // Check containers in connector configuration.
    systemDto = systemService.get(systemDto.getId());
    IdmFormDefinitionDto connectorFormDefinition = systemService.getConnectorFormDefinition(systemDto);
    String newGroupContainers = containersToString(getValuesFromConnectorInstance(MockAdGroupConnectorType.BASE_CONTEXT_GROUP_KEY, systemDto, connectorFormDefinition));
    assertEquals(groupContainersMock.trim(), newGroupContainers.trim());
    // 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 -> RoleSynchronizationExecutor.ROLE_MEMBERSHIP_ID_FIELD.equals(attribute.getIdmPropertyName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> RoleSynchronizationExecutor.ROLE_MEMBERS_FIELD.equals(attribute.getIdmPropertyName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> RoleSynchronizationExecutor.ROLE_FORWARD_ACM_FIELD.equals(attribute.getIdmPropertyName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> RoleSynchronizationExecutor.ROLE_SKIP_VALUE_IF_EXCLUDED_FIELD.equals(attribute.getIdmPropertyName())));
    assertTrue(attributeMappingDtos.stream().anyMatch(attribute -> RoleSynchronizationExecutor.ROLE_CATALOGUE_FIELD.equals(attribute.getIdmPropertyName())));
    // Clean
    systemService.delete(systemDto);
}
Also used : AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSyncConfigFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) Autowired(org.springframework.beans.factory.annotation.Autowired) FormService(eu.bcvsolutions.idm.core.eav.api.service.FormService) IdmFormValueDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormValueDto) ResultCodeException(eu.bcvsolutions.idm.core.api.exception.ResultCodeException) MsAdSyncMappingRoleAutoAttributesProcessor(eu.bcvsolutions.idm.acc.event.processor.MsAdSyncMappingRoleAutoAttributesProcessor) After(org.junit.After) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmEntityStateService(eu.bcvsolutions.idm.core.api.service.IdmEntityStateService) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SystemOperationType(eu.bcvsolutions.idm.acc.domain.SystemOperationType) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) UUID(java.util.UUID) Collectors(java.util.stream.Collectors) IdmEntityStateDto(eu.bcvsolutions.idm.core.api.dto.IdmEntityStateDto) IdmRoleCatalogueService(eu.bcvsolutions.idm.core.api.service.IdmRoleCatalogueService) List(java.util.List) ConnectorManager(eu.bcvsolutions.idm.acc.service.api.ConnectorManager) Assert.assertFalse(org.junit.Assert.assertFalse) SysSchemaObjectClassService(eu.bcvsolutions.idm.acc.service.api.SysSchemaObjectClassService) AttributeMappingStrategyType(eu.bcvsolutions.idm.acc.domain.AttributeMappingStrategyType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) 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) Lists(com.google.common.collect.Lists) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) IdmRoleCatalogueDto(eu.bcvsolutions.idm.core.api.dto.IdmRoleCatalogueDto) IcAttributeInfo(eu.bcvsolutions.idm.ic.api.IcAttributeInfo) Before(org.junit.Before) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) Assert.assertNotNull(org.junit.Assert.assertNotNull) SysSystemService(eu.bcvsolutions.idm.acc.service.api.SysSystemService) Assert.assertTrue(org.junit.Assert.assertTrue) SysSyncRoleConfig_(eu.bcvsolutions.idm.acc.entity.SysSyncRoleConfig_) Test(org.junit.Test) SysSchemaAttributeService(eu.bcvsolutions.idm.acc.service.api.SysSchemaAttributeService) IdmFormDefinitionDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormDefinitionDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSyncRoleConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncRoleConfigDto) Assert.assertNull(org.junit.Assert.assertNull) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) BaseDto(eu.bcvsolutions.idm.core.api.dto.BaseDto) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) Assert.assertEquals(org.junit.Assert.assertEquals) Transactional(org.springframework.transaction.annotation.Transactional) ConnectorTypeDto(eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) 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 50 with ConnectorType

use of eu.bcvsolutions.idm.acc.service.api.ConnectorType in project CzechIdMng by bcvsolutions.

the class AdGroupConnectorTypeTest method testAssignUserToGroup.

@Test
public void testAssignUserToGroup() {
    ConnectorType connectorType = connectorManager.getConnectorType(MockAdGroupConnectorType.NAME);
    ConnectorTypeDto connectorTypeDto = connectorManager.convertTypeToDto(connectorType);
    SysSystemDto systemDto = createSystem(this.getHelper().createName(), connectorTypeDto);
    connectorTypeDto.getMetadata().put(MockAdGroupConnectorType.SYSTEM_DTO_KEY, systemDto.getId().toString());
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.STEP_CREATE_USER_TEST);
    // Execute step for testing permissions to create user.
    ConnectorTypeDto stepExecutedResult = connectorManager.execute(connectorTypeDto);
    String entityStateId = stepExecutedResult.getMetadata().get(MockAdGroupConnectorType.ENTITY_STATE_WITH_TEST_CREATED_USER_DN_KEY);
    assertNotNull(entityStateId);
    IdmEntityStateDto entityStateDto = entityStateService.get(UUID.fromString(entityStateId));
    assertNotNull(entityStateDto);
    connectorTypeDto.setWizardStepName(MockAdGroupConnectorType.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) AdGroupConnectorType(eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType) MockAdUserConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType) ConnectorType(eu.bcvsolutions.idm.acc.service.api.ConnectorType) MockAdGroupConnectorType(eu.bcvsolutions.idm.acc.service.impl.mock.MockAdGroupConnectorType) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

ConnectorType (eu.bcvsolutions.idm.acc.service.api.ConnectorType)58 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)56 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)45 Test (org.junit.Test)45 ConnectorTypeDto (eu.bcvsolutions.idm.acc.dto.ConnectorTypeDto)41 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)25 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)24 MockAdUserConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockAdUserConnectorType)22 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)19 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)19 BaseDto (eu.bcvsolutions.idm.core.api.dto.BaseDto)18 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)17 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)16 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)16 SysRoleSystemFilter (eu.bcvsolutions.idm.acc.dto.filter.SysRoleSystemFilter)16 MockCrossDomainAdUserConnectorType (eu.bcvsolutions.idm.acc.service.impl.mock.MockCrossDomainAdUserConnectorType)16 UUID (java.util.UUID)16 ProvisioningAttributeDto (eu.bcvsolutions.idm.acc.dto.ProvisioningAttributeDto)15 AdGroupConnectorType (eu.bcvsolutions.idm.acc.connector.AdGroupConnectorType)14 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)14