Bug 5085: Clean-up test and retest JUnit tests
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / YangParserWithContextTest.java
similarity index 94%
rename from yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/retest/YangParserWithContextTest.java
rename to yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/YangParserWithContextTest.java
index 8918a5adbbb1fa2254b8458ade6c6b3616817dec..c76545fd4eb314c970d435d1bfdac53b5ee7f576 100644 (file)
@@ -1,23 +1,20 @@
 /*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-package org.opendaylight.yangtools.yang.stmt.retest;
+package org.opendaylight.yangtools.yang.stmt;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import java.io.File;
 import java.net.URI;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -44,16 +41,14 @@ import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.UsesNode;
 import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
 import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
+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.rfc6020.YangInferencePipeline;
 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
-import org.opendaylight.yangtools.yang.stmt.test.StmtTestUtils;
 
 public class YangParserWithContextTest {
     private final DateFormat simpleDateFormat = new SimpleDateFormat(
             "yyyy-MM-dd");
-    private final YangParserImpl parser = new YangParserImpl();
 
     private static final YangStatementSourceImpl BAR = new YangStatementSourceImpl(
             "/model/bar.yang", false);
@@ -395,20 +390,13 @@ public class YangParserWithContextTest {
 
     @Test
     public void testAugment() throws Exception {
-        // load first module
-        String resource = "/context-augment-test/test4.yang";
-        SchemaContext context = parser.parseFiles(Collections
-                .singleton(new File(getClass().getResource(resource).toURI())));
-
-        // load another modules and parse them against already existing context
-        File test1 = new File(getClass().getResource(
-                "/context-augment-test/test1.yang").toURI());
-        File test2 = new File(getClass().getResource(
-                "/context-augment-test/test2.yang").toURI());
-        File test3 = new File(getClass().getResource(
-                "/context-augment-test/test3.yang").toURI());
-        Set<Module> modules = parser.parseFiles(
-                Arrays.asList(test1, test2, test3), context).getModules();
+        StatementStreamSource resource = new YangStatementSourceImpl("/context-augment-test/test4.yang", false);
+        StatementStreamSource test1 = new YangStatementSourceImpl("/context-augment-test/test1.yang", false);
+        StatementStreamSource test2 = new YangStatementSourceImpl("/context-augment-test/test2.yang", false);
+        StatementStreamSource test3 = new YangStatementSourceImpl("/context-augment-test/test3.yang", false);
+
+        SchemaContext context = TestUtils.parseYangSources(resource, test1, test2, test3);
+        Set<Module> modules = context.getModules();
         assertNotNull(modules);
 
         Module t4 = TestUtils.findModule(modules, "test4");