2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.sal.restconf.impl.test;
10 import static org.junit.Assert.assertNotNull;
13 import java.net.URISyntaxException;
15 import org.junit.BeforeClass;
16 import org.junit.Test;
17 import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
18 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
19 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
20 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
22 public class NormalizeNodeTest extends YangAndXmlAndDataSchemaLoader {
25 public static void initialization() {
26 dataLoad("/normalize-node/yang/");
29 @Test(expected=RestconfDocumentedException.class)
30 public void namespaceNotNullAndInvalidNamespaceAndNoModuleNameTest() {
32 TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath);
36 public void namespaceNullTest() {
38 TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath);
42 public void namespaceValidNamespaceTest() {
44 TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath);
48 public void namespaceValidModuleNameTest() {
50 TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath);
53 private CompositeNode prepareCnSn(final String namespace) {
55 if (namespace != null) {
57 uri = new URI(namespace);
58 } catch (URISyntaxException e) {
63 SimpleNodeWrapper lf1 = new SimpleNodeWrapper(uri, "lf1", 43);
64 CompositeNodeWrapper cont = new CompositeNodeWrapper(uri, "cont");