aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorDylanB95EST <dylan.byrne@est.tech>2021-11-02 17:25:18 +0000
committerDylanB95EST <dylan.byrne@est.tech>2021-11-02 17:25:23 +0000
commit30a59dda3869603b9f628c45364e63a3763d3925 (patch)
tree43943286fd3a32b2bd7ad32280bf3a61cbd5f24d /cps-service/src/test
parent6fda688fa63ea7ccd450002fb94a18b07095bea9 (diff)
Delete DataNode (xpath) for a given Anchor
Delete Datanode within CPS. Deprecates delete functionality of /v1/dataspaces/{dataspace-name}/anchors/{anchor-name}/list-nodes. New api is backwards compatible with this API Issue-ID: CPS-313 Change-Id: I110c4ab1446e8a1399a0d9bf89c0be614a9104df Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy11
1 files changed, 11 insertions, 0 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
index 2bd44824a..ba9c156d7 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy
@@ -227,6 +227,17 @@ class CpsDataServiceImplSpec extends Specification {
1 * mockNotificationService.processDataUpdatedEvent(dataspaceName, anchorName, observedTimestamp)
}
+ def 'Delete data node under anchor and dataspace.'() {
+ given: 'schema set for given anchor and dataspace references test tree model'
+ setupSchemaSetMocks('test-tree.yang')
+ when: 'delete data node method is invoked with correct parameters'
+ objectUnderTest.deleteDataNode(dataspaceName, anchorName, '/data-node', observedTimestamp)
+ then: 'the persistence service method is invoked with the correct parameters'
+ 1 * mockCpsDataPersistenceService.deleteDataNode(dataspaceName, anchorName, '/data-node')
+ and: 'data updated event is sent to notification service'
+ 1 * mockNotificationService.processDataUpdatedEvent(dataspaceName, anchorName, observedTimestamp)
+ }
+
def setupSchemaSetMocks(String... yangResources) {
def anchor = Anchor.builder().name(anchorName).schemaSetName(schemaSetName).build()
mockCpsAdminService.getAnchor(dataspaceName, anchorName) >> anchor