use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class SysSystemMappingServiceValidationTest method testSystemMappingValidationNotMissingIdentifier.
@Test
public void testSystemMappingValidationNotMissingIdentifier() {
SysSystemDto system = createSystem();
SysSchemaObjectClassDto schema = createSchema(system.getId());
SysSystemMappingDto mapping = createMapping(schema.getId(), SystemOperationType.PROVISIONING);
SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(schema.getId());
createAttributeMapping(mapping.getId(), schemaAttribute.getId(), true, "");
mappingService.validate(mapping.getId());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class SysSystemMappingServiceValidationTest method testSystemMappingValidationMissingIdentifier.
@Test(expected = ResultCodeException.class)
public void testSystemMappingValidationMissingIdentifier() {
SysSystemDto system = createSystem();
SysSchemaObjectClassDto schema = createSchema(system.getId());
SysSystemMappingDto mapping = createMapping(schema.getId(), SystemOperationType.PROVISIONING);
SysSchemaAttributeDto schemaAttribute = createSchemaAttribute(schema.getId());
createAttributeMapping(mapping.getId(), schemaAttribute.getId(), false, "");
mappingService.validate(mapping.getId());
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class GenerateSchemaWithEavTest method initData.
private SysSystemDto initData() {
// create test system
SysSystemDto system = helper.createSystem(TestSchemaResource.TABLE_NAME, null, null, "NAME");
Assert.assertNotNull(system);
// generate schema for system
List<SysSchemaObjectClassDto> objectClasses = systemService.generateSchema(system);
// Create synchronization mapping
SysSystemMappingDto syncSystemMapping = new SysSystemMappingDto();
syncSystemMapping.setName("default_generate_schema_" + System.currentTimeMillis());
syncSystemMapping.setEntityType(SystemEntityType.IDENTITY);
syncSystemMapping.setOperationType(SystemOperationType.SYNCHRONIZATION);
syncSystemMapping.setObjectClass(objectClasses.get(0).getId());
final SysSystemMappingDto syncMapping = systemMappingService.save(syncSystemMapping);
createMapping(system, syncMapping);
return system;
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class GenerateSchemaWithEavTest method testFormAttributeType.
@Test
public void testFormAttributeType() {
IdmFormDefinitionDto definition = formService.getDefinition(IdmIdentity.class);
IdmFormAttributeFilter filter = new IdmFormAttributeFilter();
filter.setDefinitionId(definition.getId());
//
SysSystemDto systemDto = this.initData();
filter.setText("in resource " + systemDto.getName());
//
long totalFormAttributesSecond = formAttributeService.find(filter, null).getTotalElements();
//
// 9 new eav attribute
assertEquals(9, totalFormAttributesSecond);
//
for (IdmFormAttributeDto attribute : formAttributeService.find(filter, null)) {
if (attribute.getCode().toLowerCase().equals("boolean_value")) {
assertEquals(PersistentType.BOOLEAN, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("byte_value")) {
assertEquals(PersistentType.BYTEARRAY, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("date_value")) {
// TODO: date value is saved as text
assertEquals(PersistentType.TEXT, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("double_value")) {
assertEquals(PersistentType.DOUBLE, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("int_value")) {
assertEquals(PersistentType.INT, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("long_value")) {
assertEquals(PersistentType.LONG, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("short_text_value")) {
// TODO: now is short text saved as TEXT
assertEquals(PersistentType.TEXT, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("string_value")) {
assertEquals(PersistentType.TEXT, attribute.getPersistentType());
} else if (attribute.getCode().toLowerCase().equals("uuid_value")) {
assertEquals(PersistentType.BYTEARRAY, attribute.getPersistentType());
} else {
fail();
}
}
}
use of eu.bcvsolutions.idm.acc.dto.SysSystemDto in project CzechIdMng by bcvsolutions.
the class IdentityContractSyncTest method defaultLeaderTest.
@Test
public void defaultLeaderTest() {
SysSystemDto system = initData();
Assert.assertNotNull(system);
AbstractSysSyncConfigDto config = doCreateSyncConfig(system);
Assert.assertTrue(config instanceof SysSyncContractConfigDto);
helper.createIdentity(CONTRACT_OWNER_ONE);
helper.createIdentity(CONTRACT_OWNER_TWO);
helper.createIdentity(CONTRACT_LEADER_ONE);
IdmIdentityDto defaultLeader = helper.createIdentity(CONTRACT_LEADER_TWO);
// Set default leader to sync configuration
SysSyncContractConfigDto configContract = (SysSyncContractConfigDto) config;
configContract.setDefaultLeader(defaultLeader.getId());
config = syncConfigService.save(configContract);
IdmIdentityContractFilter contractFilter = new IdmIdentityContractFilter();
contractFilter.setProperty(IdmIdentityContract_.position.getName());
contractFilter.setValue("1");
Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
contractFilter.setValue("2");
Assert.assertEquals(0, contractService.find(contractFilter, null).getTotalElements());
synchornizationService.setSynchronizationConfigId(config.getId());
synchornizationService.process();
SysSyncLogDto log = checkSyncLog(config, SynchronizationActionType.CREATE_ENTITY, 3);
Assert.assertFalse(log.isRunning());
Assert.assertFalse(log.isContainsError());
contractFilter.setValue("1");
List<IdmIdentityContractDto> contractsOne = contractService.find(contractFilter, null).getContent();
Assert.assertEquals(1, contractsOne.size());
IdmContractGuaranteeFilter guaranteeFilter = new IdmContractGuaranteeFilter();
guaranteeFilter.setIdentityContractId(contractsOne.get(0).getId());
List<IdmContractGuaranteeDto> gurantees = guaranteeService.find(guaranteeFilter, null).getContent();
Assert.assertEquals(1, gurantees.size());
IdmIdentityDto guarantee = DtoUtils.getEmbedded(gurantees.get(0), IdmContractGuarantee_.guarantee, IdmIdentityDto.class);
// Direct leader from resource
Assert.assertEquals(CONTRACT_LEADER_ONE, guarantee.getUsername());
contractFilter.setValue("2");
List<IdmIdentityContractDto> contractsTwo = contractService.find(contractFilter, null).getContent();
Assert.assertEquals(1, contractsTwo.size());
guaranteeFilter.setIdentityContractId(contractsTwo.get(0).getId());
gurantees = guaranteeService.find(guaranteeFilter, null).getContent();
Assert.assertEquals(1, gurantees.size());
guarantee = DtoUtils.getEmbedded(gurantees.get(0), IdmContractGuarantee_.guarantee, IdmIdentityDto.class);
// Default leader
Assert.assertEquals(CONTRACT_LEADER_TWO, guarantee.getUsername());
contractFilter.setValue("3");
List<IdmIdentityContractDto> contractsThree = contractService.find(contractFilter, null).getContent();
Assert.assertEquals(1, contractsThree.size());
guaranteeFilter.setIdentityContractId(contractsThree.get(0).getId());
gurantees = guaranteeService.find(guaranteeFilter, null).getContent();
Assert.assertEquals(1, gurantees.size());
guarantee = DtoUtils.getEmbedded(gurantees.get(0), IdmContractGuarantee_.guarantee, IdmIdentityDto.class);
// Default leader
Assert.assertEquals(CONTRACT_LEADER_TWO, guarantee.getUsername());
// Delete log
syncLogService.delete(log);
}
Aggregations