summaryrefslogtreecommitdiffstats
path: root/src/test/groovy
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-09-29 15:32:32 +0100
committerniamhcore <niamh.core@est.tech>2021-09-30 17:45:44 +0100
commit2fb3f66a3da8f7daa8dba9023de56b2227c59e7a (patch)
tree67b4e92520b5c9dc073423e0a1da1b65dad69dcc /src/test/groovy
parent7e148f8eda2c5741d5c08ae37c6fd36f8d861659 (diff)
Changing resource identifier to a query param
* Updating yaml * Update jib-maven-plugin version Issue-ID: CPS-679 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: Ie2f49bd8e22723ca4dcd2c20ed39722f22c281c1
Diffstat (limited to 'src/test/groovy')
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
index 9c27dc1b..c818eccb 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
@@ -20,7 +20,6 @@
package org.onap.cps.ncmp.dmi.rest.controller
-
import com.fasterxml.jackson.databind.ObjectMapper
import org.onap.cps.ncmp.dmi.TestUtils
import org.onap.cps.ncmp.dmi.exception.DmiException
@@ -187,7 +186,7 @@ class DmiRestControllerSpec extends Specification {
def 'Get resource data for pass-through operational from cm handle.'() {
given: 'Get resource data url'
def getResourceDataForCmHandleUrl = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-operational" +
- "/resourceIdentifier?fields=myfields&depth=5"
+ "?resourceIdentifier=abc/xyz&fields=myfields&depth=5"
def json = '{"cmHandleProperties" : { "prop1" : "value1", "prop2" : "value2"}}'
when: 'get resource data PUT api is invoked'
def response = mvc.perform(
@@ -198,7 +197,7 @@ class DmiRestControllerSpec extends Specification {
response.status == HttpStatus.OK.value()
and: 'dmi service called with get resource data for cm handle'
1 * mockDmiService.getResourceDataOperationalForCmHandle('some-cmHandle',
- 'resourceIdentifier',
+ 'abc/xyz',
'application/json',
'myfields',
5,
@@ -207,7 +206,8 @@ class DmiRestControllerSpec extends Specification {
def 'Write data using passthrough running for a cm handle using #scenario.'() {
given: 'write data for cmHandle url and jsonData'
- def writeDataforCmHandlePassthroughRunning = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running/some-resourceIdentifier"
+ def writeDataforCmHandlePassthroughRunning = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running" +
+ "?resourceIdentifier=some-resourceIdentifier"
def jsonData = TestUtils.getResourceFileContent(requestBodyFile)
and: 'dmi service is called'
mockDmiService.writeResourceDataPassthroughForCmHandle('some-cmHandle',
@@ -228,10 +228,10 @@ class DmiRestControllerSpec extends Specification {
'data with special chars' | 'dataWithSpecialChar.json'|| 'data with quote \" and new line \n'
}
- def 'Get resource data for pass-through running from cm handle.'() {
+ def 'Get resource data for pass-through running from cm handle with #scenario value in resource identifier param.'() {
given: 'Get resource data url'
def getResourceDataForCmHandleUrl = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running" +
- "/testResourceIdentifier?fields=testFields&depth=5"
+ "?resourceIdentifier="+resourceIdentifier+"&fields=testFields&depth=5"
def json = '{"cmHandleProperties" : { "prop1" : "value1", "prop2" : "value2"}}'
when: 'get resource data PUT api is invoked'
def response = mvc.perform(
@@ -242,10 +242,19 @@ class DmiRestControllerSpec extends Specification {
response.status == HttpStatus.OK.value()
and: 'dmi service called with get resource data for cm handle'
1 * mockDmiService.getResourceDataPassThroughRunningForCmHandle('some-cmHandle',
- 'testResourceIdentifier',
+ resourceIdentifier,
'application/json',
'testFields',
5,
['prop1':'value1', 'prop2':'value2'])
+ 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'
+
}
} \ No newline at end of file