Search in sources :

Example 61 with SysSystemMappingDto

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

the class DefaultSysSystemMappingServiceIntegrationTest method testAutomaticGenerateOfMappedAttributesRoleCatalogue.

@Test
public void testAutomaticGenerateOfMappedAttributesRoleCatalogue() {
    SysSystemDto system = testHelper.createSystem(testHelper.createName());
    SysSchemaObjectClassDto schema = this.createObjectClass(system);
    createSchemaAttribute("__NAME__", schema);
    createSchemaAttribute("parent", schema);
    createSchemaAttribute("name", schema);
    // redundant to __NAME__
    createSchemaAttribute("code", schema);
    createSchemaAttribute("description", schema);
    createSchemaAttribute("not_exist", schema);
    SysSystemMappingDto mappingDto = new SysSystemMappingDto();
    mappingDto.setName(testHelper.createName());
    mappingDto.setEntityType(SystemEntityType.ROLE_CATALOGUE);
    mappingDto.setObjectClass(schema.getId());
    mappingDto.setOperationType(SystemOperationType.PROVISIONING);
    mappingDto = mappingService.publish(new SystemMappingEvent(SystemMappingEvent.SystemMappingEventType.CREATE, mappingDto, ImmutableMap.of(SysSystemMappingService.ENABLE_AUTOMATIC_CREATION_OF_MAPPING, true))).getContent();
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(mappingDto.getId());
    List<SysSystemAttributeMappingDto> mappingAttributes = mappingAttributeService.find(attributeMappingFilter, null).getContent();
    // Automatic attribute generating is enabled.
    assertEquals(4, mappingAttributes.size());
    SysSystemAttributeMappingDto primaryAttribute = mappingAttributes.stream().filter(attribute -> attribute.getName().equals("__NAME__")).findFirst().orElse(null);
    assertNotNull(primaryAttribute);
    assertTrue(primaryAttribute.isUid());
    assertEquals(IdmRoleCatalogue_.code.getName(), primaryAttribute.getIdmPropertyName());
    SysSystemAttributeMappingDto nameAttribute = mappingAttributes.stream().filter(attribute -> attribute.getName().equals("name")).findFirst().orElse(null);
    assertNotNull(nameAttribute);
    assertFalse(nameAttribute.isUid());
    assertEquals(IdmRoleCatalogue_.name.getName(), nameAttribute.getIdmPropertyName());
    SysSystemAttributeMappingDto parentAttribute = mappingAttributes.stream().filter(attribute -> attribute.getName().equals("parent")).findFirst().orElse(null);
    assertNotNull(parentAttribute);
    assertFalse(parentAttribute.isUid());
    assertEquals(IdmRoleCatalogue_.parent.getName(), parentAttribute.getIdmPropertyName());
    SysSystemAttributeMappingDto descriptionAttribute = mappingAttributes.stream().filter(attribute -> attribute.getName().equals("description")).findFirst().orElse(null);
    assertNotNull(descriptionAttribute);
    assertFalse(descriptionAttribute.isUid());
    assertEquals(IdmRoleCatalogue_.description.getName(), descriptionAttribute.getIdmPropertyName());
}
Also used : SystemMappingEvent(eu.bcvsolutions.idm.acc.event.SystemMappingEvent) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 62 with SysSystemMappingDto

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

the class DefaultSysSystemMappingServiceIntegrationTest method createProvisioningMappingSystem.

private SysSystemMappingDto createProvisioningMappingSystem(SystemEntityType type, SysSchemaObjectClassDto objectClass) {
    // system mapping
    SysSystemMappingDto mapping = new SysSystemMappingDto();
    mapping.setName("Name" + UUID.randomUUID());
    mapping.setEntityType(type);
    mapping.setObjectClass(objectClass.getId());
    mapping.setOperationType(SystemOperationType.PROVISIONING);
    return mappingService.save(mapping);
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)

Example 63 with SysSystemMappingDto

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

the class DefaultSysSystemMappingServiceIntegrationTest method treeTypeIdFilterTest.

@Test
public void treeTypeIdFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    IdmTreeTypeDto treeType = new IdmTreeTypeDto();
    treeType.setName("SomeTreeTypeName");
    treeType.setCode("CodeCodeCodeCode");
    treeType = treeTypeService.save(treeType);
    IdmTreeTypeDto treeType2 = new IdmTreeTypeDto();
    treeType2.setName("SomeTreeTypeName2");
    treeType2.setCode("CodeCodeCodeCode2");
    treeType2 = treeTypeService.save(treeType2);
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem1.setTreeType(treeType.getId());
    mappingSystem1 = mappingService.save(mappingSystem1);
    SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem2.setTreeType(treeType2.getId());
    mappingSystem2 = mappingService.save(mappingSystem2);
    SysSystemMappingFilter filter = new SysSystemMappingFilter();
    filter.setTreeTypeId(mappingSystem1.getTreeType());
    Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
    assertEquals(1, result.getTotalElements());
    assertTrue(result.getContent().contains(mappingSystem1));
    assertFalse(result.getContent().contains(mappingSystem2));
}
Also used : IdmTreeTypeDto(eu.bcvsolutions.idm.core.api.dto.IdmTreeTypeDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 64 with SysSystemMappingDto

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

the class DefaultSysSystemMappingServiceIntegrationTest method textFilterTest.

@Test
public void textFilterTest() {
    IdmBasePermission permission = IdmBasePermission.ADMIN;
    SystemEntityType entityType = SystemEntityType.IDENTITY;
    SysSystemDto system = createSystem();
    SysSchemaObjectClassDto objectClass = createObjectClass(system);
    SysSystemMappingDto mappingSystem1 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem1.setName("SomeName01");
    mappingService.save(mappingSystem1);
    SysSystemMappingDto mappingSystem2 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem2.setName("SomeName02");
    mappingService.save(mappingSystem2);
    SysSystemMappingDto mappingSystem3 = testHelper.createMappingSystem(entityType, objectClass);
    mappingSystem3.setName("SomeName22");
    mappingService.save(mappingSystem3);
    SysSystemMappingFilter filter = new SysSystemMappingFilter();
    filter.setText("SomeName0");
    Page<SysSystemMappingDto> result = mappingService.find(filter, null, permission);
    assertEquals(2, result.getTotalElements());
    assertTrue(result.getContent().contains(mappingSystem1));
    assertTrue(result.getContent().contains(mappingSystem2));
}
Also used : SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) IdmBasePermission(eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission) SystemEntityType(eu.bcvsolutions.idm.acc.domain.SystemEntityType) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Example 65 with SysSystemMappingDto

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

the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterBySchemaAttributeId.

@Test
public void testFilterBySchemaAttributeId() {
    SysSystemDto system = this.getHelper().createTestResourceSystem(true, getHelper().createName());
    // Generate second system for add mapped attributes
    this.getHelper().createTestResourceSystem(true, getHelper().createName());
    SysSystemMappingFilter filterMapping = new SysSystemMappingFilter();
    filterMapping.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(filterMapping, null).getContent();
    assertEquals(1, mappings.size());
    SysSystemMappingDto mappingDto = mappings.get(0);
    SysSchemaAttributeFilter schemaFilter = new SysSchemaAttributeFilter();
    schemaFilter.setSystemId(system.getId());
    schemaFilter.setName(TestHelper.ATTRIBUTE_MAPPING_EMAIL);
    List<SysSchemaAttributeDto> schemaAttributes = schemaAttributeService.find(schemaFilter, null).getContent();
    assertEquals(1, schemaAttributes.size());
    SysSchemaAttributeDto schemaAttributeDto = schemaAttributes.get(0);
    SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
    filter.setSchemaAttributeId(schemaAttributeDto.getId());
    List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
    assertEquals(1, attributeMappings.size());
    SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
    assertEquals(TestHelper.ATTRIBUTE_MAPPING_EMAIL, attributeMappingDto.getName());
    assertEquals(mappingDto.getId(), attributeMappingDto.getSystemMapping());
    assertEquals(schemaAttributeDto.getId(), attributeMappingDto.getSchemaAttribute());
}
Also used : SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSchemaAttributeFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)359 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)269 Test (org.junit.Test)208 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)180 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)172 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)134 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)106 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)95 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)90 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)89 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)80 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)70 UUID (java.util.UUID)60 SysSchemaAttributeFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSchemaAttributeFilter)58 SysRoleSystemDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemDto)56 SysSyncConfigFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSyncConfigFilter)42 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)38 TestResource (eu.bcvsolutions.idm.acc.entity.TestResource)38 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)36 SysRoleSystemAttributeDto (eu.bcvsolutions.idm.acc.dto.SysRoleSystemAttributeDto)36