Fix PATCH request issue with top-level container as target 03/101003/5
authorSangwook Ha <sangwook.ha@verizon.com>
Fri, 6 May 2022 17:14:04 +0000 (10:14 -0700)
committerRobert Varga <nite@hq.sk>
Fri, 13 May 2022 05:07:08 +0000 (05:07 +0000)
commita304aa0a7aeb0063624764b30a1501e0e5a9cf9f
tree2ec0cbe27ecadd85ff8fe4d07724ca64c7c7ff11
parentad67f040475b5a037e1d9fafd2b5c7d5d5c11a3d
Fix PATCH request issue with top-level container as target

PATCH request to the data root with a top-level container as
target does not work because JsonPatchBodyReader and
XmlPatchBodyReader expect a parent statement in the stack.

Address the issue by setting target schema node to the path
schema context when stack is empty and add test cases for
JsonPatchBodyReader and XmlPatchBodyReader.

JIRA: NETCONF-877
Change-Id: Ibb65ccdf3f03d8a9a9023d75bf288e5e4416ca50
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReader.java
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReader.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReaderTest.java
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReaderTest.java
restconf/restconf-nb-rfc8040/src/test/resources/instanceidentifier/json/jsonPATCHTargetTopLevelContainerWithEmptyURI.json [new file with mode: 0644]
restconf/restconf-nb-rfc8040/src/test/resources/instanceidentifier/xml/xmlPATCHTargetTopLevelContainerWithEmptyURI.xml [new file with mode: 0644]