Merge "Introduce InstanceIdToNodes into yang-data-impl"
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / test / AugmentSimplestTest.java
1 package org.opendaylight.yangtools.yang.stmt.test;
2
3 import org.junit.Test;
4 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
5 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
6 import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
7 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
8 import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
9 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
10
11 import static org.junit.Assert.assertNotNull;
12
13 public class AugmentSimplestTest {
14
15     private static final TestYangFileStatementSource AUGMENTED = new TestYangFileStatementSource("/semantic-statement-parser/augmented.yang");
16     private static final TestYangFileStatementSource ROOT = new TestYangFileStatementSource("/semantic-statement-parser/root.yang");
17
18     @Test
19     public void readAndParseYangFileTest() throws SourceException, ReactorException {
20         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
21         addSources(reactor, AUGMENTED, ROOT);
22
23         EffectiveModelContext result = reactor.build();
24         assertNotNull(result);
25     }
26
27     private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
28         for (StatementStreamSource source : sources) {
29             reactor.addSource(source);
30         }
31     }
32 }