Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-rfc7950 / 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.io.IOException;
13 import java.net.URI;
14 import java.net.URISyntaxException;
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.model.api.SchemaContext;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
21 import org.opendaylight.yangtools.yang.stmt.TestUtils;
22 import org.xml.sax.SAXException;
23
24 public class YinFileHeaderStmtsTest {
25
26     private SchemaContext modules;
27
28     @Before
29     public void init() throws URISyntaxException, ReactorException, SAXException, IOException {
30         modules = TestUtils.loadYinModules(getClass().getResource("/semantic-statement-parser/yin/modules").toURI());
31         assertEquals(9, modules.getModules().size());
32     }
33
34     @Test
35     public void testYinFileHeader() throws URISyntaxException {
36         Module testModule = TestUtils.findModule(modules, "config").get();
37
38         assertEquals(YangVersion.VERSION_1, testModule.getYangVersion());
39         assertEquals(new URI("urn:opendaylight:params:xml:ns:yang:controller:config"), testModule.getNamespace());
40         assertEquals("config", testModule.getPrefix());
41     }
42
43 }