aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorNiamh Core <niamh.core@est.tech>2021-08-17 15:30:16 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-17 15:30:16 +0000
commitddf661254f711d78b480b8f5623632443a8f6ebc (patch)
tree719873e2e027621126d69f8cbe431f9468203f43 /cps-service/src/test
parent4571ab67d1b3d24d5f046a38055bcf34910cc785 (diff)
parent3724abc1912f93bf1caa104a55da7178f43fd731 (diff)
Merge "Delete list-node p1 service and persistence layers"
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy12
1 files changed, 12 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 19ccee3675..122039728a 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
@@ -28,6 +28,7 @@ import org.onap.cps.api.CpsModuleService
import org.onap.cps.notification.NotificationService
import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.spi.FetchDescendantsOption
+import org.onap.cps.spi.exceptions.CpsPathException
import org.onap.cps.spi.exceptions.DataValidationException
import org.onap.cps.spi.model.Anchor
import org.onap.cps.spi.model.DataNodeBuilder
@@ -197,6 +198,17 @@ class CpsDataServiceImplSpec extends Specification {
thrown(DataValidationException)
}
+ def 'Delete list-node data fragment under existing node.'() {
+ given: 'schema set for given anchor and dataspace references test-tree model'
+ setupSchemaSetMocks('test-tree.yang')
+ when: 'delete list data method is invoked with list-node json data'
+ objectUnderTest.deleteListNodeData(dataspaceName, anchorName, '/test-tree/branch')
+ then: 'the persistence service method is invoked with correct parameters'
+ 1 * mockCpsDataPersistenceService.deleteListDataNodes(dataspaceName, anchorName, '/test-tree/branch')
+ and: 'data updated event is sent to notification service'
+ 1 * mockNotificationService.processDataUpdatedEvent(dataspaceName, anchorName)
+ }
+
def setupSchemaSetMocks(String... yangResources) {
def anchor = Anchor.builder().name(anchorName).schemaSetName(schemaSetName).build()
mockCpsAdminService.getAnchor(dataspaceName, anchorName) >> anchor