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;
14 import org.junit.BeforeClass;
15 import org.junit.Test;
16 import org.opendaylight.controller.sal.restconf.impl.CompositeNodeWrapper;
17 import org.opendaylight.controller.sal.restconf.impl.RestconfDocumentedException;
18 import org.opendaylight.controller.sal.restconf.impl.SimpleNodeWrapper;
19 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
21 public class NormalizeNodeTest extends YangAndXmlAndDataSchemaLoader {
24 public static void initialization() {
25 dataLoad("/normalize-node/yang/");
28 @Test(expected = RestconfDocumentedException.class)
29 public void namespaceNotNullAndInvalidNamespaceAndNoModuleNameTest() {
31 TestUtils.normalizeCompositeNode(prepareCnSn("wrongnamespace"), modules, schemaNodePath);
35 public void namespaceNullTest() {
37 TestUtils.normalizeCompositeNode(prepareCnSn(null), modules, schemaNodePath);
41 public void namespaceValidNamespaceTest() {
43 TestUtils.normalizeCompositeNode(prepareCnSn("normalize:node:module"), modules, schemaNodePath);
47 public void namespaceValidModuleNameTest() {
49 TestUtils.normalizeCompositeNode(prepareCnSn("normalize-node-module"), modules, schemaNodePath);
52 private CompositeNode prepareCnSn(final String namespace) {
54 if (namespace != null) {
56 uri = new URI(namespace);
57 } catch (URISyntaxException e) {
62 SimpleNodeWrapper lf1 = new SimpleNodeWrapper(uri, "lf1", 43);
63 CompositeNodeWrapper cont = new CompositeNodeWrapper(uri, "cont");