2 * Copyright (c) 2015 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.Collection;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.Module;
20 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
22 public class Bug3799Test {
25 public void test() throws Exception {
27 Set<Module> modules = TestUtils.loadModules(getClass().getResource(
28 "/bugs/bug3799").toURI());
29 assertNotNull(modules);
30 assertEquals(1, modules.size());
32 Module testModule = modules.iterator().next();
33 Set<Module> subModules = testModule.getSubmodules();
34 assertNotNull(subModules);
35 assertEquals(1, subModules.size());
37 Module testSubmodule = subModules.iterator().next();
39 Set<NotificationDefinition> notifications = testSubmodule
41 assertNotNull(notifications);
42 assertEquals(1, notifications.size());
44 NotificationDefinition bazNotification = notifications.iterator()
46 Collection<DataSchemaNode> childNodes = bazNotification.getChildNodes();
47 assertNotNull(childNodes);
48 assertEquals(1, childNodes.size());
50 DataSchemaNode child = childNodes.iterator().next();
51 assertTrue(child instanceof LeafSchemaNode);
53 LeafSchemaNode leafBar = (LeafSchemaNode) child;
54 String bar = leafBar.getQName().getLocalName();
55 assertEquals("bar", bar);