for (File algFile : examplesDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) { return pathname.isFile() && pathname.getName().endsWith(".alg"); }
})) {
try {
Config config = new Config(new InputStreamReader(new FileInputStream(algFile), StandardCharsets.UTF_8));
String contentSource = config.get("content.source", null);
if (contentSource != null) { Class.forName(contentSource); }
config.set("work.dir", createTempDir(LuceneTestCase.getTestClass().getSimpleName()).getAbsolutePath());
config.set("content.source", MockContentSource.class.getName());
String dir = config.get("content.source", null);
if (dir != null) { Class.forName(dir); }
config.set("directory", RAMDirectory.class.getName());
if (config.get("line.file.out", null) != null) {
config.set("line.file.out", createTempFile("linefile", ".txt").getAbsolutePath());
}
if (config.get("query.maker", null) != null) {
Class.forName(config.get("query.maker", null));
config.set("query.maker", MockQueryMaker.class.getName());
}
PerfRunData data = new PerfRunData(config);
new Algorithm(data);
} catch (Throwable t) {
throw new AssertionError("Could not parse sample file: " + algFile, t);