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.yangtools.yang.data.composite.node.schema.parser;
10 import static org.junit.Assert.assertEquals;
12 import org.opendaylight.yangtools.yang.data.composite.node.schema.cnsn.parser.CnSnToNormalizedNodeParserFactory;
15 import org.opendaylight.yangtools.yang.data.composite.node.schema.TestUtils;
17 import java.net.URISyntaxException;
18 import java.util.ArrayList;
19 import java.util.List;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
25 import org.opendaylight.yangtools.yang.data.api.Node;
26 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
27 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
28 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
29 import org.opendaylight.yangtools.yang.model.api.Module;
31 public class ParseCnSnStructToNormalizedStructTest {
33 private static DataSchemaNode resolvedDataSchemaNode;
36 public static void loadData() throws URISyntaxException {
37 Set<Module> modules = TestUtils.loadModulesFrom("/cnsn-to-normalized-node/yang");
38 Module resolvedModule = TestUtils.resolveModule("simple-container-yang", modules);
39 resolvedDataSchemaNode = TestUtils.resolveDataSchemaNode("cont", resolvedModule);
43 public void testCnSnToNormalizedNode() throws URISyntaxException {
45 CompositeNode compNode = TestUtils.prepareCompositeNodeStruct();
47 List<Node<?>> lst = new ArrayList<Node<?>>();
49 ContainerNode parsed = CnSnToNormalizedNodeParserFactory.getInstance().getContainerNodeParser()
50 .parse(lst, (ContainerSchemaNode) resolvedDataSchemaNode);
52 ContainerNode prepareExpectedStruct = TestUtils.prepareNormalizedNodeStruct();
53 assertEquals(prepareExpectedStruct, parsed);