summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy
diff options
context:
space:
mode:
authorlukegleeson <luke.gleeson@est.tech>2021-07-27 15:07:05 +0100
committerlukegleeson <luke.gleeson@est.tech>2021-08-17 10:26:50 +0100
commit3724abc1912f93bf1caa104a55da7178f43fd731 (patch)
tree24a5c7d64322adab13958f5680eae7d45a4be5c2 /cps-service/src/test/groovy
parentdca30738006c456afd807512a2f80c207b53d3c6 (diff)
Delete list-node p1 service and persistence layers
Persistence Layer of delete List-Node Content Service Layer of delete List-Node Content Updating of deprecated FragementRepository.getOne() method to FragmentRepository.getByID() in CpsDataPersistenceServiceIntegration.groovy Remove Runtime Exceptions thrown from CpsDataService.java javadoc Issue-ID: CPS-361 Signed-off-by: lukegleeson <luke.gleeson@est.tech> Change-Id: Ib5762e73a6e8620c50c2e07b00086b9287770bc3
Diffstat (limited to 'cps-service/src/test/groovy')
-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