- static SchemaContext loadModules(final String resourceDirectory) throws IOException, URISyntaxException,
- ReactorException {
- URI path = StreamToNormalizedNodeTest.class.getResource(resourceDirectory).toURI();
- final File testDir = new File(path);
- final String[] fileList = testDir.list();
- final List<File> testFiles = new ArrayList<>();
- if (fileList == null) {
- throw new FileNotFoundException(resourceDirectory);
- }
- for (String fileName : fileList) {
- if (!new File(testDir, fileName).isDirectory()) {
- testFiles.add(new File(testDir, fileName));
- }
- }
- return parseYangSources(testFiles);
- }
-
- public static SchemaContext parseYangSources(StatementStreamSource... sources)
- throws SourceException, ReactorException {
-
- CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
- .newBuild();
- reactor.addSources(sources);
-
- return reactor.buildEffective();
- }
-
- public static SchemaContext parseYangSources(File... files) throws SourceException, ReactorException, FileNotFoundException {
-
- StatementStreamSource[] sources = new StatementStreamSource[files.length];
-
- for (int i = 0; i<files.length; i++) {
- sources[i] = new YangStatementSourceImpl(new FileInputStream(files[i]));
- }
-
- return parseYangSources(sources);
- }
-
- public static SchemaContext parseYangSources(Collection<File> files) throws SourceException, ReactorException, FileNotFoundException {
- return parseYangSources(files.toArray(new File[files.size()]));
- }
-
-
- public static SchemaContext parseYangStreams(List<InputStream> streams)
- throws SourceException, ReactorException {
-
- CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR
- .newBuild();
- return reactor.buildEffective(streams);
- }
-