Update StmtTestUtils
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / ImportRevisionsTest.java
index 57058b5b01211a1fab1b05abe8c880fb1642d5c8..8b306941b94b59e211e3a83d8831fdf282574039 100644 (file)
@@ -9,44 +9,45 @@
 package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertNotNull;
+import static org.opendaylight.yangtools.yang.stmt.StmtTestUtils.sourceForResource;
 
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.parser.spi.meta.SomeModifiersUnresolvedException;
+import org.opendaylight.yangtools.yang.parser.spi.source.StatementStreamSource;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
 import org.opendaylight.yangtools.yang.parser.stmt.reactor.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
-import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
 
 public class ImportRevisionsTest {
 
-    private static final YangStatementSourceImpl ROOT_WITH_EQUAL_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-with-equal-revision-date.yang", false);
-    private static final YangStatementSourceImpl IMPORTED_WITH_EQUAL_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/imported-module-with-equal-revision-date.yang", false);
-    private static final YangStatementSourceImpl ROOT_WITH_UNEQUAL_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-with-unequal-revision-date.yang", false);
-    private static final YangStatementSourceImpl IMPORTED_WITH_UNEQUAL_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/imported-module-with-unequal-revision-date.yang", false);
-    private static final YangStatementSourceImpl ROOT_WITH_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-with-revision-date.yang", false);
-    private static final YangStatementSourceImpl IMPORTED_WITHOUT_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/imported-module-without-revision-date.yang", false);
-    private static final YangStatementSourceImpl ROOT_WITHOUT_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-without-revision-date.yang", false);
-    private static final YangStatementSourceImpl IMPORTED_WITH_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/imported-module-with-revision-date.yang", false);
-    private static final YangStatementSourceImpl ROOT_WITH_1970_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-with-1970-revision-date.yang", false);
-    private static final YangStatementSourceImpl ROOT_WITH_NO_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/root-with-no-revision-date.yang", false);
-    private static final YangStatementSourceImpl IMPORTED_WITH_NO_DATE = new YangStatementSourceImpl
-            ("/import-revision-date-test/imported-module-with-no-revision-date.yang", false);
+    private static final StatementStreamSource ROOT_WITH_EQUAL_DATE = sourceForResource(
+        "/import-revision-date-test/root-with-equal-revision-date.yang");
+    private static final StatementStreamSource IMPORTED_WITH_EQUAL_DATE = sourceForResource(
+            "/import-revision-date-test/imported-module-with-equal-revision-date.yang");
+    private static final StatementStreamSource ROOT_WITH_UNEQUAL_DATE = sourceForResource(
+            "/import-revision-date-test/root-with-unequal-revision-date.yang");
+    private static final StatementStreamSource IMPORTED_WITH_UNEQUAL_DATE = sourceForResource(
+            "/import-revision-date-test/imported-module-with-unequal-revision-date.yang");
+    private static final StatementStreamSource ROOT_WITH_DATE = sourceForResource(
+            "/import-revision-date-test/root-with-revision-date.yang");
+    private static final StatementStreamSource IMPORTED_WITHOUT_DATE = sourceForResource(
+            "/import-revision-date-test/imported-module-without-revision-date.yang");
+    private static final StatementStreamSource ROOT_WITHOUT_DATE = sourceForResource(
+            "/import-revision-date-test/root-without-revision-date.yang");
+    private static final StatementStreamSource IMPORTED_WITH_DATE = sourceForResource(
+            "/import-revision-date-test/imported-module-with-revision-date.yang");
+    private static final StatementStreamSource ROOT_WITH_1970_DATE = sourceForResource(
+            "/import-revision-date-test/root-with-1970-revision-date.yang");
+    private static final StatementStreamSource ROOT_WITH_NO_DATE = sourceForResource(
+            "/import-revision-date-test/root-with-no-revision-date.yang");
+    private static final StatementStreamSource IMPORTED_WITH_NO_DATE = sourceForResource(
+            "/import-revision-date-test/imported-module-with-no-revision-date.yang");
 
     @Test
     public void equalRevisionDatesTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITH_EQUAL_DATE, IMPORTED_WITH_EQUAL_DATE);
+        reactor.addSources(ROOT_WITH_EQUAL_DATE, IMPORTED_WITH_EQUAL_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);
@@ -55,7 +56,7 @@ public class ImportRevisionsTest {
     @Test(expected = SomeModifiersUnresolvedException.class)
     public void unequalRevisionDatesTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITH_UNEQUAL_DATE, IMPORTED_WITH_UNEQUAL_DATE);
+        reactor.addSources(ROOT_WITH_UNEQUAL_DATE, IMPORTED_WITH_UNEQUAL_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);
@@ -65,7 +66,7 @@ public class ImportRevisionsTest {
     @Test(expected = SomeModifiersUnresolvedException.class)
     public void revisionDatesInRootOnlyTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITH_DATE, IMPORTED_WITHOUT_DATE);
+        reactor.addSources(ROOT_WITH_DATE, IMPORTED_WITHOUT_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);
@@ -74,7 +75,7 @@ public class ImportRevisionsTest {
     @Test
     public void revisionDatesInImportedOnlyTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITHOUT_DATE, IMPORTED_WITH_DATE);
+        reactor.addSources( ROOT_WITHOUT_DATE, IMPORTED_WITH_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);
@@ -83,7 +84,7 @@ public class ImportRevisionsTest {
     @Test
     public void revision1970InRootOnlyTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITH_1970_DATE, IMPORTED_WITHOUT_DATE);
+        reactor.addSources(ROOT_WITH_1970_DATE, IMPORTED_WITHOUT_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);
@@ -92,7 +93,7 @@ public class ImportRevisionsTest {
     @Test
     public void noRevisionInRootAndImportedTest() throws ReactorException {
         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
-        StmtTestUtils.addSources(reactor, ROOT_WITH_NO_DATE, IMPORTED_WITH_NO_DATE);
+        reactor.addSources(ROOT_WITH_NO_DATE, IMPORTED_WITH_NO_DATE);
 
         EffectiveModelContext result = reactor.build();
         assertNotNull(result);