2 * Copyright (c) 2014 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.parser.impl.util;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.assertNull;
14 import java.io.InputStream;
15 import org.junit.Test;
17 public class YangModelDependencyInfoTest {
20 public void testModuleWithNoImports() {
21 InputStream stream = getClass().getResourceAsStream("/ietf/ietf-inet-types@2010-09-24.yang");
22 YangModelDependencyInfo info = YangModelDependencyInfo.fromInputStream(stream);
24 assertEquals("ietf-inet-types", info.getName());
25 assertEquals("2010-09-24", info.getFormattedRevision());
26 assertNotNull(info.getDependencies());
30 public void testModuleWithImports() {
31 InputStream stream = getClass().getResourceAsStream("/parse-methods/dependencies/m2@2013-30-09.yang");
32 YangModelDependencyInfo info = YangModelDependencyInfo.fromInputStream(stream);
34 assertEquals("m2", info.getName());
35 assertEquals("2013-30-09", info.getFormattedRevision());
36 assertNotNull(info.getDependencies());
37 assertEquals(2, info.getDependencies().size());
41 public void testModuleWithoutRevision() {
42 InputStream stream = getClass().getResourceAsStream("/no-revision/module-without-revision.yang");
43 YangModelDependencyInfo info = YangModelDependencyInfo.fromInputStream(stream);
45 assertEquals("module-without-revision", info.getName());
46 assertNull(info.getFormattedRevision());