X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Frestconf-nb%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fnb%2Frfc8040%2Fjersey%2Fproviders%2Fpatch%2FJsonPatchBodyReaderTest.java;h=956582d4d714dfca1681cdad536058c79c80b56b;hb=1f8527b71ed3ff9cf9f9a8c612723bb297e1cd07;hp=87485e60a481a29abdd1f60e4aaf099bf2ecef59;hpb=0391ff3f10e888463c5978fe17169d7316fd593b;p=netconf.git diff --git a/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReaderTest.java b/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReaderTest.java index 87485e60a4..956582d4d7 100644 --- a/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReaderTest.java +++ b/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/JsonPatchBodyReaderTest.java @@ -188,6 +188,43 @@ public class JsonPatchBodyReaderTest extends AbstractBodyReaderTest { checkPatchContext(returnValue); } + /** + * Test of Yang Patch on the top augmented element. + */ + @Test + public void modulePatchTargetTopLevelAugmentedContainerTest() throws Exception { + mockBodyReader("", jsonToPatchBodyReader, false); + final var inputStream = new ByteArrayInputStream(""" + { + "ietf-yang-patch:yang-patch": { + "patch-id": "test-patch", + "comment": "comment", + "edit": [ + { + "edit-id": "edit1", + "operation": "replace", + "target": "/test-m:container-root/test-m:container-lvl1/test-m-aug:container-aug", + "value": { + "container-aug": { + "leaf-aug": "data" + } + } + } + ] + } + } + """.getBytes(StandardCharsets.UTF_8)); + final var expectedData = Builders.containerBuilder() + .withNodeIdentifier(new NodeIdentifier(CONT_AUG_QNAME)) + .withChild(ImmutableNodes.leafNode(LEAF_AUG_QNAME, "data")) + .build(); + final var returnValue = jsonToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream); + checkPatchContext(returnValue); + final var data = returnValue.getData().get(0).getNode(); + assertEquals(CONT_AUG_QNAME, data.getIdentifier().getNodeType()); + assertEquals(expectedData, data); + } + /** * Test of Yang Patch on the system map node element. */