X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Fcnsn%2Fto%2Fjson%2Ftest%2FCnSnJsonBasicYangTypesTest.java;h=0f059f5024cdc7c70dc7042f488e9fa22c32da55;hp=d978a2f0de25af2f26c106dea7c79a759fea4ce0;hb=refs%2Fchanges%2F27%2F8927%2F3;hpb=cb210bea2ab44aa2922ed86232c9db9a10452fc0 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java index d978a2f0de..0f059f5024 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonBasicYangTypesTest.java @@ -13,13 +13,13 @@ import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonToken; import java.io.IOException; import java.io.StringReader; import java.util.Map; import java.util.Set; - import javax.ws.rs.WebApplicationException; - import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; @@ -37,9 +37,6 @@ import org.opendaylight.yangtools.yang.data.api.MutableCompositeNode; import org.opendaylight.yangtools.yang.data.api.MutableSimpleNode; import org.opendaylight.yangtools.yang.data.impl.NodeFactory; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonToken; - public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { @BeforeClass @@ -48,8 +45,7 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { } /** - * Test of json output when as input are specified composite node with empty - * data + YANG file + * Test of json output when as input are specified composite node with empty data + YANG file */ @Test @@ -67,8 +63,7 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { } /** - * Test of json output when as input are specified xml file (no empty - * elements)and YANG file + * Test of json output when as input are specified xml file (no empty elements)and YANG file */ @Test public void xmlAndYangTypesWithJsonReaderTest() { @@ -355,11 +350,8 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { assertEquals(1, lst11_1.getLfs().size()); assertEquals(1, lst11_1.getConts().size()); assertEquals(1, lst11_1.getLsts().size()); - assertEquals( - lst11_1.getLsts().get("lst111"), - new Lst("lst111").addLstItem(new LstItem().addLf("lf1111", 35)) - .addLstItem(new LstItem().addLf("lf1111", 34)).addLstItem(new LstItem()) - .addLstItem(new LstItem())); + assertEquals(lst11_1.getLsts().get("lst111"), new Lst("lst111").addLstItem(new LstItem().addLf("lf1111", 35)) + .addLstItem(new LstItem().addLf("lf1111", 34)).addLstItem(new LstItem()).addLstItem(new LstItem())); assertEquals(lst11_1.getConts().get("cont111"), new Cont("cont111")); // : lst11_1 @@ -378,8 +370,7 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { assertEquals(1, lst11_2_cont111.getLsts().size()); assertTrue(lst11_2_cont111.getConts().isEmpty()); - assertEquals(new LfLst("lflst1111").addLf(1024).addLf(4096), - lst11_2_cont111.getLfLsts().get("lflst1111")); + assertEquals(new LfLst("lflst1111").addLf(1024).addLf(4096), lst11_2_cont111.getLfLsts().get("lflst1111")); assertEquals( new Lst("lst1111").addLstItem(new LstItem().addLf("lf1111B", 4)).addLstItem( new LstItem().addLf("lf1111A", "lf1111A str12")), lst11_2_cont111.getLsts().get("lst1111")); @@ -539,90 +530,108 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { TestUtils.buildQName("cont1", "simple:yang:types", "2013-11-5"), null, null, ModifyAction.CREATE, null); // lst11_1 - MutableCompositeNode lst11_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, - null, ModifyAction.CREATE, null); + MutableCompositeNode lst11_1 = NodeFactory + .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1, + null, ModifyAction.CREATE, null); cont1.getValue().add(lst11_1); - MutableSimpleNode lf111_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_1, - (short) 1, ModifyAction.CREATE, null); + MutableSimpleNode lf111_1 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_1, (short) 1, + ModifyAction.CREATE, null); lst11_1.getValue().add(lf111_1); // lst111_1_1 - MutableCompositeNode lst111_1_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), - lst11_1, null, ModifyAction.CREATE, null); + MutableCompositeNode lst111_1_1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE, + null); lst11_1.getValue().add(lst111_1_1); - MutableSimpleNode lf1111_1_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111","simple:yang:types","2013-11-5"), - lst111_1_1, 34, ModifyAction.CREATE, null); + MutableSimpleNode lf1111_1_1 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf1111", "simple:yang:types", "2013-11-5"), lst111_1_1, 34, ModifyAction.CREATE, + null); lst111_1_1.getValue().add(lf1111_1_1); lst111_1_1.init(); // :lst111_1_1 // lst111_1_2 - MutableCompositeNode lst111_1_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), - lst11_1, null, ModifyAction.CREATE, null); + MutableCompositeNode lst111_1_2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE, + null); lst11_1.getValue().add(lst111_1_2); - MutableSimpleNode lf1111_1_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111","simple:yang:types","2013-11-5"), - lst111_1_2, 35, ModifyAction.CREATE, null); + MutableSimpleNode lf1111_1_2 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf1111", "simple:yang:types", "2013-11-5"), lst111_1_2, 35, ModifyAction.CREATE, + null); lst111_1_2.getValue().add(lf1111_1_2); lst111_1_2.init(); // :lst111_1_2 // lst111_1_3 - MutableCompositeNode lst111_1_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), - lst11_1, null, ModifyAction.CREATE, null); + MutableCompositeNode lst111_1_3 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE, + null); lst11_1.getValue().add(lst111_1_3); lst111_1_2.init(); // :lst111_1_3 // lst111_1_4 - MutableCompositeNode lst111_1_4 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst111","simple:yang:types","2013-11-5"), - lst11_1, null, ModifyAction.CREATE, null); + MutableCompositeNode lst111_1_4 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE, + null); lst11_1.getValue().add(lst111_1_4); lst111_1_2.init(); // :lst111_1_4 - MutableCompositeNode cont111_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), - lst11_1, null, ModifyAction.CREATE, null); + MutableCompositeNode cont111_1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_1, null, ModifyAction.CREATE, + null); lst11_1.getValue().add(cont111_1); lst11_1.init(); // :lst11_1 // lst11_2 - MutableCompositeNode lst11_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, - null, ModifyAction.CREATE, null); + MutableCompositeNode lst11_2 = NodeFactory + .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1, + null, ModifyAction.CREATE, null); cont1.getValue().add(lst11_2); - MutableSimpleNode lf111_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_2, - (short) 2, ModifyAction.CREATE, null); + MutableSimpleNode lf111_2 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_2, (short) 2, + ModifyAction.CREATE, null); lst11_2.getValue().add(lf111_2); // cont111_2 - MutableCompositeNode cont111_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), - lst11_2, null, ModifyAction.CREATE, null); + MutableCompositeNode cont111_2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_2, null, ModifyAction.CREATE, + null); lst11_2.getValue().add(cont111_2); - MutableSimpleNode lflst1111_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111","simple:yang:types","2013-11-5"), - cont111_2, 1024, ModifyAction.CREATE, null); + MutableSimpleNode lflst1111_2_2 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lflst1111", "simple:yang:types", "2013-11-5"), cont111_2, 1024, + ModifyAction.CREATE, null); cont111_2.getValue().add(lflst1111_2_2); - MutableSimpleNode lflst1111_2_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lflst1111","simple:yang:types","2013-11-5"), - cont111_2, 4096, ModifyAction.CREATE, null); + MutableSimpleNode lflst1111_2_3 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lflst1111", "simple:yang:types", "2013-11-5"), cont111_2, 4096, + ModifyAction.CREATE, null); cont111_2.getValue().add(lflst1111_2_3); // lst1111_2 - MutableCompositeNode lst1111_2_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), - cont111_2, null, ModifyAction.CREATE, null); + MutableCompositeNode lst1111_2_1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_2, null, + ModifyAction.CREATE, null); cont111_2.getValue().add(lst1111_2_1); - MutableSimpleNode lf1111B_2_1 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111B","simple:yang:types","2013-11-5"), - lst1111_2_1, (short) 4, ModifyAction.CREATE, null); + MutableSimpleNode lf1111B_2_1 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf1111B", "simple:yang:types", "2013-11-5"), lst1111_2_1, (short) 4, + ModifyAction.CREATE, null); lst1111_2_1.getValue().add(lf1111B_2_1); lst1111_2_1.init(); - MutableCompositeNode lst1111_2_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), - cont111_2, null, ModifyAction.CREATE, null); + MutableCompositeNode lst1111_2_2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_2, null, + ModifyAction.CREATE, null); cont111_2.getValue().add(lst1111_2_2); - MutableSimpleNode lf1111A_2_2 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf1111A","simple:yang:types","2013-11-5"), - lst1111_2_2, "lf1111A str12", ModifyAction.CREATE, null); + MutableSimpleNode lf1111A_2_2 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf1111A", "simple:yang:types", "2013-11-5"), lst1111_2_2, "lf1111A str12", + ModifyAction.CREATE, null); lst1111_2_2.getValue().add(lf1111A_2_2); lst1111_2_2.init(); // :lst1111_2 @@ -630,8 +639,9 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { cont111_2.init(); // :cont111_2 - MutableCompositeNode lst112_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst112","simple:yang:types","2013-11-5"), lst11_2, - null, ModifyAction.CREATE, null); + MutableCompositeNode lst112_2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst112", "simple:yang:types", "2013-11-5"), lst11_2, null, ModifyAction.CREATE, + null); lst11_2.getValue().add(lst112_2); lst112_2.init(); lst11_2.init(); @@ -639,26 +649,31 @@ public class CnSnJsonBasicYangTypesTest extends YangAndXmlAndDataSchemaLoader { // :lst11_2 // lst11_3 - MutableCompositeNode lst11_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst11","simple:yang:types","2013-11-5"), cont1, - null, ModifyAction.CREATE, null); + MutableCompositeNode lst11_3 = NodeFactory + .createMutableCompositeNode(TestUtils.buildQName("lst11", "simple:yang:types", "2013-11-5"), cont1, + null, ModifyAction.CREATE, null); cont1.getValue().add(lst11_3); - MutableSimpleNode lf111_3 = NodeFactory.createMutableSimpleNode(TestUtils.buildQName("lf111","simple:yang:types","2013-11-5"), lst11_3, - (short) 3, ModifyAction.CREATE, null); + MutableSimpleNode lf111_3 = NodeFactory.createMutableSimpleNode( + TestUtils.buildQName("lf111", "simple:yang:types", "2013-11-5"), lst11_3, (short) 3, + ModifyAction.CREATE, null); lst11_3.getValue().add(lf111_3); // cont111_3 - MutableCompositeNode cont111_3 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("cont111","simple:yang:types","2013-11-5"), - lst11_3, null, ModifyAction.CREATE, null); + MutableCompositeNode cont111_3 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("cont111", "simple:yang:types", "2013-11-5"), lst11_3, null, ModifyAction.CREATE, + null); lst11_3.getValue().add(cont111_3); - MutableCompositeNode lst1111_3_1 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), - cont111_3, null, ModifyAction.CREATE, null); + MutableCompositeNode lst1111_3_1 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_3, null, + ModifyAction.CREATE, null); cont111_3.getValue().add(lst1111_3_1); lst1111_3_1.init(); - MutableCompositeNode lst1111_3_2 = NodeFactory.createMutableCompositeNode(TestUtils.buildQName("lst1111","simple:yang:types","2013-11-5"), - cont111_3, null, ModifyAction.CREATE, null); + MutableCompositeNode lst1111_3_2 = NodeFactory.createMutableCompositeNode( + TestUtils.buildQName("lst1111", "simple:yang:types", "2013-11-5"), cont111_3, null, + ModifyAction.CREATE, null); cont111_3.getValue().add(lst1111_3_2); lst1111_3_2.init();