CPS-341 Support for multiple data tree instances under 1 anchor
[cps.git] / cps-service / src / test / groovy / org / onap / cps / api / impl / E2ENetworkSliceSpec.groovy
index 2fc85aa..ccfb23b 100755 (executable)
@@ -3,6 +3,7 @@
  * Copyright (C) 2021-2022 Nordix Foundation.\r
  * Modifications Copyright (C) 2021-2022 Bell Canada.\r
  * Modifications Copyright (C) 2021 Pantheon.tech\r
+ * Modifications Copyright (C) 2022 TechMahindra Ltd.\r
  * ================================================================================\r
  * Licensed under the Apache License, Version 2.0 (the "License");\r
  * you may not use this file except in compliance with the License.\r
@@ -90,9 +91,9 @@ class E2ENetworkSliceSpec extends Specification {
         when: 'saveData method is invoked'\r
             cpsDataServiceImpl.saveData(dataspaceName, anchorName, jsonData, noTimestamp)\r
         then: 'Parameters are validated and processing is delegated to persistence service'\r
-            1 * mockDataStoreService.storeDataNode('someDataspace', 'someAnchor', _) >>\r
+            1 * mockDataStoreService.storeDataNodes('someDataspace', 'someAnchor', _) >>\r
                     { args -> dataNodeStored = args[2]}\r
-            def child = dataNodeStored.childDataNodes[0]\r
+            def child = dataNodeStored[0].childDataNodes[0]\r
             assert child.childDataNodes.size() == 1\r
         and: 'list of Tracking Area for a Coverage Area are stored with correct xpath and child nodes '\r
             def listOfTAForCoverageArea = child.childDataNodes[0]\r
@@ -122,10 +123,10 @@ class E2ENetworkSliceSpec extends Specification {
         when: 'saveData method is invoked'\r
             cpsDataServiceImpl.saveData('someDataspace', 'someAnchor', jsonData, noTimestamp)\r
         then: 'parameters are validated and processing is delegated to persistence service'\r
-            1 * mockDataStoreService.storeDataNode('someDataspace', 'someAnchor', _) >>\r
+            1 * mockDataStoreService.storeDataNodes('someDataspace', 'someAnchor', _) >>\r
                     { args -> dataNodeStored = args[2]}\r
         and: 'the size of the tree is correct'\r
-            def cpsRanInventory = TestUtils.getFlattenMapByXpath(dataNodeStored)\r
+            def cpsRanInventory = TestUtils.getFlattenMapByXpath(dataNodeStored[0])\r
             assert  cpsRanInventory.size() == 4\r
         and: 'ran-inventory contains the correct child node'\r
             def ranInventory = cpsRanInventory.get('/ran-inventory')\r