Revert "Eliminate use of SchemaNode.getPath() in TestRestconfUtils" 78/100178/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Mar 2022 09:16:51 +0000 (10:16 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 21 Mar 2022 09:17:02 +0000 (10:17 +0100)
This reverts commit f2a340f0a8ec957382fb48ab7694d9c20d916a7f. The
assumptsions being made are just not correct.

Change-Id: Ib1a44afa3f344376633bf414b8dfdace724c0d8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/TestRestconfUtils.java

index 1ecdef936d2b7f9b54c315f34bb2614876bf97e6..c1682dc7cce4c30ce27c662bf3214f97dfc61701 100644 (file)
@@ -24,8 +24,6 @@ import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
 import org.opendaylight.yangtools.util.xml.UntrustedXML;
 import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
@@ -119,14 +117,8 @@ public final class TestRestconfUtils {
 
         final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
         final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
-
-        final SchemaInferenceStack stack = SchemaInferenceStack.of(iiContext.getSchemaContext());
-        iiContext.getInstanceIdentifier().getPathArguments().stream()
-                .filter(p -> !(p instanceof NodeIdentifierWithPredicates))
-                .filter(p -> !(p instanceof AugmentationIdentifier))
-                .forEach(p -> stack.enterSchemaTree(p.getNodeType()));
-
-        final XmlParserStream xmlParser = XmlParserStream.create(writer, stack.toInference());
+        final XmlParserStream xmlParser = XmlParserStream.create(writer,
+            SchemaInferenceStack.ofInstantiatedPath(iiContext.getSchemaContext(), schemaNode.getPath()).toInference());
 
         if (schemaNode instanceof ContainerSchemaNode || schemaNode instanceof ListSchemaNode) {
             xmlParser.traverse(new DOMSource(doc.getDocumentElement()));