* @throws IOException
*/
private void readValueObject(@Nonnull final StringBuffer value, @Nonnull final JsonReader in) throws IOException {
+ // read simple leaf value
+ if (in.peek() == JsonToken.STRING) {
+ value.append("\"" + in.nextString() + "\"");
+ return;
+ }
+
in.beginObject();
value.append("{");
* @throws IOException
*/
private void readValueObject(@Nonnull final StringBuffer value, @Nonnull final JsonReader in) throws IOException {
+ // read simple leaf value
+ if (in.peek() == JsonToken.STRING) {
+ value.append("\"" + in.nextString() + "\"");
+ return;
+ }
+
in.beginObject();
value.append("{");
.readFrom(null, null, null, mediaType, null, inputStream);
checkPATCHContext(returnValue);
}
+
+ /**
+ * Test reading simple leaf value
+ */
+ @Test
+ public void modulePATCHSimpleLeafValueTest() throws Exception {
+ final String uri = "instance-identifier-patch-module:patch-cont/my-list1/leaf1";
+ mockBodyReader(uri, jsonPATCHBodyReader, false);
+
+ final InputStream inputStream = TestJsonBodyReader.class
+ .getResourceAsStream("/instanceidentifier/json/jsonPATCHSimpleLeafValue.json");
+
+ final PATCHContext returnValue = jsonPATCHBodyReader
+ .readFrom(null, null, null, mediaType, null, inputStream);
+ checkPATCHContext(returnValue);
+ }
}
.readFrom(null, null, null, mediaType, null, inputStream);
checkPATCHContextMountPoint(returnValue);
}
+
+ /**
+ * Test reading simple leaf value
+ */
+ @Test
+ public void modulePATCHSimpleLeafValueTest() throws Exception {
+ final String uri = MOUNT_POINT + "/instance-identifier-patch-module:patch-cont/my-list1/leaf1";
+ mockBodyReader(uri, jsonPATCHBodyReader, false);
+
+ final InputStream inputStream = TestJsonBodyReader.class
+ .getResourceAsStream("/instanceidentifier/json/jsonPATCHSimpleLeafValue.json");
+
+ final PATCHContext returnValue = jsonPATCHBodyReader
+ .readFrom(null, null, null, mediaType, null, inputStream);
+ checkPATCHContext(returnValue);
+ }
}
.readFrom(null, null, null, mediaType, null, inputStream);
checkPATCHContextMountPoint(returnValue);
}
+
+ /**
+ * Test reading simple leaf value
+ */
+ @Test
+ public void modulePATCHSimpleLeafValueTest() throws Exception {
+ final String uri = MOUNT_POINT + "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
+ mockBodyReader(uri, jsonPATCHBodyReader, false);
+
+ final InputStream inputStream = TestJsonBodyReader.class
+ .getResourceAsStream("/instanceidentifier/json/jsonPATCHSimpleLeafValue.json");
+
+ final PATCHContext returnValue = jsonPATCHBodyReader
+ .readFrom(null, null, null, mediaType, null, inputStream);
+ checkPATCHContext(returnValue);
+ }
}
.readFrom(null, null, null, mediaType, null, inputStream);
checkPATCHContext(returnValue);
}
+
+ /**
+ * Test reading simple leaf value
+ */
+ @Test
+ public void modulePATCHSimpleLeafValueTest() throws Exception {
+ final String uri = "instance-identifier-patch-module:patch-cont/my-list1=leaf1";
+ mockBodyReader(uri, jsonPATCHBodyReader, false);
+
+ final InputStream inputStream = TestJsonBodyReader.class
+ .getResourceAsStream("/instanceidentifier/json/jsonPATCHSimpleLeafValue.json");
+
+ final PATCHContext returnValue = jsonPATCHBodyReader
+ .readFrom(null, null, null, mediaType, null, inputStream);
+ checkPATCHContext(returnValue);
+ }
}
--- /dev/null
+{
+ "ietf-yang-patch:yang-patch" : {
+
+ "patch-id" : "test-patch",
+ "comment" : "this is test patch for simple leaf value",
+ "edit" : [
+ {
+ "edit-id": "edit1",
+ "operation": "replace",
+ "target": "/instance-identifier-patch-module:my-list2[instance-identifier-patch-module:name='my-leaf20']/instance-identifier-patch-module:name",
+ "value": {
+ "name": "my-leaf20"
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file