summaryrefslogtreecommitdiffstats
path: root/cps-rest/src/test/groovy
diff options
context:
space:
mode:
authorlukegleeson <luke.gleeson@est.tech>2021-08-18 09:49:32 +0100
committerlukegleeson <luke.gleeson@est.tech>2021-08-18 19:10:52 +0100
commit05701dda6edf6b8e7c06699a7b44247359c46cfb (patch)
tree62aba10ce7d8721cdf1272e3514bf645c8d59da5 /cps-rest/src/test/groovy
parent24112c0a500e94dc6068be71105874f8d81678b7 (diff)
Delete list-node p2 rest layer
Issue-ID: CPS-361 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: I5fb8d202fc0a65679d10377cc2959a7f8f854ca7
Diffstat (limited to 'cps-rest/src/test/groovy')
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy15
1 files changed, 15 insertions, 0 deletions
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
index 8675f42a51..d3d42e3065 100755
--- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
+++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy
@@ -24,6 +24,7 @@ package org.onap.cps.rest.controller
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
@@ -235,4 +236,18 @@ class DataRestControllerSpec extends Specification {
then: 'the java API was called with the correct parameters'
1 * mockCpsDataService.replaceListNodeData(dataspaceName, anchorName, parentNodeXpath, jsonData)
}
+
+ def 'Delete list node child elements.'() {
+ given: 'list node xpath'
+ def listNodeXpath = 'list node xpath'
+ when: 'delete is invoked list-node endpoint'
+ def response = mvc.perform(
+ delete("$dataNodeBaseEndpoint/anchors/$anchorName/list-node")
+ .param('xpath', listNodeXpath)
+ ).andReturn().response
+ then: 'a success response is returned'
+ response.status == HttpStatus.NO_CONTENT.value()
+ then: 'the java API was called with the correct parameters'
+ 1 * mockCpsDataService.deleteListNodeData(dataspaceName, anchorName, listNodeXpath)
+ }
}