From 4314e7b8ffc0641b0907cf18ca57d329c11f87ed Mon Sep 17 00:00:00 2001 From: niamhcore Date: Wed, 24 Nov 2021 10:53:51 +0000 Subject: Patch operation passthrough running Issue-ID: CPS-640 Signed-off-by: niamhcore Change-Id: I6badf241bbec265800d6b316da7ab8ad7782eb17 --- .../rest/controller/NetworkCmProxyControllerSpec.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cps-ncmp-rest/src/test/groovy/org/onap') 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 436f22b327..4186bcd1bf 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 @@ -25,6 +25,7 @@ package org.onap.cps.ncmp.rest.controller import org.onap.cps.TestUtils import org.onap.cps.spi.model.ModuleReference +import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.PATCH import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get @@ -301,5 +302,21 @@ class NetworkCmProxyControllerSpec extends Specification { response.contentAsString == '{"cmHandles":[]}' } + def 'Patch resource data in passthrough-running datastore.' () { + given: 'patch resource data url' + def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" + + "?resourceIdentifier=parent/child" + when: 'patch data resource request is performed' + def response = mvc.perform( + patch(url) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON).content('{"some-key" : "some-value"}') + ).andReturn().response + then: 'ncmp service method to update resource is called' + 1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle', + 'parent/child', PATCH, '{some-key=some-value}', 'application/json;charset=UTF-8') + and: 'the response status is OK' + response.status == HttpStatus.OK.value() + } } -- cgit 1.2.3-korg