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>
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.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;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public static SchemaContext loadSchemaContext(final String... yangPath)
throws FileNotFoundException, ReactorException {
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);
for (final String path : yangPath) {
final String pathToFile = TestUtils.class.getResource(path).getPath();
final File testDir = new File(pathToFile);
for (final String fileName : fileList) {
final File file = new File(testDir, fileName);
if (file.isDirectory() == false) {
for (final String fileName : fileList) {
final File file = new File(testDir, fileName);
if (file.isDirectory() == false) {
- files.add(new NamedFileInputStream(file, file.getPath()));
- return YangParserTestUtils.parseYangStreams(files);
+
+ return YangParserTestUtils.parseYangSources(files);
}
public static Module findModule(final Set<Module> modules, final String moduleName) {
}
public static Module findModule(final Set<Module> modules, final String moduleName) {
public static NodeIdentifierWithPredicates getNodeIdentifierPredicate(final String localName,
final String namespace, final String revision, final String... keysAndValues) throws ParseException {
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<>();
"number of keys argument have to be divisible by 2 (map)");
final Map<QName, Object> predicate = new HashMap<>();