Bug 3067: Fixed missing argument in message.
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / test / YangTypesStmtTest.java
1 /*
2  * Copyright (c) 2015 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.stmt.test;
9
10 import org.junit.Test;
11 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
12 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
13 import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
14 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
15 import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
16 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
17 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
18
19 import static org.junit.Assert.assertNotNull;
20
21 public class YangTypesStmtTest {
22
23     private static final YangStatementSourceImpl TYPEFILE1 = new YangStatementSourceImpl("/semantic-statement-parser/types.yang");
24     private static final YangStatementSourceImpl TYPEFILE2 = new YangStatementSourceImpl("/semantic-statement-parser/simple-types.yang");
25
26     @Test
27     public void readAndParseYangFileTest() throws SourceException, ReactorException {
28         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
29         addSources(reactor, TYPEFILE1, TYPEFILE2);
30         EffectiveModelContext result = reactor.build();
31         assertNotNull(result);
32     }
33
34     private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
35         for (StatementStreamSource source : sources) {
36             reactor.addSource(source);
37         }
38     }
39 }