X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-rest%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Frest%2Fcontroller%2FNetworkCmProxyControllerSpec.groovy;h=4186bcd1bf74fa0fb38a22f5db75b81b696e9d0e;hb=4314e7b8ffc0641b0907cf18ca57d329c11f87ed;hp=436f22b327bc612bb01d02f8600f3a14d6506f37;hpb=1a07fc039140525af388d6b8c30fbbce9e1ebf9f;p=cps.git 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 436f22b32..4186bcd1b 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() + } }