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 <robert.varga@pantheon.tech>
import java.io.InputStream;
import java.net.URISyntaxException;
import java.util.ArrayList;
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;
import java.util.List;
import java.util.Optional;
import javax.xml.parsers.ParserConfigurationException;
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.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;
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;
- public static Collection<File> loadFiles(final String resourceDirectory) throws FileNotFoundException {
+ public static List<File> 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();
final String path = TestRestconfUtils.class.getResource(resourceDirectory).getPath();
final File testDir = new File(path);
final String[] fileList = testDir.list();
throw new FileNotFoundException(resourceDirectory);
}
for (final String fileName : fileList) {
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));
}
}
testFiles.add(new File(testDir, fileName));
}
}