DATABIND = DatabindContext.ofModel(YangParserTestUtils.parseYangFiles(testFiles));
}
- // FIXME: migrate callers to use string literals
- @Deprecated
- final @NonNull NormalizedNode parseResource(final String uriPath, final String resourceName) throws IOException {
- return parse(uriPath, AbstractResourceBodyTest.class.getResourceAsStream(resourceName));
- }
-
final @NonNull NormalizedNode parse(final String uriPath, final String patchBody) throws IOException {
- return parse(uriPath, stringInputStream(patchBody));
- }
-
- private @NonNull NormalizedNode parse(final String uriPath, final InputStream patchBody) throws IOException {
final ApiPath apiPath;
try {
apiPath = ApiPath.parse(uriPath);
throw new AssertionError(e);
}
- try (var body = bodyConstructor.apply(patchBody)) {
+ try (var body = bodyConstructor.apply(stringInputStream(patchBody))) {
final var context = InstanceIdentifierContext.ofApiPath(apiPath, DATABIND, mountPointService);
return body.toNormalizedNode(
new DataPutPath(context.databind(), context.inference(), context.getInstanceIdentifier()),
@Test
void moduleSubContainerDataPostTest() {
- final var body = new JsonChildBody(
- JsonChildBodyTest.class.getResourceAsStream("/instanceidentifier/json/json_sub_container.json"));
+ final var body = new JsonChildBody(stringInputStream("""
+ {
+ "instance-identifier-module:cont1": {
+ "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont\
+ /instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\\"lflst11_1\\"]"
+ }
+ }"""));
final var payload = body.toPayload(CONT_PATH);
final var lflst11 = QName.create("augment:module:leaf:list", "2014-01-27", "lflst11");
.withNodeIdentifier(CONT1_NID)
.withChild(ImmutableNodes.leafNode(LF11, YangInstanceIdentifier.of(CONT_NID, CONT1_NID,
new NodeIdentifier(LFLST11), new NodeWithValue<>(LFLST11, "lflst11_1"))))
- .build(), parseResource("instance-identifier-module:cont/cont1",
- "/instanceidentifier/json/json_sub_container.json"));
+ .build(), parse("instance-identifier-module:cont/cont1", """
+ {
+ "instance-identifier-module:cont1": {
+ "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont\
+ /instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\\"lflst11_1\\"]"
+ }
+ }"""));
}
@Test
+++ /dev/null
-{
- "instance-identifier-module:cont1": {
- "augment-module-leaf-list:lf11" : "/instance-identifier-module:cont/instance-identifier-module:cont1/augment-module-leaf-list:lflst11[.=\"lflst11_1\"]"
- }
-}
\ No newline at end of file