summaryrefslogtreecommitdiffstats
path: root/integration-test
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-08-17 15:43:34 +0100
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-08-17 15:17:15 +0000
commit996d0c2b23a70e62853632f0b644b3fe4d212143 (patch)
treeb9f1dfb76dcae12074cf5fd42a553189af6f651b /integration-test
parenta52b1825f99318181cd356dcde1b1db46c1098ac (diff)
Update of top-level data node fails with SQL error
The error is caused by the fetch-descendants code using ResultSet.getLong which returns a 'long' primitive instead of a 'Long' object. Thus a parent ID of 'NULL' becomes '0', which causes an error during update. To preserve the NULL value, ResultSet.getObject must be used. Issue-ID: CPS-1841 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: Ida6837a04954cd3c23f0f2faabd7d0712d8ee19d
Diffstat (limited to 'integration-test')
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy11
1 files changed, 11 insertions, 0 deletions
diff --git 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
index 9716cb56e..82a415ece 100644
--- 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
@@ -394,6 +394,17 @@ class CpsDataServiceIntegrationSpec extends FunctionalSpecBase {
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'}}"