X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Fjson%2Fto%2Fcnsn%2Ftest%2FJsonToCnSnTest.java;h=3a90e73acbc4e8756ca88f127f2065245ac8dd05;hb=2cf5e6fc42a7b0884fbb2998c749146805767fa5;hp=f2c0c29bc4372b6b54eeec0dc3bf9d9805f36663;hpb=3fdb59d96aecf80c8e5b414f2c69fc2d521c0abd;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java index f2c0c29bc4..3a90e73acb 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonToCnSnTest.java @@ -1,6 +1,7 @@ package org.opendaylight.controller.sal.restconf.impl.json.to.cnsn.test; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -10,6 +11,7 @@ import java.util.Set; import javax.ws.rs.WebApplicationException; +import org.junit.Ignore; import org.junit.Test; import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; @@ -207,15 +209,8 @@ public class JsonToCnSnTest { assertEquals("lst", compNode.getNodeType().getLocalName()); verifyCompositeNode(compNode, "simple:list:yang1"); - String exceptionMessage = ""; - try { - TestUtils.normalizeCompositeNode(compositeNode, modules2, "simple-list-yang2:lst"); - } catch (ResponseException e) { - exceptionMessage = String.valueOf(e.getResponse().getEntity()); - } - assertTrue(exceptionMessage - .contains("Data has bad format\nIf data is in XML format then namespace for lst should be simple:list:yang2.\n If data is in Json format then module name for lst should be simple-list-yang2.")); - + TestUtils.normalizeCompositeNode(compositeNode, modules2, "simple-list-yang2:lst"); + verifyCompositeNode(compNode, "simple:list:yang1"); } @Test @@ -272,9 +267,28 @@ public class JsonToCnSnTest { assertEquals("iden_local", ((QName) lf14.getValue()).getLocalName()); assertEquals("identity:module", ((QName) lf14.getValue()).getNamespace().toString()); } + + @Ignore + @Test + public void loadDataAugmentedSchemaMoreEqualNamesTest() { + boolean exceptionCaught = false; + try { + loadAndNormalizeData("/common/augment/json/dataa.json", "/common/augment/yang", "cont", "main"); + loadAndNormalizeData("/common/augment/json/datab.json", "/common/augment/yang", "cont", "main"); + } catch (ResponseException e) { + exceptionCaught = true; + } + + assertFalse(exceptionCaught); + } private void simpleTest(String jsonPath, String yangPath, String topLevelElementName, String namespace, String moduleName) { + CompositeNode compNode = loadAndNormalizeData(jsonPath, yangPath, topLevelElementName, moduleName); + verifyCompositeNode(compNode, namespace); + } + + private CompositeNode loadAndNormalizeData(String jsonPath, String yangPath, String topLevelElementName, String moduleName) { CompositeNode compositeNode = TestUtils.readInputToCnSn(jsonPath, false, JsonToCompositeNodeProvider.INSTANCE); assertNotNull(compositeNode); @@ -288,7 +302,7 @@ public class JsonToCnSnTest { CompositeNode compNode = ((CompositeNodeWrapper) compositeNode).unwrap(); assertEquals(topLevelElementName, compNode.getNodeType().getLocalName()); - verifyCompositeNode(compNode, namespace); + return compNode; } private void verityMultipleItemsInList(CompositeNode compositeNode) {