X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=parser%2Fyang-parser-rfc7950%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fstmt%2FStmtTestUtils.java;h=1b037d94413f7f11cb24d67d14865a6507f22f94;hb=ad338ff278f137696478df3d27675f1d1e78a8eb;hp=c06db19a823450c8fadff87b8c3629809b477481;hpb=cff2c14842ca56d38b6ae4dd0576cbf147f051ea;p=yangtools.git diff --git a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java index c06db19a82..1b037d9441 100644 --- a/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java +++ b/parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/StmtTestUtils.java @@ -17,18 +17,13 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; -import java.util.List; import java.util.Set; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.common.YangConstants; -import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; -import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.ModuleImport; -import org.opendaylight.yangtools.yang.model.api.ModuleLike; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -import org.opendaylight.yangtools.yang.model.api.Submodule; import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier; import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource; import org.opendaylight.yangtools.yang.model.repo.api.YinTextSchemaSource; @@ -69,16 +64,6 @@ public final class StmtTestUtils { } } - public static List findModules(final Collection modules, final String moduleName) { - final List result = new ArrayList<>(); - for (final Module module : modules) { - if (module.getName().equals(moduleName)) { - result.add(module); - } - } - return result; - } - public static YangStatementStreamSource sourceForResource(final String resourceName) { try { return YangStatementStreamSource.create(YangTextSchemaSource.forPath(Path.of( @@ -88,29 +73,6 @@ public final class StmtTestUtils { } } - public static void printReferences(final ModuleLike module, final boolean isSubmodule, final String indent) { - LOG.debug("{}{} {}", indent, isSubmodule ? "Submodule" : "Module", module.getName()); - for (final Submodule submodule : module.getSubmodules()) { - printReferences(submodule, true, indent + " "); - printChilds(submodule.getChildNodes(), indent + " "); - } - } - - public static void printChilds(final Collection childNodes, final String indent) { - - for (final DataSchemaNode child : childNodes) { - LOG.debug("{}{} {}", indent, "Child", child.getQName().getLocalName()); - if (child instanceof DataNodeContainer) { - printChilds(((DataNodeContainer) child).getChildNodes(), indent + " "); - } - } - } - - public static EffectiveModelContext parseYangSource(final String yangSourcePath) throws ReactorException, - URISyntaxException, IOException, YangSyntaxErrorException { - return parseYangSource(yangSourcePath, YangParserConfiguration.DEFAULT, null); - } - public static EffectiveModelContext parseYangSource(final String yangSourcePath, final Set supportedFeatures) throws ReactorException, URISyntaxException, IOException, YangSyntaxErrorException { return parseYangSource(yangSourcePath, YangParserConfiguration.DEFAULT, supportedFeatures); @@ -119,9 +81,8 @@ public final class StmtTestUtils { public static EffectiveModelContext parseYangSource(final String yangSourcePath, final YangParserConfiguration config, final Set supportedFeatures) throws ReactorException, URISyntaxException, IOException, YangSyntaxErrorException { - final URL source = StmtTestUtils.class.getResource(yangSourcePath); - final File sourceFile = new File(source.toURI()); - return parseYangSources(config, supportedFeatures, sourceFile); + return parseYangSources(config, supportedFeatures, + new File(StmtTestUtils.class.getResource(yangSourcePath).toURI())); } public static EffectiveModelContext parseYangSources(final StatementStreamSource... sources) @@ -161,21 +122,6 @@ public final class StmtTestUtils { return parseYangSources(config, supportedFeatures, sources); } - public static EffectiveModelContext parseYangSources(final Collection files) throws ReactorException, - IOException, YangSyntaxErrorException { - return parseYangSources(files, YangParserConfiguration.DEFAULT); - } - - public static EffectiveModelContext parseYangSources(final Collection files, - final YangParserConfiguration config) throws ReactorException, IOException, YangSyntaxErrorException { - return parseYangSources(config, null, files.toArray(new File[0])); - } - - public static EffectiveModelContext parseYangSources(final String yangSourcesDirectoryPath) - throws ReactorException, URISyntaxException, IOException, YangSyntaxErrorException { - return parseYangSources(yangSourcesDirectoryPath, YangParserConfiguration.DEFAULT); - } - public static EffectiveModelContext parseYangSources(final String yangSourcesDirectoryPath, final YangParserConfiguration config) throws ReactorException, URISyntaxException, IOException, YangSyntaxErrorException {