1 package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test;
3 import static org.junit.Assert.*;
5 import org.junit.BeforeClass;
7 import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
8 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
9 import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
10 import org.opendaylight.yangtools.yang.data.api.*;
12 public class XmlToCnSnTest extends YangAndXmlAndDataSchemaLoader {
15 public static void initialize() {
16 dataLoad("/xml-to-cnsn/leafref");
20 public void testXmlLeafrefToCnSn() {
21 CompositeNode compositeNode = TestUtils.readInputToCnSn("/xml-to-cnsn/leafref/xml/data.xml", false,
22 XmlToCompositeNodeProvider.INSTANCE);
23 assertNotNull(compositeNode);
24 assertNotNull(dataSchemaNode);
25 TestUtils.normalizeCompositeNode(compositeNode, modules, schemaNodePath);
27 assertEquals("cont", compositeNode.getNodeType().getLocalName());
29 SimpleNode<?> lf2 = null;
30 for (Node<?> childNode : compositeNode.getChildren()) {
31 if (childNode instanceof SimpleNode) {
32 if (childNode.getNodeType().getLocalName().equals("lf2")) {
33 lf2 = (SimpleNode<?>) childNode;
40 assertTrue(lf2.getValue() instanceof String);
41 assertEquals("121", (String) lf2.getValue());