d8231d403ee144ecdc49c34c72740133056dba40
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / yin / YinFileHeaderStmtsTest.java
1 /*
2  * Copyright (c) 2016 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.stmt.yin;
9
10 import static org.junit.Assert.assertEquals;
11
12 import java.net.URI;
13 import java.net.URISyntaxException;
14 import java.util.Set;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.common.YangVersion;
18 import org.opendaylight.yangtools.yang.model.api.Module;
19 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
20 import org.opendaylight.yangtools.yang.stmt.TestUtils;
21
22 public class YinFileHeaderStmtsTest {
23
24     private Set<Module> modules;
25
26     @Before
27     public void init() throws URISyntaxException, ReactorException {
28         modules = TestUtils.loadYinModules(getClass().getResource("/semantic-statement-parser/yin/modules").toURI());
29         assertEquals(9, modules.size());
30     }
31
32     @Test
33     public void testYinFileHeader() throws URISyntaxException {
34         Module testModule = TestUtils.findModule(modules, "config");
35
36         assertEquals(YangVersion.VERSION_1.toString(), testModule.getYangVersion());
37         assertEquals(new URI("urn:opendaylight:params:xml:ns:yang:controller:config"), testModule.getNamespace());
38         assertEquals("config", testModule.getPrefix());
39     }
40
41 }