use of org.apache.poi.stress.FileHandler in project poi by apache.
the class TestAllFiles method files.
@Parameters(name = "{index}: {0} using {1}")
public static Iterable<Object[]> files() {
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir(ROOT_DIR);
scanner.setExcludes(SCAN_EXCLUDES);
scanner.scan();
System.out.println("Handling " + scanner.getIncludedFiles().length + " files");
List<Object[]> files = new ArrayList<Object[]>();
for (String file : scanner.getIncludedFiles()) {
// ... failures/handlers lookup doesn't work on windows otherwise
file = file.replace('\\', '/');
if (IGNORED.contains(file)) {
System.out.println("Ignoring " + file);
continue;
}
FileHandler handler = HANDLERS.get(getExtension(file));
files.add(new Object[] { file, handler });
// for some file-types also run OPCFileHandler
if (handler instanceof XSSFFileHandler || handler instanceof XWPFFileHandler || handler instanceof XSLFFileHandler || handler instanceof XDGFFileHandler) {
files.add(new Object[] { file, new OPCFileHandler() });
}
if (handler instanceof HSSFFileHandler || handler instanceof HSLFFileHandler || handler instanceof HWPFFileHandler || handler instanceof HDGFFileHandler) {
files.add(new Object[] { file, new HPSFFileHandler() });
}
}
return files;
}
Aggregations