2 * Copyright (c) 2017 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;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12 import static org.junit.Assert.fail;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 public class Bug8597Test {
23 public void test() throws Exception {
24 final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug8597");
25 assertNotNull(context);
27 final Module foo = context.findModuleByName("foo", QName.parseRevision("1970-01-01"));
30 final Set<ModuleImport> imports = foo.getImports();
32 for (final ModuleImport moduleImport : imports) {
33 switch (moduleImport.getModuleName()) {
35 assertEquals(QName.parseRevision("1970-01-01"), moduleImport.getRevision());
36 assertEquals("bar-ref", moduleImport.getReference());
37 assertEquals("bar-desc", moduleImport.getDescription());
40 assertEquals(QName.parseRevision("2010-10-10"), moduleImport.getRevision());
41 assertEquals("baz-ref", moduleImport.getReference());
42 assertEquals("baz-desc", moduleImport.getDescription());
45 fail("Module 'foo' should only contains import of module 'bar' and 'baz'");