Fix: CM Handles for only hasAllModules Query 37/130337/3
authorlukegleeson <luke.gleeson@est.tech>
Wed, 17 Aug 2022 17:06:59 +0000 (18:06 +0100)
committerlukegleeson <luke.gleeson@est.tech>
Mon, 22 Aug 2022 09:57:05 +0000 (10:57 +0100)
hasAllModules was returning no CMHandles when queried by itself, only when paired with another query condition e.g. hasAllProperties
This fix means endpoint works as expected.
Reverted null check

Issue-ID: CPS-977
Signed-off-by: lukegleeson <luke.gleeson@est.tech>
Change-Id: Idafad4c9877941d121f5cbb98617c56a35a1cc94

cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/CmHandleQueries.java
cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/CmHandleQueriesSpec.groovy

index 92387ba..3dbb4a1 100644 (file)
@@ -91,7 +91,7 @@ public class CmHandleQueries {
         final Map<String, NcmpServiceCmHandle> firstQuery,
         final Map<String, NcmpServiceCmHandle> secondQuery) {
         if (firstQuery == NO_QUERY_TO_EXECUTE && secondQuery == NO_QUERY_TO_EXECUTE) {
-            return Collections.emptyMap();
+            return NO_QUERY_TO_EXECUTE;
         } else if (firstQuery == NO_QUERY_TO_EXECUTE) {
             return secondQuery;
         } else if (secondQuery == NO_QUERY_TO_EXECUTE) {
index 10a5d62..7d7258d 100644 (file)
@@ -82,7 +82,7 @@ class CmHandleQueriesSpec extends Specification {
             'the first query contains entries and second query is null'  | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle] | null                                                       || ['PNFDemo': pnfDemoCmHandle, 'PNFDemo2': pnfDemo2CmHandle]
             'the second query contains entries and first query is null'  | null                                                       | ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle] || ['PNFDemo': pnfDemoCmHandle, 'PNFDemo3': pnfDemo3CmHandle]
             'both queries are empty'                                     | [:]                                                        | [:]                                                        || [:]
-            'both queries are null'                                      | null                                                       | null                                                       || [:]
+            'both queries are null'                                      | null                                                       | null                                                       || null
     }
 
     def 'Get Cm Handles By State'() {