protected void runSingleGoldReport(final String file, final ReportProcessingMode mode) throws Exception { initializeTestEnvironment(); final File marker = findMarker(); final File gold = new File(marker, mode.getGoldDirectoryName()); try { final File reportFile = findReport(file); System.out.printf("Processing %s in mode=%s%n", file, mode); run(reportFile, gold, mode); System.out.printf("Finished %s in mode=%s%n", file, mode); } catch (Throwable re) { throw new Exception("Failed at " + file, re); } System.out.println(marker); }
private void processReports(final String sourceDirectoryName, final ReportProcessingMode mode) throws Exception { final File marker = findMarker(); final File reports = new File(marker, sourceDirectoryName); final File gold = new File(marker, mode.getGoldDirectoryName()); final FilenameFilter filter = createReportFilter(); final File[] files = reports.listFiles(filter); if (files == null) { throw new IOException("IO-Error while listing files for '" + reports + "'"); } final HashSet<String> fileSet = new HashSet<String>(); for (final File file : files) { final String s = file.getName().toLowerCase(); if (fileSet.add(s) == false) { // the toy systems MacOS X and Windows use case-insensitive file systems and completely // mess up when there are two files with what they consider the same name. throw new IllegalStateException( "There is a golden sample with the same Windows/Mac " + "filename in the directory. Make sure your files are unique and lowercase."); } } for (final File file : files) { if (file.isDirectory()) { continue; } try { System.out.printf("Processing %s in mode=%s%n", file, mode); run(file, gold, mode); System.out.printf("Finished %s in mode=%s%n", file, mode); } catch (Throwable re) { throw new Exception("Failed at " + file, re); } } }