diff options
author | Sourabh Sourabh <sourabh.sourabh@est.tech> | 2022-08-25 14:35:18 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-08-25 14:35:18 +0000 |
commit | e2a699f90d9b755230ea960df21abef55bc305ce (patch) | |
tree | e1d02d7c6ed0ccd240d4df324375bb111c3dd596 /cps-rest | |
parent | 10317d3502c18c8013ae11d3c18e29b40db151d1 (diff) | |
parent | ed6c05157f60328b0215bde544f7a4e9894fd15f (diff) |
Merge "Performance Improvement: Batch Update DataNodes"
Diffstat (limited to 'cps-rest')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 2 | ||||
-rwxr-xr-x | cps-rest/src/test/groovy/org/onap/cps/rest/controller/DataRestControllerSpec.groovy | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index b78d383394..8dea2c02c2 100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@ -101,7 +101,7 @@ public class DataRestController implements CpsDataApi { public ResponseEntity<Object> replaceNode(final String dataspaceName, final String anchorName, final Object jsonData, final String parentNodeXpath, final String observedTimestamp) { cpsDataService - .replaceNodeTree(dataspaceName, anchorName, parentNodeXpath, + .updateDataNodeAndDescendants(dataspaceName, anchorName, parentNodeXpath, jsonObjectMapper.asJsonString(jsonData), toOffsetDateTime(observedTimestamp)); return new ResponseEntity<>(HttpStatus.OK); } 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 6f415bd451..75a3fcf008 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 @@ -273,7 +273,7 @@ class DataRestControllerSpec extends Specification { .param('xpath', inputXpath)) .andReturn().response then: 'the service method is invoked with expected parameters' - 1 * mockCpsDataService.replaceNodeTree(dataspaceName, anchorName, xpathServiceParameter, expectedJsonData, noTimestamp) + 1 * mockCpsDataService.updateDataNodeAndDescendants(dataspaceName, anchorName, xpathServiceParameter, expectedJsonData, noTimestamp) and: 'response status indicates success' response.status == HttpStatus.OK.value() where: @@ -283,7 +283,7 @@ class DataRestControllerSpec extends Specification { 'some xpath by parent' | '/some/xpath' || '/some/xpath' } - def 'Replace data node tree with observedTimestamp.'() { + def 'Update data node and descendants with observedTimestamp.'() { given: 'endpoint to replace node' def endpoint = "$dataNodeBaseEndpoint/anchors/$anchorName/nodes" when: 'put request is performed' @@ -296,7 +296,7 @@ class DataRestControllerSpec extends Specification { .param('observed-timestamp', observedTimestamp)) .andReturn().response then: 'the service method is invoked with expected parameters' - expectedApiCount * mockCpsDataService.replaceNodeTree(dataspaceName, anchorName, '/', expectedJsonData, + expectedApiCount * mockCpsDataService.updateDataNodeAndDescendants(dataspaceName, anchorName, '/', expectedJsonData, { it == DateTimeUtility.toOffsetDateTime(observedTimestamp) }) and: 'response status indicates success' response.status == expectedHttpStatus.value() |