From: aditya puthuparambil Date: Mon, 8 Nov 2021 17:19:11 +0000 (+0000) Subject: Merge "CPS-475: Fix Sonar Qube Violations" X-Git-Tag: mr/823/126723/7~36 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=70a23d8ae12e3d3ade02e946556c976b708be73d;hp=3d8ee6a5e81faa53b438c8cf78d3403b6df678e1;p=cps.git Merge "CPS-475: Fix Sonar Qube Violations" --- diff --git a/cps-ncmp-rest/docs/openapi/ncmp.yml b/cps-ncmp-rest/docs/openapi/ncmp.yml index 9e3560a2f..611e84e01 100755 --- a/cps-ncmp-rest/docs/openapi/ncmp.yml +++ b/cps-ncmp-rest/docs/openapi/ncmp.yml @@ -258,6 +258,37 @@ resourceDataForPassthroughRunning: 404: $ref: 'components.yaml#/components/responses/NotFound' + put: + tags: + - network-cm-proxy + summary: Update resource data from pass-through running for a cm handle + description: Update resource data from pass-through running for the given cm handle + operationId: updateResourceDataRunningForCmHandle + parameters: + - $ref: 'components.yaml#/components/parameters/cmHandleInPath' + - $ref: 'components.yaml#/components/parameters/resourceIdentifierInQuery' + - $ref: 'components.yaml#/components/parameters/contentParamInHeader' + requestBody: + required: true + content: + application/json: + schema: + type: string + application/yang-data+json: + schema: + type: string + responses: + 200: + $ref: 'components.yaml#/components/responses/Ok' + 400: + $ref: 'components.yaml#/components/responses/BadRequest' + 401: + $ref: 'components.yaml#/components/responses/Unauthorized' + 403: + $ref: 'components.yaml#/components/responses/Forbidden' + 404: + $ref: 'components.yaml#/components/responses/NotFound' + fetchModuleReferencesByCmHandle: get: description: fetch all module references (name and revision) for a given cm handle diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java index ca661b817..19b9a09da 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java @@ -132,6 +132,12 @@ public class NetworkCmProxyController implements NetworkCmProxyApi { return new ResponseEntity<>(HttpStatus.OK); } + @Override + public ResponseEntity updateResourceDataRunningForCmHandle(final String cmHandle, + final String resourceIdentifier, final String requestBody, final String contentType) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + } + /** * Update Node Leaves. * @deprecated This Method is no longer used as part of NCMP. diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy index a609cfacb..4066fd35e 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy @@ -281,5 +281,19 @@ class NetworkCmProxyControllerSpec extends Specification { then: 'an empty cm handle identifier is returned' response.contentAsString == '{"cmHandles":null}' } + + def 'Update resource data in passthrough-running datastore.' () { + given: 'update resource data url' + def updateUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" + + "?resourceIdentifier=parent/child" + when: 'update data resource request is performed' + def response = mvc.perform( + put(updateUrl) + .contentType(MediaType.APPLICATION_JSON_VALUE) + .accept(MediaType.APPLICATION_JSON_VALUE).content('some-request-body') + ).andReturn().response + then: 'the response status is not implemented' + response.status == HttpStatus.NOT_IMPLEMENTED.value() + } } diff --git a/docs/cps-path.rst b/docs/cps-path.rst index 5834d68e1..bc46681d1 100644 --- a/docs/cps-path.rst +++ b/docs/cps-path.rst @@ -113,7 +113,7 @@ leaf-conditions - ``/shops/bookstore/categories[@numberOfBooks=1]`` - ``//categories[@name="Kids"]`` - ``//categories[@name='Kids']`` - - ``//categories[@code=1]/book[@title='Dune' and price=5]`` + - ``//categories[@code=1]/books/book[@title='Dune' and @price=5]`` **Limitations** - Only the last list or container can be queried leaf values. Any ancestor list will have to be referenced by its key name-value pair(s).