diff options
author | Renu Kumari <renu.kumari@bell.ca> | 2021-10-06 13:31:43 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-10-06 13:31:43 +0000 |
commit | f3798ee9857edb45243d540606ceac21df1215ab (patch) | |
tree | 95f45aeb28accdde738705f7cf52b4702a628d05 /cps-ncmp-rest/src/test | |
parent | 98e686f3aa8ae8171e850591c1f85433b00c56cf (diff) | |
parent | fd2e6ddde2c2260951e2dfd5e3fd7f4bd04976e1 (diff) |
Merge "Changing resource identifier to a query param"
Diffstat (limited to 'cps-ncmp-rest/src/test')
-rw-r--r-- | cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy | 28 |
1 files changed, 18 insertions, 10 deletions
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 9f2b4e19a3..d62ae93b09 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 @@ -193,7 +193,7 @@ class NetworkCmProxyControllerSpec extends Specification { def 'Get Resource Data from pass-through operational.' () { given: 'resource data url' def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-operational" + - "/testResourceIdentifier?fields=testFields&depth=5" + "?resourceIdentifier=parent/child&fields=testFields&depth=5" when: 'get data resource request is performed' def response = mvc.perform( get(getUrl) @@ -202,7 +202,7 @@ class NetworkCmProxyControllerSpec extends Specification { ).andReturn().response then: 'the NCMP data service is called with getResourceDataOperationalForCmHandle' 1 * mockNetworkCmProxyDataService.getResourceDataOperationalForCmHandle('testCmHandle', - 'testResourceIdentifier', + 'parent/child', 'application/json', 'testFields', 5) @@ -210,16 +210,16 @@ class NetworkCmProxyControllerSpec extends Specification { response.status == HttpStatus.OK.value() } - def 'Get Resource Data from pass-through running.' () { + def 'Get Resource Data from pass-through running with #scenario value in resource identifier param.' () { given: 'resource data url' def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" + - "/testResourceIdentifier?fields=testFields&depth=5" + "?resourceIdentifier=" + resourceIdentifier + "&fields=testFields&depth=5" and: 'ncmp service returns json object' mockNetworkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle('testCmHandle', - 'testResourceIdentifier', - 'application/json', - 'testFields', - 5) >> '{valid-json}' + resourceIdentifier, + 'application/json', + 'testFields', + 5) >> '{valid-json}' when: 'get data resource request is performed' def response = mvc.perform( get(getUrl) @@ -230,12 +230,20 @@ class NetworkCmProxyControllerSpec extends Specification { response.status == HttpStatus.OK.value() and: 'response contains valid object body' response.getContentAsString() == '{valid-json}' + where: 'tokens are used in the resource identifier parameter' + scenario | resourceIdentifier + '/' | 'id/with/slashes' + '?' | 'idWith?' + ',' | 'idWith,' + '=' | 'idWith=' + '[]' | 'idWith[]' + '? needs to be encoded as %3F' | 'idWith%3F' } def 'Create Resource Data from pass-through running with #scenario.' () { given: 'resource data url' def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" + - "/testResourceIdentifier" + "?resourceIdentifier=parent/child" when: 'get data resource request is performed' def response = mvc.perform( post(getUrl) @@ -244,7 +252,7 @@ class NetworkCmProxyControllerSpec extends Specification { ).andReturn().response then: 'ncmp service method to create resource called' 1 * mockNetworkCmProxyDataService.createResourceDataPassThroughRunningForCmHandle('testCmHandle', - 'testResourceIdentifier', requestBody, 'application/json;charset=UTF-8') + 'parent/child', requestBody, 'application/json;charset=UTF-8') and: 'resource is created' response.status == HttpStatus.CREATED.value() where: 'given request body' |