Bug 1131 - yang-parser-impl cleanup
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / util / YangModelDependencyInfoTest.java
1 /*
2  * Copyright (c) 2014 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.util;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12
13 import java.io.InputStream;
14 import org.junit.Test;
15
16 public class YangModelDependencyInfoTest {
17
18     @Test
19     public void testModuleWithNoImports() {
20         InputStream stream = getClass().getResourceAsStream("/ietf/ietf-inet-types@2010-09-24.yang");
21         YangModelDependencyInfo info = YangModelDependencyInfo.fromInputStream(stream);
22         assertNotNull(info);
23         assertEquals("ietf-inet-types", info.getName());
24         assertEquals("2010-09-24", info.getFormattedRevision());
25         assertNotNull(info.getDependencies());
26     }
27     
28     
29     @Test
30     public void testModuleWithImports() {
31         InputStream stream = getClass().getResourceAsStream("/parse-methods/dependencies/m2@2013-30-09.yang");
32         YangModelDependencyInfo info = YangModelDependencyInfo.fromInputStream(stream);
33         assertNotNull(info);
34         assertEquals("m2", info.getName());
35         assertEquals("2013-30-09", info.getFormattedRevision());
36         assertNotNull(info.getDependencies());
37         assertEquals(2, info.getDependencies().size());
38     }
39
40 }