summaryrefslogtreecommitdiffstats
path: root/cps-rest/src/test/groovy/org/onap
diff options
context:
space:
mode:
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-05 13:11:50 +0300
committerRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-11 10:20:48 +0300
commit0905ac124ea1d8ab5067b4b00ece0469961cfa36 (patch)
treed7167be17e4b59d98cedffce2da756a5e50aff63 /cps-rest/src/test/groovy/org/onap
parent25e3306737b7284b051dfeaedb39ef83323504d9 (diff)
Create list-node elements (part2): CPS REST layer
Issue-ID: CPS-360 Change-Id: Iaca8baff085e1659453c06ce0dee0203aa007b4a Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-rest/src/test/groovy/org/onap')
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy22
1 files changed, 18 insertions, 4 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 b64b56178a..18d20a8e20 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
@@ -33,10 +33,6 @@ import org.onap.cps.api.CpsAdminService
import org.onap.cps.api.CpsDataService
import org.onap.cps.api.CpsModuleService
import org.onap.cps.api.CpsQueryService
-import org.onap.cps.spi.exceptions.AlreadyDefinedException
-import org.onap.cps.spi.exceptions.AnchorNotFoundException
-import org.onap.cps.spi.exceptions.DataNodeNotFoundException
-import org.onap.cps.spi.exceptions.DataspaceNotFoundException
import org.onap.cps.spi.model.DataNode
import org.onap.cps.spi.model.DataNodeBuilder
import org.spockframework.spring.SpringBean
@@ -131,6 +127,24 @@ class DataRestControllerSpec extends Specification {
1 * mockCpsDataService.saveData(dataspaceName, anchorName, parentNodeXpath, json)
}
+ def 'Create list node child elements.'() {
+ given: 'parent node xpath and json data inputs'
+ def parentNodeXpath = 'parent node xpath'
+ def jsonData = 'json data'
+ when: 'post is invoked list-node endpoint'
+ def response = mvc.perform(
+ post("$dataNodeBaseEndpoint/anchors/$anchorName/list-node")
+ .contentType(MediaType.APPLICATION_JSON)
+ .param('xpath', parentNodeXpath)
+ .content(jsonData)
+ ).andReturn().response
+ then: 'a created response is returned'
+ response.status == HttpStatus.CREATED.value()
+ then: 'the java API was called with the correct parameters'
+ 1 * mockCpsDataService.saveListNodeData(dataspaceName, anchorName, parentNodeXpath, jsonData)
+
+ }
+
def 'Get data node with leaves'() {
given: 'the service returns data node leaves'
def xpath = 'some xPath'