aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-11-08 16:40:28 +0000
committerniamhcore <niamh.core@est.tech>2021-11-10 13:09:41 +0000
commit6c7791e04e43b056ab944c3f7935f182fcbb13fb (patch)
treefff0b4a26d02d139078ccc18db90908f92902137 /cps-ncmp-rest
parentb6fe4eb602206e5495423ff8614eb5238829d115 (diff)
Update operation passthrough running - Service Layer
Issue-ID: CPS-636 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: I13334df383a23e59b3368b8664c10e086b1eb4a8
Diffstat (limited to 'cps-ncmp-rest')
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java8
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy15
2 files changed, 14 insertions, 9 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 19b9a09da..3e2bdd928 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
@@ -133,9 +133,11 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
}
@Override
- public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String cmHandle,
- final String resourceIdentifier, final String requestBody, final String contentType) {
- return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
+ public ResponseEntity<Object> updateResourceDataRunningForCmHandle(final String resourceIdentifier,
+ final String cmHandle, final String requestBody, final String contentType) {
+ networkCmProxyDataService.updateResourceDataPassThroughRunningForCmHandle(cmHandle,
+ resourceIdentifier, requestBody, contentType);
+ return new ResponseEntity<>(HttpStatus.OK);
}
/**
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 4066fd35e..cb3dc6f73 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
@@ -171,7 +171,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.contentAsString.contains('"leaf":"value"')
}
- def 'Get Resource Data from pass-through operational.' () {
+ def 'Get Resource Data from passthrough operational.' () {
given: 'resource data url'
def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-operational" +
"?resourceIdentifier=parent/child&options=(a=1,b=2)"
@@ -190,7 +190,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.status == HttpStatus.OK.value()
}
- def 'Get Resource Data from pass-through running with #scenario value in resource identifier param.' () {
+ def 'Get Resource Data from passthrough 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)"
@@ -219,7 +219,7 @@ class NetworkCmProxyControllerSpec extends Specification {
'? needs to be encoded as %3F' | 'idWith%3F'
}
- def 'Create Resource Data from pass-through running with #scenario.' () {
+ def 'Create Resource Data from passthrough running with #scenario.' () {
given: 'resource data url'
def getUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
@@ -282,7 +282,7 @@ class NetworkCmProxyControllerSpec extends Specification {
response.contentAsString == '{"cmHandles":null}'
}
- def 'Update resource data in passthrough-running datastore.' () {
+ def 'Update resource data from passthrough running.' () {
given: 'update resource data url'
def updateUrl = "$ncmpBasePathV1/ch/testCmHandle/data/ds/ncmp-datastore:passthrough-running" +
"?resourceIdentifier=parent/child"
@@ -292,8 +292,11 @@ class NetworkCmProxyControllerSpec extends Specification {
.contentType(MediaType.APPLICATION_JSON_VALUE)
.accept(MediaType.APPLICATION_JSON_VALUE).content('some-request-body')
).andReturn().response
- then: 'the response status is not implemented'
- response.status == HttpStatus.NOT_IMPLEMENTED.value()
+ then: 'ncmp service method to update resource is called'
+ 1 * mockNetworkCmProxyDataService.updateResourceDataPassThroughRunningForCmHandle('testCmHandle',
+ 'parent/child', 'some-request-body', 'application/json;charset=UTF-8')
+ and: 'the response status is OK'
+ response.status == HttpStatus.OK.value()
}
}