Bug 7954: Throw an exception when parsing duplicate (sub)modules
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / AugmentSimplestTest.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
9 package org.opendaylight.yangtools.yang.stmt;
10
11 import static org.junit.Assert.assertNotNull;
12 import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
13
14 import org.junit.Test;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
16 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
17 import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
18 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
19 import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
21
22 public class AugmentSimplestTest {
23
24     private static final StatementStreamSource AUGMENTED = sourceForResource(
25         "/semantic-statement-parser/augmented.yang");
26     private static final StatementStreamSource ROOT = sourceForResource("/semantic-statement-parser/root.yang");
27
28     @Test
29     public void readAndParseYangFileTest() throws SourceException, ReactorException {
30         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
31         reactor.addSources(AUGMENTED, ROOT);
32
33         EffectiveModelContext result = reactor.build();
34         assertNotNull(result);
35     }
36 }