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%2FCnSnJsonChoiceCaseTest.java;h=632d2490ee2623272d7aff1a944a48a6d4ce353d;hp=8abf366bf7153dea82055de0ded4c816accffebd;hb=bdcd6c4baea3357499a1fcdff459259b56373baa;hpb=94d0d20b41d64bb6696c2a573ec367fcfddc44e9 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java index 8abf366bf7..632d2490ee 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/cnsn/to/json/test/CnSnJsonChoiceCaseTest.java @@ -10,16 +10,15 @@ package org.opendaylight.controller.sal.restconf.impl.cnsn.to.json.test; import static org.junit.Assert.assertTrue; import java.io.IOException; - import javax.ws.rs.WebApplicationException; - import org.junit.BeforeClass; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.StructuredDataToJsonProvider; import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider; import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.Node; +import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.valid.DataValidationException; public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { @@ -29,32 +28,30 @@ public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { } /** - * Test when some data are in one case node and other in another. This isn't - * correct. Next Json validator should return error because nodes has to be - * from one case below concrete choice. - * + * Test when some data are in one case node and other in another. This isn't correct. Next Json validator should + * return error because nodes has to be from one case below concrete choice. + * */ - @Test + @Test(expected=DataValidationException.class) public void nodeSchemasOnVariousChoiceCasePathTest() { testWrapper("/cnsn-to-json/choice/xml/data_various_path_err.xml", "choice-case-test:cont"); } /** - * Test when some data are in one case node and other in another. - * Additionally data are loadef from various choices. This isn't correct. - * Next Json validator should return error because nodes has to be from one - * case below concrete choice. - * + * Test when some data are in one case node and other in another. Additionally data are loadef from various choices. + * This isn't correct. Next Json validator should return error because nodes has to be from one case below concrete + * choice. + * */ - @Test + @Test(expected=DataValidationException.class) public void nodeSchemasOnVariousChoiceCasePathAndMultipleChoicesTest() { testWrapper("/cnsn-to-json/choice/xml/data_more_choices_same_level_various_paths_err.xml", "choice-case-test:cont"); } /** - * Test when second level data are red first, then first and at the end - * third level. Level represents pass through couple choice-case + * Test when second level data are red first, then first and at the end third level. Level represents pass through + * couple choice-case */ @Test @@ -95,7 +92,7 @@ public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { } /** - * + * */ @Test public void nodeSchemasInMultipleChoicesTest() { @@ -103,8 +100,8 @@ public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { } /** - * Test whether is possible to find data schema for node which is specified - * as dirrect subnode of choice (case without CASE key word) + * Test whether is possible to find data schema for node which is specified as dirrect subnode of choice (case + * without CASE key word) */ @Test public void nodeSchemasInCaseNotDefinedWithCaseKeyword() { @@ -120,10 +117,10 @@ public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { } private void testWrapper(String xmlPath, String pathToSchemaNode) { - CompositeNode compNode = TestUtils.readInputToCnSn(xmlPath, XmlToCompositeNodeProvider.INSTANCE); - TestUtils.normalizeCompositeNode(compNode, modules, pathToSchemaNode); + Node node = TestUtils.readInputToCnSn(xmlPath, XmlToCompositeNodeProvider.INSTANCE); + TestUtils.normalizeCompositeNode(node, modules, pathToSchemaNode); try { - TestUtils.writeCompNodeWithSchemaContextToOutput(compNode, modules, dataSchemaNode, + TestUtils.writeCompNodeWithSchemaContextToOutput(node, modules, dataSchemaNode, StructuredDataToJsonProvider.INSTANCE); } catch (WebApplicationException | IOException e) { // shouldn't end here