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%2FJsonIdentityrefToCnSnTest.java;h=86c1595386a2f0fb9ef8fd36003ad057ec85c519;hb=81236f34ad88ffcb71c8d7cdb15b82bad2e50251;hp=e9b1dbe1a590978cd5538796a130fda4bb281fb8;hpb=515e60d60ac7dd08aa2440468cd8dab42892e7d0;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/JsonIdentityrefToCnSnTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java index e9b1dbe1a5..86c1595386 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/json/to/cnsn/test/JsonIdentityrefToCnSnTest.java @@ -1,16 +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.json.to.cnsn.test; -import static org.junit.Assert.*; - -import java.util.List; - import org.junit.BeforeClass; -import org.junit.Test; -import org.opendaylight.controller.sal.rest.impl.JsonToCompositeNodeProvider; -import org.opendaylight.controller.sal.restconf.impl.test.TestUtils; import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader; -import org.opendaylight.yangtools.yang.common.QName; -import org.opendaylight.yangtools.yang.data.api.*; public class JsonIdentityrefToCnSnTest extends YangAndXmlAndDataSchemaLoader { @@ -19,56 +17,4 @@ public class JsonIdentityrefToCnSnTest extends YangAndXmlAndDataSchemaLoader { dataLoad("/json-to-cnsn/identityref", 2, "identityref-module", "cont"); } - @Test - public void jsonIdentityrefToCompositeNode() { - CompositeNode compositeNode = TestUtils.readInputToCnSn("/json-to-cnsn/identityref/json/data.json", false, - JsonToCompositeNodeProvider.INSTANCE); - assertNotNull(compositeNode); - - TestUtils.normalizeCompositeNode(compositeNode, modules, searchedModuleName + ":" + searchedDataSchemaName); - - assertEquals("cont", compositeNode.getNodeType().getLocalName()); - - List> childs = compositeNode.getChildren(); - assertEquals(1, childs.size()); - Node nd = childs.iterator().next(); - assertTrue(nd instanceof CompositeNode); - assertEquals("cont1", nd.getNodeType().getLocalName()); - - childs = ((CompositeNode) nd).getChildren(); - assertEquals(4, childs.size()); - SimpleNode lf11 = null; - SimpleNode lf12 = null; - SimpleNode lf13 = null; - SimpleNode lf14 = null; - for (Node child : childs) { - assertTrue(child instanceof SimpleNode); - if (child.getNodeType().getLocalName().equals("lf11")) { - lf11 = (SimpleNode) child; - } else if (child.getNodeType().getLocalName().equals("lf12")) { - lf12 = (SimpleNode) child; - } else if (child.getNodeType().getLocalName().equals("lf13")) { - lf13 = (SimpleNode) child; - } else if (child.getNodeType().getLocalName().equals("lf14")) { - lf14 = (SimpleNode) child; - } - } - - assertTrue(lf11.getValue() instanceof QName); - assertEquals("iden", ((QName) lf11.getValue()).getLocalName()); - assertEquals("identity:module", ((QName) lf11.getValue()).getNamespace().toString()); - - assertTrue(lf12.getValue() instanceof QName); - assertEquals("iden_local", ((QName) lf12.getValue()).getLocalName()); - assertEquals("identityref:module", ((QName) lf12.getValue()).getNamespace().toString()); - - assertTrue(lf13.getValue() instanceof QName); - assertEquals("iden_local", ((QName) lf13.getValue()).getLocalName()); - assertEquals("identityref:module", ((QName) lf13.getValue()).getNamespace().toString()); - - assertTrue(lf14.getValue() instanceof QName); - assertEquals("iden_local", ((QName) lf14.getValue()).getLocalName()); - assertEquals("identity:module", ((QName) lf14.getValue()).getNamespace().toString()); - } - }