1 package org.opendaylight.controller.sal.restconf.impl.cnsn.to.xml.test;
3 import static org.junit.Assert.assertNotNull;
5 import java.io.IOException;
7 import java.net.URISyntaxException;
9 import javax.ws.rs.WebApplicationException;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import org.opendaylight.controller.sal.rest.impl.StructuredDataToXmlProvider;
14 import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
15 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
16 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
17 import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
18 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
22 * CnSn = Composite node and Simple node data structure Class contains test of
23 * serializing simple nodes data values according data types from YANG schema to
27 public class CnSnInstanceIdentifierToXmlTest extends YangAndXmlAndDataSchemaLoader {
30 public static void initialization() throws URISyntaxException {
31 dataLoad("/instanceidentifier/yang", 3, "instance-identifier-module", "cont");
35 public void snAsYangInstanceIdentifier() throws WebApplicationException, IOException, URISyntaxException {
36 CompositeNode cnSnData = prepareCnStructForYangData( );
37 String xmlOutput = TestUtils.writeCompNodeWithSchemaContextToOutput(cnSnData, modules, dataSchemaNode,
38 StructuredDataToXmlProvider.INSTANCE);
39 assertNotNull(xmlOutput);
42 private CompositeNode prepareCnStructForYangData() throws URISyntaxException {
43 CompositeNodeWrapper cont = new CompositeNodeWrapper(new URI("instance:identifier:module"), "cont");
44 CompositeNodeWrapper cont1 = new CompositeNodeWrapper(new URI("augment:module"), "cont1");
46 SimpleNodeWrapper lf11 = new SimpleNodeWrapper(new URI("augment:augment:module"), "lf11", "/cont/cont1/lf12");
47 SimpleNodeWrapper lf12 = new SimpleNodeWrapper(new URI("augment:augment:module"), "lf12", "lf12 value");