From 2b4c48824947478f12c7b2e7b962aeb6b46ae4fc Mon Sep 17 00:00:00 2001 From: arpitsingh Date: Fri, 3 Mar 2023 21:38:57 +0530 Subject: CPS-1526 Fix response message for PATCH operation - Fixed the Response code and message when trying to update multiple data trees at once - Response code changed to 400 - Since the patch operation across multiple data trees is not supported when xpath is set to root node xpath, appropriate message is returned in response - Existing functionality of updating one data node with root node xpath remains as it is. - Updated API documentation and release notes Issue-ID: CPS-1526 Signed-off-by: arpitsingh Change-Id: I5d25a06bb5d407316ccfb2f85877cbe56a9f6f31 --- .../org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cps-service/src/test') diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy index faa5d2edb..be397b92c 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy @@ -240,6 +240,17 @@ class CpsDataServiceImplSpec extends Specification { 'one leaf' | '{"name": "some-name"}' } + def 'Update multiple data nodes' () { + given: 'schema set for given dataspace and anchor refers multipleDataTree model' + setupSchemaSetMocks('multipleDataTree.yang') + and: 'json string with multiple data trees' + def updatedJsonData = '{"first-container":{"a-leaf":"a-new-Value"},"last-container":{"x-leaf":"x-new-value"}}' + when: 'update operation is performed on multiple data nodes' + objectUnderTest.updateNodeLeaves(dataspaceName, anchorName, '/', updatedJsonData, observedTimestamp) + then: 'expected exception is thrown' + thrown(DataValidationException) + } + def 'Update Bookstore node leaves' () { given: 'a DMI registry model' setupSchemaSetMocks('bookstore.yang') -- cgit 1.2.3-korg