2 * Copyright (c) 2015 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.test;
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;
19 import static org.junit.Assert.assertNotNull;
21 public class YangTypesStmtTest {
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");
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);
34 private void addSources(CrossSourceStatementReactor.BuildAction reactor, StatementStreamSource... sources) {
35 for (StatementStreamSource source : sources) {
36 reactor.addSource(source);