use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceTest method isUidFitlerTest.
@Test
public void isUidFitlerTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
SysSystemDto system = createSystem();
SysSchemaObjectClassDto objectClass = createObjectClass(system);
SysSystemMappingDto systemMapping1 = testHelper.createMappingSystem(entityType, objectClass);
SysSystemMappingDto systemMapping2 = testHelper.createMappingSystem(entityType, objectClass);
SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping1, AttributeMappingStrategyType.CREATE, schemaAttribute.getId());
SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping2, strategyType, schemaAttribute.getId());
attributeMapping2.setUid(true);
attributeMappingService.save(attributeMapping2);
createAttributeMappingSystem(systemMapping1, AttributeMappingStrategyType.SET, schemaAttribute.getId());
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setIsUid(true);
filter.setSystemId(system.getId());
Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
assertEquals(1, result.getTotalElements());
assertTrue(result.getContent().contains(attributeMapping2));
assertFalse(result.getContent().contains(attributeMapping1));
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemAttributeMappingServiceTest method textFilterTest.
@Test
public void textFilterTest() {
IdmBasePermission permission = IdmBasePermission.ADMIN;
SystemEntityType entityType = SystemEntityType.IDENTITY;
AttributeMappingStrategyType strategyType = AttributeMappingStrategyType.MERGE;
SysSystemDto system = createSystem();
SysSchemaObjectClassDto objectClass = createObjectClass(system);
SysSystemMappingDto systemMapping = testHelper.createMappingSystem(entityType, objectClass);
SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(objectClass);
SysSystemAttributeMappingDto attributeMapping1 = createAttributeMappingSystem(systemMapping, strategyType, schemaAttribute.getId());
attributeMapping1.setName("OriginalName01");
attributeMappingService.save(attributeMapping1);
SysSystemAttributeMappingDto attributeMapping2 = createAttributeMappingSystem(systemMapping, AttributeMappingStrategyType.CREATE, schemaAttribute.getId());
attributeMapping2.setName("OriginalName21");
attributeMappingService.save(attributeMapping2);
SysSystemAttributeMappingFilter filter = new SysSystemAttributeMappingFilter();
filter.setText("OriginalName0");
Page<SysSystemAttributeMappingDto> result = attributeMappingService.find(filter, null, permission);
assertEquals(1, result.getTotalElements());
assertTrue(result.getContent().contains(attributeMapping1));
assertFalse(result.getContent().contains(attributeMapping2));
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemEntityServiceFilterTest method testUid.
@Test
public void testUid() {
SysSystemDto system = helper.createTestResourceSystem(false);
SysSystemEntityDto entity1 = createEntitySystem("test-" + System.currentTimeMillis(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
createEntitySystem("test-" + System.currentTimeMillis(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
createEntitySystem("test-" + System.currentTimeMillis(), SystemEntityType.CONTRACT, system.getId(), UUID.randomUUID());
//
SysSystemEntityFilter testFilter = new SysSystemEntityFilter();
testFilter.setUid(entity1.getUid());
Page<SysSystemEntityDto> pages = entityService.find(testFilter, null);
assertEquals(1, pages.getTotalElements());
assertEquals(entity1.getId(), pages.getContent().get(0).getId());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemEntityServiceIntegrationTest method testReferentialIntegrity.
@Test
public void testReferentialIntegrity() {
// system
SysSystemDto system = new SysSystemDto();
String systemName = "t_s_" + System.currentTimeMillis();
system.setName(systemName);
system = systemService.save(system);
// system entity
SysSystemEntityDto systemEntity = new SysSystemEntityDto();
systemEntity.setSystem(system.getId());
systemEntity.setEntityType(SystemEntityType.IDENTITY);
String uid = "se_uid_" + System.currentTimeMillis();
systemEntity.setUid(uid);
systemEntity = systemEntityService.save(systemEntity);
// account
AccAccountDto account = new AccAccountDto();
account.setSystem(system.getId());
account.setUid("test_uid_" + System.currentTimeMillis());
account.setAccountType(AccountType.PERSONAL);
account.setSystemEntity(systemEntity.getId());
account = accountService.save(account);
SysSystemEntityDto systemEntityDto = DtoUtils.getEmbedded(account, AccAccount_.systemEntity, SysSystemEntityDto.class);
assertEquals(uid, systemEntityDto.getUid());
systemEntityService.delete(systemEntity);
assertNull(accountService.get(account.getId()).getSystemEntity());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class DefaultSysSystemMappingServiceTest 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));
}
Aggregations