From 4ccf7791c0ff13559df0d2167b30ec922ce2d47a Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 4 Nov 2021 11:03:16 +0100 Subject: [PATCH] Cleanup TestRestconfUtils We should be ignoring non-yang files, as otherwise things like vim .swp files are wrecking our day. Change-Id: I4144f60e44f5b01c0521912213ea08707c78d938 Signed-off-by: Robert Varga --- .../restconf/nb/rfc8040/TestRestconfUtils.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/TestRestconfUtils.java b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/TestRestconfUtils.java index e2f408a154..c1682dc7cc 100644 --- a/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/TestRestconfUtils.java +++ b/restconf/restconf-nb-rfc8040/src/test/java/org/opendaylight/restconf/nb/rfc8040/TestRestconfUtils.java @@ -14,7 +14,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URISyntaxException; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Optional; import javax.xml.parsers.ParserConfigurationException; @@ -24,6 +23,7 @@ import org.opendaylight.restconf.common.context.InstanceIdentifierContext; import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload; import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier; import org.opendaylight.yangtools.util.xml.UntrustedXML; +import org.opendaylight.yangtools.yang.common.YangConstants; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream; @@ -128,7 +128,7 @@ public final class TestRestconfUtils { return null; } - public static Collection loadFiles(final String resourceDirectory) throws FileNotFoundException { + public static List loadFiles(final String resourceDirectory) throws FileNotFoundException { final String path = TestRestconfUtils.class.getResource(resourceDirectory).getPath(); final File testDir = new File(path); final String[] fileList = testDir.list(); @@ -137,7 +137,8 @@ public final class TestRestconfUtils { throw new FileNotFoundException(resourceDirectory); } for (final String fileName : fileList) { - if (new File(testDir, fileName).isDirectory() == false) { + if (fileName.endsWith(YangConstants.RFC6020_YANG_FILE_EXTENSION) + && !new File(testDir, fileName).isDirectory()) { testFiles.add(new File(testDir, fileName)); } } -- 2.36.6