Search in sources :

Example 1 with SynchronizationMonitoringEvaluator

use of eu.bcvsolutions.idm.acc.monitoring.SynchronizationMonitoringEvaluator in project CzechIdMng by bcvsolutions.

the class SyncConfigMonitoringAutoConfigurationProcessorIntegrationTest method testAutoConfigure.

@Test
public void testAutoConfigure() {
    SysSystemDto system = getHelper().createTestResourceSystem(true);
    SysSystemMappingFilter mappingFilter = new SysSystemMappingFilter();
    mappingFilter.setSystemId(system.getId());
    List<SysSystemMappingDto> mappings = systemMappingService.find(mappingFilter, null).getContent();
    SysSystemMappingDto mapping = mappings.get(0);
    SysSystemAttributeMappingFilter attributeMappingFilter = new SysSystemAttributeMappingFilter();
    attributeMappingFilter.setSystemMappingId(mapping.getId());
    List<SysSystemAttributeMappingDto> attributes = schemaAttributeMappingService.find(attributeMappingFilter, null).getContent();
    SysSystemAttributeMappingDto nameAttribute = attributes.stream().filter(attribute -> {
        return attribute.getName().equals(TestHelper.ATTRIBUTE_MAPPING_NAME);
    }).findFirst().get();
    // Create default synchronization config.
    AbstractSysSyncConfigDto syncConfigCustom = new SysSyncIdentityConfigDto();
    syncConfigCustom.setCustomFilter(true);
    syncConfigCustom.setSystemMapping(mapping.getId());
    syncConfigCustom.setCorrelationAttribute(nameAttribute.getId());
    syncConfigCustom.setName(getHelper().createName());
    AbstractSysSyncConfigDto syncConfig = syncConfigService.save(syncConfigCustom);
    String evaluatorType = AutowireHelper.getTargetType(synchronizationMonitoringEvaluator);
    IdmMonitoringFilter filter = new IdmMonitoringFilter();
    filter.setEvaluatorType(evaluatorType);
    IdmMonitoringDto monitoring = monitoringService.find(filter, null).stream().filter(m -> {
        return syncConfig.getId().equals(m.getEvaluatorProperties().get(SynchronizationMonitoringEvaluator.PARAMETER_SYNCHRONIZATION));
    }).findFirst().orElse(null);
    Assert.assertNotNull(monitoring);
    syncConfigService.delete(syncConfig);
    monitoring = monitoringService.find(filter, null).stream().filter(m -> {
        return syncConfig.getId().equals(m.getEvaluatorProperties().get(SynchronizationMonitoringEvaluator.PARAMETER_SYNCHRONIZATION));
    }).findFirst().orElse(null);
    Assert.assertNull(monitoring);
}
Also used : IdmMonitoringFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringFilter) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) IdmMonitoringService(eu.bcvsolutions.idm.core.monitoring.api.service.IdmMonitoringService) Autowired(org.springframework.beans.factory.annotation.Autowired) Test(org.junit.Test) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) SynchronizationMonitoringEvaluator(eu.bcvsolutions.idm.acc.monitoring.SynchronizationMonitoringEvaluator) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) AutowireHelper(eu.bcvsolutions.idm.core.api.utils.AutowireHelper) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) List(java.util.List) SysSystemMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService) IdmMonitoringFilter(eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringFilter) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest) SysSyncConfigService(eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService) TestHelper(eu.bcvsolutions.idm.acc.TestHelper) Assert(org.junit.Assert) SysSystemAttributeMappingService(eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSyncIdentityConfigDto(eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto) SysSystemAttributeMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter) IdmMonitoringDto(eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto) SysSystemAttributeMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto) SysSystemMappingDto(eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto) SysSystemDto(eu.bcvsolutions.idm.acc.dto.SysSystemDto) AbstractSysSyncConfigDto(eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto) SysSystemMappingFilter(eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter) Test(org.junit.Test) AbstractIntegrationTest(eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)

Aggregations

TestHelper (eu.bcvsolutions.idm.acc.TestHelper)1 AbstractSysSyncConfigDto (eu.bcvsolutions.idm.acc.dto.AbstractSysSyncConfigDto)1 SysSyncIdentityConfigDto (eu.bcvsolutions.idm.acc.dto.SysSyncIdentityConfigDto)1 SysSystemAttributeMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemAttributeMappingDto)1 SysSystemDto (eu.bcvsolutions.idm.acc.dto.SysSystemDto)1 SysSystemMappingDto (eu.bcvsolutions.idm.acc.dto.SysSystemMappingDto)1 SysSystemAttributeMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemAttributeMappingFilter)1 SysSystemMappingFilter (eu.bcvsolutions.idm.acc.dto.filter.SysSystemMappingFilter)1 SynchronizationMonitoringEvaluator (eu.bcvsolutions.idm.acc.monitoring.SynchronizationMonitoringEvaluator)1 SysSyncConfigService (eu.bcvsolutions.idm.acc.service.api.SysSyncConfigService)1 SysSystemAttributeMappingService (eu.bcvsolutions.idm.acc.service.api.SysSystemAttributeMappingService)1 SysSystemMappingService (eu.bcvsolutions.idm.acc.service.api.SysSystemMappingService)1 AutowireHelper (eu.bcvsolutions.idm.core.api.utils.AutowireHelper)1 IdmMonitoringDto (eu.bcvsolutions.idm.core.monitoring.api.dto.IdmMonitoringDto)1 IdmMonitoringFilter (eu.bcvsolutions.idm.core.monitoring.api.dto.filter.IdmMonitoringFilter)1 IdmMonitoringService (eu.bcvsolutions.idm.core.monitoring.api.service.IdmMonitoringService)1 AbstractIntegrationTest (eu.bcvsolutions.idm.test.api.AbstractIntegrationTest)1 List (java.util.List)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1