Do not use NamedInputStream 44/62744/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 6 Sep 2017 08:33:46 +0000 (10:33 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 6 Sep 2017 08:33:46 +0000 (10:33 +0200)
NamedInputStream is going away, as it is useless. Use a proper
File-based schemacontext utility instead.

Change-Id: Ifefaf9d33c683656a571ba7613940bce6787dd24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/TestUtils.java

index 024e4548ee1e02d222f790e92b950c0e1967820a..2c2e1f4d593716de0ab1ce35c9d69ae4ac119205 100644 (file)
@@ -49,7 +49,6 @@ import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.util.NamedFileInputStream;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -62,7 +61,7 @@ public final class TestUtils {
 
     public static SchemaContext loadSchemaContext(final String... yangPath)
             throws FileNotFoundException, ReactorException {
-        final List<InputStream> files = new ArrayList<>();
+        final List<File> files = new ArrayList<>();
         for (final String path : yangPath) {
             final String pathToFile = TestUtils.class.getResource(path).getPath();
             final File testDir = new File(pathToFile);
@@ -74,11 +73,12 @@ public final class TestUtils {
             for (final String fileName : fileList) {
                 final File file = new File(testDir, fileName);
                 if (file.isDirectory() == false) {
-                    files.add(new NamedFileInputStream(file, file.getPath()));
+                    files.add(file);
                 }
             }
         }
-        return YangParserTestUtils.parseYangStreams(files);
+
+        return YangParserTestUtils.parseYangSources(files);
     }
 
     public static Module findModule(final Set<Module> modules, final String moduleName) {
@@ -225,7 +225,7 @@ public final class TestUtils {
 
     public static NodeIdentifierWithPredicates getNodeIdentifierPredicate(final String localName,
             final String namespace, final String revision, final String... keysAndValues) throws ParseException {
-        Preconditions.checkArgument((keysAndValues.length % 2) == 0,
+        Preconditions.checkArgument(keysAndValues.length % 2 == 0,
                 "number of keys argument have to be divisible by 2 (map)");
         final Map<QName, Object> predicate = new HashMap<>();