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);
}
Aggregations