From 888dcd495ecb63bf678e7234e9dc34e0743cb412 Mon Sep 17 00:00:00 2001 From: tragait Date: Thu, 19 Aug 2021 15:17:56 +0100 Subject: Get resource data from pass through running (Ncmp impl.) Issue-ID: CPS-580 Signed-off-by: tragait Change-Id: I6dc37d9516078c87efc3f0c5bbd2b7b8a7155d48 --- .../controller/NetworkCmProxyControllerSpec.groovy | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'cps-ncmp-rest/src/test/groovy/org') 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 b2a060c27..a7fa30901 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 @@ -206,8 +206,8 @@ class NetworkCmProxyControllerSpec extends Specification { .contentType(MediaType.APPLICATION_JSON) .accept(MediaType.APPLICATION_JSON_VALUE) ).andReturn().response - then: 'the NCMP data service is called with getResourceDataOperationalFoCmHandle' - 1 * mockNetworkCmProxyDataService.getResourceDataOperationalFoCmHandle('testCmHandle', + then: 'the NCMP data service is called with getResourceDataOperationalForCmHandle' + 1 * mockNetworkCmProxyDataService.getResourceDataOperationalForCmHandle('testCmHandle', 'testResourceIdentifier', 'application/json', 'testFields', @@ -216,5 +216,26 @@ class NetworkCmProxyControllerSpec extends Specification { response.status == HttpStatus.OK.value() } + def 'Get Resource Data from pass-through running.' () { + given: 'resource data url' + def getUrl = "$basePath/v1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" + + "/testResourceIdentifier?fields=testFields&depth=5" + and: 'ncmp service returns json object' + mockNetworkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle('testCmHandle', + 'testResourceIdentifier', + 'application/json', + 'testFields', + 5) >> '{valid-json}' + when: 'get data resource request is performed' + def response = mvc.perform( + get(getUrl) + .contentType(MediaType.APPLICATION_JSON) + .accept(MediaType.APPLICATION_JSON_VALUE) + ).andReturn().response + then: 'response status is Ok' + response.status == HttpStatus.OK.value() + and: 'response contains valid object body' + response.getContentAsString() == '{valid-json}' + } } -- cgit 1.2.3-korg