2 * Copyright (c) 2016 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.stmt.yin;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
14 import java.net.URISyntaxException;
15 import java.util.Iterator;
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.yangtools.yang.model.api.Module;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
21 import org.opendaylight.yangtools.yang.stmt.TestUtils;
23 public class YinFileIncludeStmtTest {
25 private Set<Module> modules;
28 public void init() throws URISyntaxException, ReactorException {
29 modules = TestUtils.loadYinModules(getClass().getResource
30 ("/semantic-statement-parser/yin/include-belongs-to-test").toURI());
31 assertEquals(1, modules.size());
35 public void testInclude() throws URISyntaxException {
36 Module parentModule = TestUtils.findModule(modules, "parent");
37 assertNotNull(parentModule);
39 assertEquals(1, parentModule.getSubmodules().size());
40 Iterator<Module> submodulesIterator = parentModule.getSubmodules().iterator();
42 Module childModule = submodulesIterator.next() ;
43 assertNotNull(childModule);
44 assertEquals("child", childModule.getName());
45 assertEquals(new URI("urn:opendaylight/parent"), childModule.getNamespace());