X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=netconf.git;a=blobdiff_plain;f=restconf%2Frestconf-nb%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fnb%2Frfc8040%2Fjersey%2Fproviders%2Fpatch%2FXmlPatchBodyReaderTest.java;h=b791ed626d6d4e5b48e686c04bca4e814e465ea7;hp=c9b33b2062a3921439a211d88f8b2d0277bc2af0;hb=73795b7e0ceef10455970623ffadf3c8c25820a7;hpb=38731f54f58263d94dc56e85c6ee08409d153472 diff --git a/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReaderTest.java b/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReaderTest.java index c9b33b2062..b791ed626d 100644 --- a/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReaderTest.java +++ b/restconf/restconf-nb/src/test/java/org/opendaylight/restconf/nb/rfc8040/jersey/providers/patch/XmlPatchBodyReaderTest.java @@ -15,7 +15,6 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import javax.ws.rs.core.MediaType; import org.junit.BeforeClass; -import org.junit.Ignore; import org.junit.Test; import org.opendaylight.restconf.common.errors.RestconfDocumentedException; import org.opendaylight.restconf.nb.rfc8040.jersey.providers.test.AbstractBodyReaderTest; @@ -176,9 +175,7 @@ public class XmlPatchBodyReaderTest extends AbstractBodyReaderTest { /** * Test of Yang Patch on the leaf set node element. - * TODO: Remove ignore when NETCONF-937 will be resolved */ - @Ignore @Test public void modulePatchTargetLeafSetNodeTest() throws Exception { mockBodyReader("", xmlToPatchBodyReader, false); @@ -199,7 +196,7 @@ public class XmlPatchBodyReaderTest extends AbstractBodyReaderTest { final var expectedData = Builders.leafSetBuilder() .withNodeIdentifier(new NodeIdentifier(LEAF_SET_QNAME)) .withChild(Builders.leafSetEntryBuilder() - .withNodeIdentifier(new NodeWithValue(LEAF_SET_QNAME, "data1")) + .withNodeIdentifier(new NodeWithValue<>(LEAF_SET_QNAME, "data1")) .withValue("data1") .build()) .build(); @@ -280,4 +277,31 @@ public class XmlPatchBodyReaderTest extends AbstractBodyReaderTest { assertEquals(CHOICE_CONT_QNAME, data.getIdentifier().getNodeType()); assertEquals(expectedData, data); } + + /** + * Test reading simple leaf value. + */ + @Test + public void modulePatchSimpleLeafValueTest() throws Exception { + mockBodyReader("instance-identifier-patch-module:patch-cont/my-list1=leaf1", xmlToPatchBodyReader, false); + final var inputStream = new ByteArrayInputStream(""" + + test-patch + this is test patch + + edit1 + replace + /my-list2=my-leaf20/name + + my-leaf20 + + + + """.getBytes(StandardCharsets.UTF_8)); + final var returnValue = xmlToPatchBodyReader.readFrom(null, null, null, mediaType, null, inputStream); + checkPatchContext(returnValue); + final var data = returnValue.getData().get(0).getNode(); + assertEquals(LEAF_NAME_QNAME, data.getIdentifier().getNodeType()); + assertEquals(ImmutableNodes.leafNode(LEAF_NAME_QNAME, "my-leaf20"), data); + } }