summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy
diff options
context:
space:
mode:
authorNiamh Core <niamh.core@est.tech>2021-11-03 14:37:12 +0000
committerGerrit Code Review <gerrit@onap.org>2021-11-03 14:37:12 +0000
commit30dfcb0cf5f1428bf3ebecbfad3d26c336a4553e (patch)
treefdad5d485f411e792770f5f89731fcba776fbccc /cps-service/src/test/groovy
parent78f9094f215e12c08e2cb3e18ee0038faa519fc3 (diff)
parent30a59dda3869603b9f628c45364e63a3763d3925 (diff)
Merge "Delete DataNode (xpath) for a given Anchor"
Diffstat (limited to 'cps-service/src/test/groovy')
-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 2bd44824a6..ba9c156d75 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