Address FIXME for QueuedNotificationManager
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / Bug3799Test.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.parser.impl;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertTrue;
13
14 import java.util.Collection;
15 import java.util.Set;
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;
21
22 public class Bug3799Test {
23
24     @Test
25     public void test() throws Exception {
26
27         Set<Module> modules = TestUtils.loadModules(getClass().getResource(
28                 "/bugs/bug3799").toURI());
29         assertNotNull(modules);
30         assertEquals(1, modules.size());
31
32         Module testModule = modules.iterator().next();
33         Set<Module> subModules = testModule.getSubmodules();
34         assertNotNull(subModules);
35         assertEquals(1, subModules.size());
36
37         Module testSubmodule = subModules.iterator().next();
38
39         Set<NotificationDefinition> notifications = testSubmodule
40                 .getNotifications();
41         assertNotNull(notifications);
42         assertEquals(1, notifications.size());
43
44         NotificationDefinition bazNotification = notifications.iterator()
45                 .next();
46         Collection<DataSchemaNode> childNodes = bazNotification.getChildNodes();
47         assertNotNull(childNodes);
48         assertEquals(1, childNodes.size());
49
50         DataSchemaNode child = childNodes.iterator().next();
51         assertTrue(child instanceof LeafSchemaNode);
52
53         LeafSchemaNode leafBar = (LeafSchemaNode) child;
54         String bar = leafBar.getQName().getLocalName();
55         assertEquals("bar", bar);
56     }
57
58 }