Search in sources :

Example 51 with SysSystemDto

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());
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 52 with SysSystemDto

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());
}
Also used : SysSchemaAttributeDto(eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Example 53 with SysSystemDto

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;
}
Also used : SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSchemaObjectClassDto(eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto)

Example 54 with SysSystemDto

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();
        }
    }
}
Also used : IdmFormAttributeFilter(eu.bcvsolutions.idm.core.eav.api.dto.filter.IdmFormAttributeFilter) IdmFormAttributeDto(eu.bcvsolutions.idm.core.eav.api.dto.IdmFormAttributeDto) 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 55 with SysSystemDto

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);
}
Also used : AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) IdmContractGuaranteeDto(eu.bcvsolutions.idm.core.api.dto.IdmContractGuaranteeDto) SysSyncContractConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncContractConfigDto) IdmIdentityContractFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmIdentityContractFilter) IdmIdentityDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto) IdmIdentityContractDto(eu.bcvsolutions.idm.core.api.dto.IdmIdentityContractDto) IdmContractGuaranteeFilter(eu.bcvsolutions.idm.core.api.dto.filter.IdmContractGuaranteeFilter) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SysSyncLogDto(eu.bcvsolutions.idm.acc.dto.SysSyncLogDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) Test(org.junit.Test)

Aggregations

SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)256 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)167 Test (org.junit.Test)167 IdmIdentityDto (eu.bcvsolutions.idm.core.api.dto.IdmIdentityDto)98 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)82 AccAccountDto (eu.bcvsolutions.idm.acc.dto.AccAccountDto)56 IdmRoleDto (eu.bcvsolutions.idm.core.api.dto.IdmRoleDto)52 SysSchemaObjectClassDto (eu.bcvsolutions.idm.acc.dto.SysSchemaObjectClassDto)50 GuardedString (eu.bcvsolutions.idm.core.security.api.domain.GuardedString)45 SystemEntityType (eu.bcvsolutions.idm.acc.domain.SystemEntityType)42 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)42 SysProvisioningOperationDto (eu.bcvsolutions.idm.acc.dto.SysProvisioningOperationDto)32 SysSystemEntityDto (eu.bcvsolutions.idm.acc.dto.SysSystemEntityDto)32 IcConnectorObject (eu.bcvsolutions.idm.ic.api.IcConnectorObject)30 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)29 SysSyncLogDto (eu.bcvsolutions.idm.acc.dto.SysSyncLogDto)29 SysProvisioningOperationFilter (eu.bcvsolutions.idm.acc.dto.filter.SysProvisioningOperationFilter)29 SysSchemaAttributeDto (eu.bcvsolutions.idm.acc.dto.SysSchemaAttributeDto)28 AccIdentityAccountDto (eu.bcvsolutions.idm.acc.dto.AccIdentityAccountDto)27 IdmBasePermission (eu.bcvsolutions.idm.core.security.api.domain.IdmBasePermission)27