Loading src/main/java/org/etsi/osl/hypo/api/tmf/services/common/ServiceRepositories.java +6 −1 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/services/common/ServiceRepositories.java: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Strings; import org.etsi.osl.hypo.api.tmf.common.api.constants.ApiConstants; import org.etsi.osl.hypo.api.tmf.common.api.helpers.ServiceCatalogHelper; import org.etsi.osl.hypo.api.tmf.common.api.services.RelatedPartyService; Loading Loading @@ -150,7 +151,11 @@ public class ServiceRepositories { service -> { Optional<Resource> dashboardResourceOptional = service.getSupportingResource().stream() .filter(resource -> resource.getType().equalsIgnoreCase(DASHBOARD_RESOURCE)) .filter( resource -> { String type = resource.getType(); return Strings.CS.equals(type, DASHBOARD_RESOURCE); }) .findFirst(); dashboardResourceOptional.ifPresentOrElse( resource -> resourceID.set(resource.getId()), Loading src/main/java/org/etsi/osl/hypo/api/tmf/services/inventory/api/services/ServiceInventoryService.java +25 −11 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/services/inventory/api/services/ServiceInventoryService.java: 25 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import org.etsi.osl.hypo.api.tmf.services.common.schema.ServiceSpecificationRef; import org.etsi.osl.hypo.api.tmf.services.common.schema.ServiceStateType; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.ServiceCreatorClassFromKafkaMessages; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.HealthStatusData; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.MonitorResults; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.ServiceMonitorRequest; import org.etsi.osl.hypo.api.tmf.services.inventory.api.mappers.ServiceMapper; import org.etsi.osl.hypo.api.tmf.services.inventory.api.repository.ServiceInventoryRepository; Loading Loading @@ -118,7 +119,9 @@ public class ServiceInventoryService { return createdService; } catch (Exception e) { String error = AlarmLogsConstants.POST_SERVICE_REQUEST_ALARM_LOG; throw new ValidationException(error); String format = String.format("for service with name %s", serviceDTO.getName()); logger.errorf(e, String.join("", error, format)); throw new ValidationException(format); } } Loading Loading @@ -279,15 +282,18 @@ public class ServiceInventoryService { String.format( AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Error message: %s", e.getMessage()); logger.error(error); throw new UpdateStateNotAllowedException(error); } catch (ServiceNotFoundException e) { String error = String.format( AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Error message: %s", e.getMessage()); logger.error(error); throw new ServiceNotFoundException(error); } catch (Exception e) { String error = AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Rules Execution Error"; logger.errorf(e, error); throw new ValidationException(error); } } Loading Loading @@ -331,11 +337,11 @@ public class ServiceInventoryService { updateSupportingService(service, state); } } catch (ServiceNotFoundException serviceNotFoundException) { } catch (ServiceNotFoundException e) { String errorMessage = String.format( NO_SERVICE_WITH_ID_S_WAS_FOUND_AND_UPDATE_IS_NOT_PERFORMED, service.getId()); logger.warnf(errorMessage); logger.warnf(e, errorMessage); throw new ServiceNotFoundException(errorMessage); } } Loading Loading @@ -446,10 +452,10 @@ public class ServiceInventoryService { this.handleServiceStates(service, newService.getState()); persistService(service); } catch (ServiceNotFoundException serviceNotFoundException) { } catch (ServiceNotFoundException e) { String errorMessage = String.format(NO_SERVICE_WITH_ID_S_WAS_FOUND_AND_UPDATE_IS_NOT_PERFORMED, id); logger.warnf(errorMessage); logger.warnf(e, errorMessage); throw new ServiceNotFoundException(errorMessage); } catch (UpdateStateNotAllowedException e) { throw e; Loading Loading @@ -509,12 +515,19 @@ public class ServiceInventoryService { logger.infof("Will update monitor resources for service with id %s", serviceId); Set<Resource> supportingResource = service.getSupportingResource(); data.getMonitorResults() .getResources() .forEach( MonitorResults monitorResults = data.getMonitorResults(); if (monitorResults != null) { List<org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.Resource> monitorResultsResources = monitorResults.getResources(); if (CollectionUtils.isNotEmpty(monitorResultsResources)) { monitorResultsResources.forEach( resource -> createOrUpdateCorrespondingResource(service, resource, supportingResource)); logger.infof("Completed updating monitor resources for service with id %s", serviceId); logger.infof( "Completed updating monitor resources for service with id %s", serviceId); } } }, () -> logger.warnf("Service with id %s was not found", serviceId)); } Loading Loading @@ -544,8 +557,9 @@ public class ServiceInventoryService { Service service = this.getServiceByIdWithLockWrite(serviceId); this.handleStateUpdate(service, serviceStateType); logger.infof("Service RFS with id: %s was updated to %s", serviceId, service); } catch (ServiceNotFoundException serviceNotFoundException) { logger.infof("No service with id %s was found and state update is not performed", serviceId); } catch (ServiceNotFoundException e) { logger.warnf( e, "No service with id %s was found and state update is not performed", serviceId); } } Loading Loading
src/main/java/org/etsi/osl/hypo/api/tmf/services/common/ServiceRepositories.java +6 −1 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/services/common/ServiceRepositories.java: 6 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import java.util.function.Predicate; import java.util.stream.Collectors; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Strings; import org.etsi.osl.hypo.api.tmf.common.api.constants.ApiConstants; import org.etsi.osl.hypo.api.tmf.common.api.helpers.ServiceCatalogHelper; import org.etsi.osl.hypo.api.tmf.common.api.services.RelatedPartyService; Loading Loading @@ -150,7 +151,11 @@ public class ServiceRepositories { service -> { Optional<Resource> dashboardResourceOptional = service.getSupportingResource().stream() .filter(resource -> resource.getType().equalsIgnoreCase(DASHBOARD_RESOURCE)) .filter( resource -> { String type = resource.getType(); return Strings.CS.equals(type, DASHBOARD_RESOURCE); }) .findFirst(); dashboardResourceOptional.ifPresentOrElse( resource -> resourceID.set(resource.getId()), Loading
src/main/java/org/etsi/osl/hypo/api/tmf/services/inventory/api/services/ServiceInventoryService.java +25 −11 Changes for src/main/java/org/etsi/osl/hypo/api/tmf/services/inventory/api/services/ServiceInventoryService.java: 25 added lines, 11 removed lines. Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import org.etsi.osl.hypo.api.tmf.services.common.schema.ServiceSpecificationRef; import org.etsi.osl.hypo.api.tmf.services.common.schema.ServiceStateType; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.ServiceCreatorClassFromKafkaMessages; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.HealthStatusData; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.MonitorResults; import org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.ServiceMonitorRequest; import org.etsi.osl.hypo.api.tmf.services.inventory.api.mappers.ServiceMapper; import org.etsi.osl.hypo.api.tmf.services.inventory.api.repository.ServiceInventoryRepository; Loading Loading @@ -118,7 +119,9 @@ public class ServiceInventoryService { return createdService; } catch (Exception e) { String error = AlarmLogsConstants.POST_SERVICE_REQUEST_ALARM_LOG; throw new ValidationException(error); String format = String.format("for service with name %s", serviceDTO.getName()); logger.errorf(e, String.join("", error, format)); throw new ValidationException(format); } } Loading Loading @@ -279,15 +282,18 @@ public class ServiceInventoryService { String.format( AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Error message: %s", e.getMessage()); logger.error(error); throw new UpdateStateNotAllowedException(error); } catch (ServiceNotFoundException e) { String error = String.format( AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Error message: %s", e.getMessage()); logger.error(error); throw new ServiceNotFoundException(error); } catch (Exception e) { String error = AlarmLogsConstants.PATCH_SERVICE_REQUEST_ALARM_LOG + " Rules Execution Error"; logger.errorf(e, error); throw new ValidationException(error); } } Loading Loading @@ -331,11 +337,11 @@ public class ServiceInventoryService { updateSupportingService(service, state); } } catch (ServiceNotFoundException serviceNotFoundException) { } catch (ServiceNotFoundException e) { String errorMessage = String.format( NO_SERVICE_WITH_ID_S_WAS_FOUND_AND_UPDATE_IS_NOT_PERFORMED, service.getId()); logger.warnf(errorMessage); logger.warnf(e, errorMessage); throw new ServiceNotFoundException(errorMessage); } } Loading Loading @@ -446,10 +452,10 @@ public class ServiceInventoryService { this.handleServiceStates(service, newService.getState()); persistService(service); } catch (ServiceNotFoundException serviceNotFoundException) { } catch (ServiceNotFoundException e) { String errorMessage = String.format(NO_SERVICE_WITH_ID_S_WAS_FOUND_AND_UPDATE_IS_NOT_PERFORMED, id); logger.warnf(errorMessage); logger.warnf(e, errorMessage); throw new ServiceNotFoundException(errorMessage); } catch (UpdateStateNotAllowedException e) { throw e; Loading Loading @@ -509,12 +515,19 @@ public class ServiceInventoryService { logger.infof("Will update monitor resources for service with id %s", serviceId); Set<Resource> supportingResource = service.getSupportingResource(); data.getMonitorResults() .getResources() .forEach( MonitorResults monitorResults = data.getMonitorResults(); if (monitorResults != null) { List<org.etsi.osl.hypo.api.tmf.services.inventory.api.kafka.incoming.monitor.Resource> monitorResultsResources = monitorResults.getResources(); if (CollectionUtils.isNotEmpty(monitorResultsResources)) { monitorResultsResources.forEach( resource -> createOrUpdateCorrespondingResource(service, resource, supportingResource)); logger.infof("Completed updating monitor resources for service with id %s", serviceId); logger.infof( "Completed updating monitor resources for service with id %s", serviceId); } } }, () -> logger.warnf("Service with id %s was not found", serviceId)); } Loading Loading @@ -544,8 +557,9 @@ public class ServiceInventoryService { Service service = this.getServiceByIdWithLockWrite(serviceId); this.handleStateUpdate(service, serviceStateType); logger.infof("Service RFS with id: %s was updated to %s", serviceId, service); } catch (ServiceNotFoundException serviceNotFoundException) { logger.infof("No service with id %s was found and state update is not performed", serviceId); } catch (ServiceNotFoundException e) { logger.warnf( e, "No service with id %s was found and state update is not performed", serviceId); } } Loading