diff options
author | danielhanrahan <daniel.hanrahan@est.tech> | 2024-02-21 19:50:32 +0000 |
---|---|---|
committer | danielhanrahan <daniel.hanrahan@est.tech> | 2024-02-22 09:46:14 +0000 |
commit | 60baf82e54d286426ce4f99f24658c11304b8a05 (patch) | |
tree | 7039431c34a29da6371fd52d851a75ea9525410e /cps-ncmp-service/src/main/java/org/onap | |
parent | 97c659a5a1bb08bb57b74e98bd43b76a02706554 (diff) |
Refactor check for no new modules in Module Sync
This change moves the check for no new module references into
DmiModelOperations::getNewYangResourcesFromDmi
(The method is only used by ModuleSyncService)
Issue-ID: CPS-2027
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
Change-Id: I3cc65e7a327148ebe01b98b61dc64b70872e2cf5
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
2 files changed, 6 insertions, 9 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncService.java index 8b70798eb1..333a6f28b2 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/inventory/sync/ModuleSyncService.java @@ -157,14 +157,7 @@ public class ModuleSyncService { final Collection<ModuleReference> moduleReferences) { final Collection<ModuleReference> identifiedNewModuleReferences = cpsModuleService .identifyNewModuleReferences(moduleReferences); - final Map<String, String> newModuleNameToContentMap; - if (identifiedNewModuleReferences.isEmpty()) { - newModuleNameToContentMap = NO_NEW_MODULES; - } else { - newModuleNameToContentMap = dmiModelOperations.getNewYangResourcesFromDmi(yangModelCmHandle, - identifiedNewModuleReferences); - } - return newModuleNameToContentMap; + return dmiModelOperations.getNewYangResourcesFromDmi(yangModelCmHandle, identifiedNewModuleReferences); } private String getModuleSetTag(final YangModelCmHandle yangModelCmHandle, final boolean inUpgrade) { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java index 32b5cb7304..dbe386d7ca 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/operations/DmiModelOperations.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation + * Copyright (C) 2021-2024 Nordix Foundation * Modifications Copyright (C) 2022 Bell Canada * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +27,7 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -83,6 +84,9 @@ public class DmiModelOperations extends DmiOperations { */ public Map<String, String> getNewYangResourcesFromDmi(final YangModelCmHandle yangModelCmHandle, final Collection<ModuleReference> newModuleReferences) { + if (newModuleReferences.isEmpty()) { + return Collections.emptyMap(); + } final String jsonWithDataAndDmiProperties = getRequestBodyToFetchYangResources( newModuleReferences, yangModelCmHandle.getDmiProperties()); final ResponseEntity<Object> responseEntity = getResourceFromDmiWithJsonData( |