Update for single data node with root node xpath remains as it is.
In-depth investigation is to be done regarding the bug where list nodes are not updated when xpath is set to root node xpath. Possibly create a ticket and separate documentation for the same.
After the investigation it was found that the reason behind the inconsistencies discovered was lack of support for Patch operation for multiple data nodes.
As per discussion in CPS sub team daily call it was decided to bring in support for Patch operation for multiple data nodes. As it would address all the inconsistencies discovered.
JSON Data Stored in CPS DB using POST operation.
The following JSON data was first stored in CPS DB:
Currently after multiple data trees are stored in CPS DB. On performing the Patch operation, with root node xpath "/", the first data tree is only updated by the Patch operation. To test this following scenarios were performed:
Updating all data trees under an anchor with root node xPath "/"
CURL request to update multiple leaves across multiple data treesExpand source
{
"status": "500 INTERNAL_SERVER_ERROR",
"message": "could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.DataException: could not execute statement",
"details": "Check logs for details."
}
Reason: The following scenario would fail because CPS Patch operation only supports updating multiple leaves under one container node at a time. And here when we try to update multiple leaves present in two different containers the operations fails.
On performing Get operation we get the following JSON data, here none of the leaves are updated
Updating the data trees individually, leads to successful updation When updating multiple leaves present under individual data nodes the operation successfully executes.
CURL request to update leaves under container data nodeExpand source
curl --location --request PATCH 'http://localhost:8080/cps/api/v1/dataspaces/testDataspace/anchors/sample/nodes?xpath=%2F' \
--header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Basic Y3BzdXNlcjpjcHNyMGNrcyE=' --header 'Cookie: JSESSIONID=node0iyclt1syzfqj28jzo5qc5gks1.node0' \
--data '{
"int:interface-A": {
"domain": "true", //value to be updated
"host-name": "Host-A" //value to be updated
}
}'
Response 200 OK
Updated data after making get requestExpand source