summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2023-08-18 10:52:15 +0000
committerGerrit Code Review <gerrit@onap.org>2023-08-18 10:52:15 +0000
commit593860b8ed87d21f5618a1ebd5d513952cdddb44 (patch)
tree38d4f37d6551a14c518fdd1480ccce438b9a432f
parent4303e5e87086e72a1a494968b0b426ca9fc46b30 (diff)
parent996d0c2b23a70e62853632f0b644b3fe4d212143 (diff)
Merge "Update of top-level data node fails with SQL error"
-rw-r--r--cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java2
-rwxr-xr-xdocs/release-notes.rst1
-rw-r--r--integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsDataServiceIntegrationSpec.groovy11
3 files changed, 13 insertions, 1 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
index 4f056c8f6e..c187f20ea9 100644
--- a/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/repository/FragmentPrefetchRepositoryImpl.java
@@ -94,7 +94,7 @@ public class FragmentPrefetchRepositoryImpl implements FragmentPrefetchRepositor
final FragmentEntity fragmentEntity = new FragmentEntity();
fragmentEntity.setId(resultSet.getLong("id"));
fragmentEntity.setXpath(resultSet.getString("xpath"));
- fragmentEntity.setParentId(resultSet.getLong("parentId"));
+ fragmentEntity.setParentId(resultSet.getObject("parentId", Long.class));
fragmentEntity.setAttributes(resultSet.getString("attributes"));
fragmentEntity.setAnchor(anchorEntityPerId.get(resultSet.getLong("anchorId")));
fragmentEntity.setChildFragments(new HashSet<>());
diff --git a/docs/release-notes.rst b/docs/release-notes.rst
index cd70cf8be7..3f672ad626 100755
--- a/docs/release-notes.rst
+++ b/docs/release-notes.rst
@@ -39,6 +39,7 @@ Release Data
Bug Fixes
---------
3.3.6
+ - `CPS-1841 <https://jira.onap.org/browse/CPS-1841>`_ Update of top-level data node fails with exception
Features
--------
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 9716cb56eb..82a415ecef 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'}}"