X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Fxml%2Fto%2Fcnsn%2Ftest%2FXmlToCnSnTest.java;h=64568da769cad13132806df5bb551edd51bcaf20;hb=032371baa081315920e52a7806ea09676e47316b;hp=5cda4a7f52014dc4a9ab3572d9073877ec12e74e;hpb=83e1c610eeefba667a19c243fbc1098072a8079d;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java index 5cda4a7f52..64568da769 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/xml/to/cnsn/test/XmlToCnSnTest.java @@ -14,7 +14,6 @@ import static org.junit.Assert.assertTrue; import java.io.ByteArrayInputStream; import java.io.InputStream; - import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; @@ -33,9 +32,12 @@ public class XmlToCnSnTest extends YangAndXmlAndDataSchemaLoader { @Test public void testXmlLeafrefToCnSn() { - CompositeNode compositeNode = TestUtils.readInputToCnSn("/xml-to-cnsn/leafref/xml/data.xml", false, + Node node = TestUtils.readInputToCnSn("/xml-to-cnsn/leafref/xml/data.xml", false, XmlToCompositeNodeProvider.INSTANCE); - assertNotNull(compositeNode); + assertTrue(node instanceof CompositeNode); + CompositeNode compositeNode = (CompositeNode)node; + + assertNotNull(dataSchemaNode); TestUtils.normalizeCompositeNode(compositeNode, modules, schemaNodePath); @@ -52,31 +54,30 @@ public class XmlToCnSnTest extends YangAndXmlAndDataSchemaLoader { } assertNotNull(lf2); - assertTrue(lf2.getValue() instanceof String); - assertEquals("121", lf2.getValue()); + assertEquals(121, lf2.getValue()); } @Test - public void testXmlBlankInput() throws Exception{ - InputStream inputStream = new ByteArrayInputStream( "".getBytes() ); - CompositeNode compositeNode = + public void testXmlBlankInput() throws Exception { + InputStream inputStream = new ByteArrayInputStream("".getBytes()); + Node node = XmlToCompositeNodeProvider.INSTANCE.readFrom(null, null, null, null, null, inputStream); - assertNull( compositeNode ); + assertNull( node ); } @Test - public void testXmlBlankInputUnmarkableStream() throws Exception{ - InputStream inputStream = new ByteArrayInputStream( "".getBytes() ){ + public void testXmlBlankInputUnmarkableStream() throws Exception { + InputStream inputStream = new ByteArrayInputStream("".getBytes()) { @Override public boolean markSupported() { return false; } }; - CompositeNode compositeNode = + Node node = XmlToCompositeNodeProvider.INSTANCE.readFrom(null, null, null, null, null, inputStream); - assertNull( compositeNode ); + assertNull( node ); } }