2 * Copyright (c) 2013 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.parser.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
14 import java.util.List;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
19 import org.opendaylight.yangtools.yang.model.api.Module;
20 import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
23 * Test antlr grammar capability to parse nested unknown nodes.
25 public class Bug394Test {
28 public void testParseList() throws Exception {
29 Set<Module> modules = TestUtils.loadModules(getClass().getResource("/bugs/bug394").toURI());
30 Module bug394 = TestUtils.findModule(modules, "bug394");
31 assertNotNull(bug394);
32 Module bug394_ext = TestUtils.findModule(modules, "bug394-ext");
33 assertNotNull(bug394_ext);
35 ContainerSchemaNode logrecords = (ContainerSchemaNode) bug394.getDataChildByName("logrecords");
36 assertNotNull(logrecords);
38 List<UnknownSchemaNode> nodes = logrecords.getUnknownSchemaNodes();
39 assertEquals(2, nodes.size());
41 List<ExtensionDefinition> extensions = bug394_ext.getExtensionSchemaNodes();
42 assertEquals(2, extensions.size());
44 assertTrue(extensions.contains(nodes.get(0).getExtensionDefinition()));
45 assertTrue(extensions.contains(nodes.get(1).getExtensionDefinition()));