aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/test/groovy
diff options
context:
space:
mode:
authorDylanB95EST <dylan.byrne@est.tech>2021-11-30 15:07:35 +0000
committerDylan Byrne <dylan.byrne@est.tech>2021-12-08 09:06:25 +0000
commiteeef2ae7d17fcff7fbd33614972ad42f495e7998 (patch)
treef303634b7ba9e68ea6ff896d50019b9f6c2c4979 /cps-ncmp-rest/src/test/groovy
parent60feed1cac9ffdd011d10e4fce65367af6520fc8 (diff)
Support Delete operation for ds Passtrough-Running in NCMP 1/3
Add delete operation for passthrough running within cps-ncmp. Issue-ID: CPS-638 Change-Id: I360672adc1f0f5c8eb351391c94f2d4fa913d0b4 Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src/test/groovy')
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy27
1 files changed, 22 insertions, 5 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 4186bcd1b..530ce4e3a 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
@@ -28,12 +28,14 @@ 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.delete
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put
import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.CREATE
import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.UPDATE
+import static org.onap.cps.ncmp.api.impl.operations.DmiRequestBody.OperationEnum.DELETE
import com.google.gson.Gson
import org.onap.cps.ncmp.api.NetworkCmProxyDataService
@@ -174,7 +176,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.contentAsString.contains('"leaf":"value"')
}
- def 'Get Resource Data from passthrough operational.' () {
+ def 'Get Resource Data from pass-through operational.' () {
given: 'resource data url'
def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-operational" +
"?resourceIdentifier=parent/child&options=(a=1,b=2)"
@@ -193,7 +195,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.status == HttpStatus.OK.value()
}
- def 'Get Resource Data from passthrough running with #scenario value in resource identifier param.' () {
+ 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" +
"?resourceIdentifier=" + resourceIdentifier + "&options=(a=1,b=2)"
@@ -222,7 +224,7 @@ class NetworkCmProxyControllerSpec extends Specification {
'? needs to be encoded as %3F' | 'idWith%3F'
}
- def 'Update resource data from passthrough running.' () {
+ def 'Update resource data from pass-through running.' () {
given: 'update resource data url'
def updateUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
@@ -239,7 +241,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.status == HttpStatus.OK.value()
}
- def 'Create Resource Data from passthrough running with #scenario.' () {
+ def 'Create Resource Data from pass-through running with #scenario.' () {
given: 'resource data url'
def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
@@ -302,7 +304,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.contentAsString == '{"cmHandles":[]}'
}
- def 'Patch resource data in passthrough-running datastore.' () {
+ def 'Patch resource data in pass-through running datastore.' () {
given: 'patch resource data url'
def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
@@ -318,5 +320,20 @@ class NetworkCmProxyControllerSpec extends Specification {
and: 'the response status is OK'
response.status == HttpStatus.OK.value()
}
+
+ def 'Delete resource data in pass-through running datastore.' () {
+ given: 'delete resource data url'
+ def url = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
+ "?resourceIdentifier=parent/child"
+ when: 'delete data resource request is performed'
+ def response = mvc.perform(
+ delete(url).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)
+ .content('{"some-key" : "some-value"}')).andReturn().response
+ then: 'the ncmp service method to delete resource is called'
+ 1 * mockNetworkCmProxyDataService.writeResourceDataPassThroughRunningForCmHandle('testCmHandle',
+ 'parent/child', DELETE, '{"some-key" : "some-value"}', 'application/json;charset=UTF-8')
+ and: 'the response is No Content'
+ response.status == HttpStatus.NO_CONTENT.value()
+ }
}