From: Luke Gleeson Date: Tue, 22 Aug 2023 08:49:37 +0000 (+0000) Subject: Merge "Missing test for getDataNodes (ep1)" X-Git-Tag: 3.3.6~6 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=916b63064c171efb9dae15326e40fc9d0dc49027;hp=-c;p=cps.git Merge "Missing test for getDataNodes (ep1)" --- 916b63064c171efb9dae15326e40fc9d0dc49027 diff --combined integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy index 82a415ecef,935a17a014..2fe275383f --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy @@@ -102,6 -102,20 +102,20 @@@ class CpsDataServiceIntegrationSpec ext cpsPath << [ 'invalid path', '/non-existing-path' ] } + def 'Get data nodes error scenario #scenario'() { + when: 'attempt to retrieve data nodes' + objectUnderTest.getDataNodes(dataspaceName, anchorName, xpath, OMIT_DESCENDANTS) + then: 'expected exception is thrown' + thrown(expectedException) + where: 'following data is used' + scenario | dataspaceName | anchorName | xpath || expectedException + 'non existent dataspace' | 'non-existent' | 'not-relevant' | '/not-relevant' || DataspaceNotFoundException + 'non existent anchor' | FUNCTIONAL_TEST_DATASPACE_1 | 'non-existent' | '/not-relevant' || AnchorNotFoundException + 'non-existent xpath' | FUNCTIONAL_TEST_DATASPACE_1 | BOOKSTORE_ANCHOR_1| '/non-existing' || DataNodeNotFoundException + 'invalid-dataspace' | 'Invalid dataspace' | 'not-relevant' | '/not-relevant' || DataValidationException + 'invalid-dataspace' | FUNCTIONAL_TEST_DATASPACE_1 | 'Invalid Anchor' | '/not-relevant' || DataValidationException + } + def 'Delete root data node.'() { when: 'the "root" is deleted' objectUnderTest.deleteDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, [ '/' ], now) @@@ -394,17 -408,6 +408,17 @@@ restoreBookstoreDataAnchor(1) } + def 'Update bookstore top-level container data node.'() { + when: 'the bookstore top-level container is updated' + def json = '{ "bookstore": { "bookstore-name": "new bookstore" }}' + objectUnderTest.updateDataNodeAndDescendants(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/', json, now) + then: 'bookstore name has been updated' + def result = objectUnderTest.getDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore', DIRECT_CHILDREN_ONLY) + result.leaves.'bookstore-name'[0] == 'new bookstore' + cleanup: + restoreBookstoreDataAnchor(1) + } + def 'Update multiple data node leaves.'() { given: 'Updated json for bookstore data' def jsonData = "{'book-store:books':{'lang':'English/French','price':100,'title':'Matilda'}}"