1 package org.opendaylight.yangtools.yang.stmt.test;
3 import static org.junit.Assert.assertEquals;
4 import static org.junit.Assert.assertNotNull;
5 import static org.junit.Assert.assertTrue;
6 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
7 import java.util.Collection;
8 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
9 import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
11 import org.opendaylight.yangtools.yang.model.api.Module;
12 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
14 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
15 import java.io.IOException;
16 import java.net.URISyntaxException;
17 import org.junit.Test;
19 public class Bug3799Test {
22 public void test() throws IOException, URISyntaxException, SourceException,
24 SchemaContext schema = StmtTestUtils.parseYangSources("/bugs/bug3799");
25 assertNotNull(schema);
27 Set<Module> modules = schema.getModules();
28 assertNotNull(modules);
29 assertEquals(1, modules.size());
31 Module testModule = modules.iterator().next();
32 Set<Module> subModules = testModule.getSubmodules();
33 assertNotNull(subModules);
34 assertEquals(1, subModules.size());
36 Module testSubmodule = subModules.iterator().next();
38 Set<NotificationDefinition> notifications = testSubmodule
40 assertNotNull(notifications);
41 assertEquals(1, notifications.size());
43 NotificationDefinition bazNotification = notifications.iterator()
45 Collection<DataSchemaNode> childNodes = bazNotification.getChildNodes();
46 assertNotNull(childNodes);
47 assertEquals(1, childNodes.size());
49 DataSchemaNode child = childNodes.iterator().next();
50 assertTrue(child instanceof LeafSchemaNode);
52 LeafSchemaNode leafBar = (LeafSchemaNode) child;
53 String bar = leafBar.getQName().getLocalName();
54 assertEquals("bar", bar);