2 * Copyright (c) 2016 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.assertNotNull;
11 import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
16 import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
17 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
18 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
20 public class YangTypesStmtTest {
22 private static final StatementStreamSource TYPEFILE1 = sourceForResource("/semantic-statement-parser/types.yang");
23 private static final StatementStreamSource TYPEFILE2 = sourceForResource(
24 "/semantic-statement-parser/simple-types.yang");
25 private static final StatementStreamSource TYPEFILE3 = sourceForResource(
26 "/semantic-statement-parser/identityreftest.yang");
28 private static final StatementStreamSource FILE1 = sourceForResource("/semantic-statement-parser/model/bar.yang");
29 private static final StatementStreamSource FILE2 = sourceForResource("/semantic-statement-parser/model/baz.yang");
30 private static final StatementStreamSource FILE3 = sourceForResource(
31 "/semantic-statement-parser/model/subfoo.yang");
32 private static final StatementStreamSource FILE4 = sourceForResource("/semantic-statement-parser/model/foo.yang");
35 public void readAndParseYangFileTest() throws ReactorException {
36 CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
37 reactor.addSources(TYPEFILE1, TYPEFILE2, TYPEFILE3);
38 reactor.addSources(FILE1, FILE2, FILE3, FILE4);
39 SchemaContext result = reactor.buildEffective();
40 assertNotNull(result);