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%2Ftest%2FNormalizeNodeTest.java;h=a2aff72d1fa8a01d7e77c544e85dffbe7154880d;hb=1e884647502a8d91f8a57bde8193c60b9bbcce0d;hp=1573b570287a02f8531381743c996dd6f6061962;hpb=811583cee43dd5a0198acdb179ae9c80160ca65f;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java index 1573b57028..a2aff72d1f 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/NormalizeNodeTest.java @@ -1,18 +1,13 @@ +/* + * 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.test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.net.URI; -import java.net.URISyntaxException; - import org.junit.BeforeClass; -import org.junit.Test; -import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper; -import org.opendaylight.controller.sal.restconf.impl.ResponseException; -import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; public class NormalizeNodeTest extends YangAndXmlAndDataSchemaLoader { @@ -21,67 +16,4 @@ public class NormalizeNodeTest extends YangAndXmlAndDataSchemaLoader { dataLoad("/normalize-node/yang/"); } - @Test - public void namespaceNotNullAndInvalidNamespaceAndNoModuleNameTest() { - String exceptionMessage = null; - try { - TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath); - } catch (ResponseException e) { - exceptionMessage = String.valueOf(e.getResponse().getEntity()); - } - assertEquals( - exceptionMessage, - "Data has bad format.\nIf data is in XML format then namespace for cont should be normalize:node:module.\nIf data is in Json format then module name for cont should be normalize-node-module."); - } - - @Test - public void namespaceNullTest() { - String exceptionMessage = null; - try { - TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath); - } catch (ResponseException e) { - exceptionMessage = String.valueOf(e.getResponse().getEntity()); - } - assertNull(exceptionMessage); - } - - @Test - public void namespaceValidNamespaceTest() { - String exceptionMessage = null; - try { - TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath); - } catch (ResponseException e) { - exceptionMessage = String.valueOf(e.getResponse().getEntity()); - } - assertNull(exceptionMessage); - } - - @Test - public void namespaceValidModuleNameTest() { - String exceptionMessage = null; - try { - TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath); - } catch (ResponseException e) { - exceptionMessage = String.valueOf(e.getResponse().getEntity()); - } - assertNull(exceptionMessage); - } - - private CompositeNode prepareCnSn(String namespace) { - URI uri = null; - if (namespace != null) { - try { - uri = new URI(namespace); - } catch (URISyntaxException e) { - } - assertNotNull(uri); - } - - SimpleNodeWrapper lf1 = new SimpleNodeWrapper(uri, "lf1", 43); - CompositeNodeWrapper cont = new CompositeNodeWrapper(uri, "cont"); - cont.addValue(lf1); - - return cont; - } - }