Test SchemaNodeIdentifier instead of SchemaPath 68/94968/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 2 Feb 2021 18:09:10 +0000 (19:09 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 2 Feb 2021 18:10:59 +0000 (19:10 +0100)
The SchemaNodeIdentifier path is not tested, whereas SchemaPath is.
Deprecation situation points the other way around. Rather than
duplicating tests, simply change the objects being tested.

Change-Id: Idded0df5d21d8aa756c28e223c77a2ebec1a08af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-data-codec-binfmt/src/main/java/org/opendaylight/yangtools/yang/data/codec/binfmt/AbstractNormalizedNodeDataInput.java
yang/yang-data-codec-binfmt/src/main/java/org/opendaylight/yangtools/yang/data/codec/binfmt/AbstractNormalizedNodeDataOutput.java
yang/yang-data-codec-binfmt/src/main/java/org/opendaylight/yangtools/yang/data/codec/binfmt/ForwardingNormalizedNodeDataInput.java
yang/yang-data-codec-binfmt/src/test/java/org/opendaylight/yangtools/yang/data/codec/binfmt/NormalizedNodeStreamReaderWriterTest.java

index 60e48d74e97071ec60ebf9b77d099c1bf5630138..1610e9ae4ea496263dd315d2419895511bc2222d 100644 (file)
@@ -34,6 +34,7 @@ abstract class AbstractNormalizedNodeDataInput extends ForwardingDataInput imple
     }
 
     @Override
+    @Deprecated
     public final SchemaPath readSchemaPath() throws IOException {
         final boolean absolute = input.readBoolean();
         return SchemaPath.create(readQNames(), absolute);
index fea4fd5594c2fa915fb5114614c0f60bac69a0bd..c487dab5425de77c03c2cc3b8584f68bbcde2c72 100755 (executable)
@@ -166,6 +166,7 @@ abstract class AbstractNormalizedNodeDataOutput implements NormalizedNodeDataOut
     }
 
     @Override
+    @Deprecated
     public final void writeSchemaPath(final SchemaPath path) throws IOException {
         writeSchemaNodeIdentifier(path.isAbsolute(), path.getPathFromRoot());
     }
index 20aaed7ffc322889c4926aab8e7937be80fa4ac0..c725df17e45b7fbc76f74433a2511f26f082ba09 100644 (file)
@@ -54,6 +54,7 @@ abstract class ForwardingNormalizedNodeDataInput extends ForwardingDataInput imp
     }
 
     @Override
+    @Deprecated(forRemoval = true)
     public final SchemaPath readSchemaPath() throws IOException {
         return delegate().readSchemaPath();
     }
index 29b3f66f848d3370fd51ae7f7d3a0e9c2816cffc..d03dfce000ed8d399fb2811bdf5d775ae69a7a80 100644 (file)
@@ -61,7 +61,7 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableCo
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetEntryNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafSetNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
 import org.w3c.dom.Node;
 import org.xml.sax.InputSource;
 
@@ -286,18 +286,18 @@ public class NormalizedNodeStreamReaderWriterTest {
 
     @Test
     public void testSchemaPathSerialization() throws IOException {
-        final SchemaPath expected = SchemaPath.create(true, TestModel.ANY_XML_QNAME);
+        final Absolute expected = Absolute.of(TestModel.ANY_XML_QNAME);
 
         ByteArrayOutputStream bos = new ByteArrayOutputStream();
         try (NormalizedNodeDataOutput nnout = version.newDataOutput(ByteStreams.newDataOutput(bos))) {
-            nnout.writeSchemaPath(expected);
+            nnout.writeSchemaNodeIdentifier(expected);
         }
 
         final byte[] bytes = bos.toByteArray();
         assertEquals(schemaPathSize, bytes.length);
 
         NormalizedNodeDataInput nnin = NormalizedNodeDataInput.newDataInput(ByteStreams.newDataInput(bytes));
-        assertEquals(expected, nnin.readSchemaPath());
+        assertEquals(expected, nnin.readSchemaNodeIdentifier());
     }
 
     @Test