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=a98f39ae24792ca7745a2d03d22f0a9504996610;hp=1eb3779730c2baf7f8c17159c697379e0e097b0a;hb=1e884647502a8d91f8a57bde8193c60b9bbcce0d;hpb=1f3ee2a2588512476704f3bf1c3528753ad453d5 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 1eb3779730..a98f39ae24 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 @@ -1,18 +1,14 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ 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; public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { @@ -21,106 +17,4 @@ public class CnSnJsonChoiceCaseTest extends YangAndXmlAndDataSchemaLoader { dataLoad("/cnsn-to-json/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 - 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 - 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 - public void nodeSchemasWithRandomOrderAccordingLevel() { - testWrapper("/cnsn-to-json/choice/xml/data_random_level.xml", "choice-case-test:cont"); - } - - /** - * Test when element from no first case is used - */ - @Test - public void nodeSchemasNotInFirstCase() { - testWrapper("/cnsn-to-json/choice/xml/data_no_first_case.xml", "choice-case-test:cont"); - } - - /** - * Test when element in case is list - */ - @Test - public void nodeSchemaAsList() { - testWrapper("/cnsn-to-json/choice/xml/data_list.xml", "choice-case-test:cont"); - } - - /** - * Test when element in case is container - */ - @Test - public void nodeSchemaAsContainer() { - testWrapper("/cnsn-to-json/choice/xml/data_container.xml", "choice-case-test:cont"); - } - - /** - * Test when element in case is leaflist - */ - @Test - public void nodeSchemaAsLeafList() { - testWrapper("/cnsn-to-json/choice/xml/data_leaflist.xml", "choice-case-test:cont"); - } - - /** - * - */ - @Test - public void nodeSchemasInMultipleChoicesTest() { - testWrapper("/cnsn-to-json/choice/xml/data_more_choices_same_level.xml", "choice-case-test:cont"); - } - - /** - * 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() { - testWrapper("/cnsn-to-json/choice/xml/data_case_defined_without_case.xml", "choice-case-test:cont"); - } - - /** - * Test of multiple use of choices - */ - @Test - public void nodeSchemasInThreeChoicesAtSameLevel() { - testWrapper("/cnsn-to-json/choice/xml/data_three_choices_same_level.xml", "choice-case-test:cont"); - } - - private void testWrapper(String xmlPath, String pathToSchemaNode) { - CompositeNode compNode = TestUtils.readInputToCnSn(xmlPath, XmlToCompositeNodeProvider.INSTANCE); - TestUtils.normalizeCompositeNode(compNode, modules, pathToSchemaNode); - try { - TestUtils.writeCompNodeWithSchemaContextToOutput(compNode, modules, dataSchemaNode, - StructuredDataToJsonProvider.INSTANCE); - } catch (WebApplicationException | IOException e) { - // shouldn't end here - assertTrue(false); - } - } }