/** * Load the test outcomes from a given directory. * * @param reportDirectory An existing directory that contains the test outcomes in XML or JSON format. * @return The full list of test outcomes. * @throws java.io.IOException Thrown if the specified directory was invalid. */ public List<TestOutcome> loadFrom(final File reportDirectory) throws IOException { final AcceptanceTestLoader testOutcomeReporter = getOutcomeReporter(); List<File> reportFiles = getAllOutcomeFilesFrom(reportDirectory); final List<TestOutcome> testOutcomes = Collections.synchronizedList(new ArrayList<TestOutcome>()); for(File reportFile : reportFiles) { testOutcomes.addAll(testOutcomeReporter.loadReportFrom(reportFile).asSet()); } Collections.sort(testOutcomes, byTitle()); return ImmutableList.copyOf(testOutcomes); }
/** * Load the test outcomes from a given directory. * * @param reportDirectory An existing directory that contains the test outcomes in XML or JSON format. * @return The full list of test outcomes. * @throws java.io.IOException Thrown if the specified directory was invalid. */ public List<TestOutcome> loadFrom(final File reportDirectory) throws IOException { final AcceptanceTestLoader testOutcomeReporter = getOutcomeReporter(); List<File> reportFiles = getAllOutcomeFilesFrom(reportDirectory); final List<TestOutcome> testOutcomes = Collections.synchronizedList(new ArrayList<TestOutcome>()); for(File reportFile : reportFiles) { testOutcomes.addAll(testOutcomeReporter.loadReportFrom(reportFile).asSet()); } Collections.sort(testOutcomes, byTitle()); return ImmutableList.copyOf(testOutcomes); }
/** * Load the test outcomes from a given directory, sorted by Title * * @param reportDirectory An existing directory that contains the test outcomes in XML or JSON format. * @return The full list of test outcomes. * @throws ReportLoadingFailedError Thrown if the specified directory was invalid or loading finished with error. */ public List<TestOutcome> loadFrom(final File reportDirectory) throws ReportLoadingFailedError { try { final List<Callable<Set<TestOutcome>>> partitions = new ArrayList<>(); final AcceptanceTestLoader testOutcomeReporter = getOutcomeReporter(); for(File sourceFile : getAllOutcomeFilesFrom(reportDirectory)) { partitions.add(new TestOutcomeLoaderCallable(testOutcomeReporter,sourceFile)); } final ExecutorService executorPool = Executors.newFixedThreadPool(20);//NumberOfThreads.forIOOperations()); final List<Future<Set<TestOutcome>>> loadedTestOutcomes = executorPool.invokeAll(partitions); List<TestOutcome> testOutcomes = new ArrayList<>(); for(Future<Set<TestOutcome>> loadedTestOutcome : loadedTestOutcomes) { testOutcomes.addAll(loadedTestOutcome.get()); } executorPool.shutdown(); return inOrderOfTestExecution(testOutcomes); } catch (Exception e) { throw new ReportLoadingFailedError("Can not load reports for some reason", e); } }