Fix checkstyle in yang-parser-impl and enable enforcement
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / YangTypesStmtTest.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 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.junit.Assert.assertNotNull;
11 import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
12
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;
19
20 public class YangTypesStmtTest {
21
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");
27
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");
33
34     @Test
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);
41     }
42 }