use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByOnlySchemaName.
@Test
public void testFilterByOnlySchemaName() {
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);
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setSystemMappingId(mappingDto.getId());
filter.setSchemaAttributeName(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_FIRSTNAME, attributeMappingDto.getName());
assertEquals(mappingDto.getId(), attributeMappingDto.getSystemMapping());
SysSchemaAttributeDto schemaAttributeDto = schemaAttributeService.get(attributeMappingDto.getSchemaAttribute());
String newName = getHelper().createName();
schemaAttributeDto.setName(newName);
schemaAttributeService.save(schemaAttributeDto);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(0, attributeMappings.size());
filter.setSchemaAttributeName(newName);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(schemaAttributeDto.getId(), attributeMappingDto.getSchemaAttribute());
assertEquals(mappingDto.getId(), attributeMappingDto.getSystemMapping());
// Empty filter
filter = new SysSystemAttributeMappingFilter();
filter.setSchemaAttributeName(newName);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(schemaAttributeDto.getId(), attributeMappingDto.getSchemaAttribute());
assertEquals(mappingDto.getId(), attributeMappingDto.getSystemMapping());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByEntityTypeAndOperationNotFound.
@Test
public void testFilterByEntityTypeAndOperationNotFound() {
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());
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setSystemId(system.getId());
filter.setEntityType(SystemEntityType.IDENTITY);
filter.setOperationType(SystemOperationType.SYNCHRONIZATION);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(0, attributeMappings.size());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByAuthenticationAttributeNotFound.
@Test
public void testFilterByAuthenticationAttributeNotFound() {
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());
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setSystemId(system.getId());
filter.setAuthenticationAttribute(Boolean.TRUE);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(0, attributeMappings.size());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByEntityTypeAndOperationAndUid.
@Test
public void testFilterByEntityTypeAndOperationAndUid() {
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());
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setSystemId(system.getId());
filter.setEntityType(SystemEntityType.IDENTITY);
filter.setOperationType(SystemOperationType.PROVISIONING);
filter.setIsUid(Boolean.FALSE);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
// Without UID attribute
assertEquals(5, attributeMappings.size());
filter.setIsUid(Boolean.TRUE);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
assertTrue(attributeMappingDto.isUid());
assertEquals(TestHelper.ATTRIBUTE_MAPPING_NAME, attributeMappingDto.getName());
}
use of eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceFilterTest method testFilterByDisable.
@Test
public void testFilterByDisable() {
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);
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setSystemMappingId(mappingDto.getId());
filter.setName(TestHelper.ATTRIBUTE_MAPPING_LASTNAME);
List<SysSystemAttributeMappingDto> attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
SysSystemAttributeMappingDto attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertFalse(attributeMappingDto.isDisabledAttribute());
filter.setDisabledAttribute(Boolean.FALSE);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertFalse(attributeMappingDto.isDisabledAttribute());
filter.setDisabledAttribute(Boolean.TRUE);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(0, attributeMappings.size());
attributeMappingDto.setDisabledAttribute(true);
attributeMappingDto = systemAttributeMappingService.save(attributeMappingDto);
attributeMappings = systemAttributeMappingService.find(filter, null).getContent();
assertEquals(1, attributeMappings.size());
attributeMappingDto = attributeMappings.get(0);
assertEquals(TestHelper.ATTRIBUTE_MAPPING_LASTNAME, attributeMappingDto.getName());
assertTrue(attributeMappingDto.isDisabledAttribute());
}
Aggregations