summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src
diff options
context:
space:
mode:
authorRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-07 10:46:27 +0300
committerRuslan Kashapov <ruslan.kashapov@pantheon.tech>2021-05-11 10:23:56 +0300
commit1baf48d05be1cd32e22c065ebfec218da100d1f2 (patch)
tree3609e4c341d204c36111de9894f73f68b1dd11cb /cps-ncmp-rest/src
parent0905ac124ea1d8ab5067b4b00ece0469961cfa36 (diff)
Create list-node elements (part3): NCMP REST and service layers
Issue-ID: CPS-360 Change-Id: Id8be89f19750d72bae334491aea4a59f21c7ecd6 Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Diffstat (limited to 'cps-ncmp-rest/src')
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java7
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy17
2 files changed, 24 insertions, 0 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 3c8a04e822..484a21ae65 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -54,6 +54,13 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
}
@Override
+ public ResponseEntity<String> addListNodeElements(final String jsonData, final String parentNodeXpath,
+ final String cmHandle) {
+ networkCmProxyDataService.addListNodeElements(cmHandle, parentNodeXpath, jsonData);
+ return new ResponseEntity<>(HttpStatus.CREATED);
+ }
+
+ @Override
public ResponseEntity<Object> getNodeByCmHandleAndXpath(final String cmHandle, @Valid final String xpath,
@Valid final Boolean includeDescendants) {
final FetchDescendantsOption fetchDescendantsOption = Boolean.TRUE.equals(includeDescendants)
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 ea3c16d4cb..45e8f11948 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
@@ -105,6 +105,23 @@ class NetworkCmProxyControllerSpec extends Specification {
'parent node xpath' | '/xpath' || '/xpath'
}
+ def 'Add list-node elements.'() {
+ given: 'json data and parent node xpath'
+ def jsonData = 'json data'
+ def parentNodeXpath = 'parent node xpath'
+ when: 'post request is performed'
+ def response = mvc.perform(
+ post("$dataNodeBaseEndpoint/cm-handles/$cmHandle/list-node")
+ .contentType(MediaType.APPLICATION_JSON)
+ .content(jsonData)
+ .param('xpath', parentNodeXpath)
+ ).andReturn().response
+ then: 'the service method is invoked once with expected parameters'
+ 1 * mockNetworkCmProxyDataService.addListNodeElements(cmHandle, parentNodeXpath, jsonData)
+ and: 'response status indicates success'
+ response.status == HttpStatus.CREATED.value()
+ }
+
def 'Update data node leaves.'() {
given: 'json data'
def jsonData = 'json data'