diff --git a/pitest-aggregator/src/main/java/org/pitest/aggregate/ReportAggregator.java b/pitest-aggregator/src/main/java/org/pitest/aggregate/ReportAggregator.java index 9a0239fa9..3af9f28c4 100644 --- a/pitest-aggregator/src/main/java/org/pitest/aggregate/ReportAggregator.java +++ b/pitest-aggregator/src/main/java/org/pitest/aggregate/ReportAggregator.java @@ -6,7 +6,6 @@ import org.pitest.coverage.CoverageData; import org.pitest.coverage.ReportCoverage; import org.pitest.coverage.analysis.LineMapper; -import org.pitest.functional.FCollection; import org.pitest.mutationtest.ClassMutationResults; import org.pitest.mutationtest.MutationMetaData; import org.pitest.mutationtest.MutationResult; @@ -30,10 +29,12 @@ import java.util.logging.Logger; import java.util.stream.Collectors; +import static java.util.Arrays.asList; + public final class ReportAggregator { private final ResultOutputStrategy resultOutputStrategy; private final DataLoader blockCoverageLoader; - private final DataLoader mutationLoader; + private final Set mutationFiles; private final Collection sourceCodeDirectories; private final CodeSourceAggregator codeSourceAggregator; @@ -44,7 +45,7 @@ private ReportAggregator(final ResultOutputStrategy resultOutputStrategy, final final Set sourceCodeDirs, final Set compiledCodeDirs, Charset inputCharset, Charset outputCharset) { this.resultOutputStrategy = resultOutputStrategy; this.blockCoverageLoader = new BlockCoverageDataLoader(lineCoverageFiles); - this.mutationLoader = new MutationResultDataLoader(mutationFiles); + this.mutationFiles = mutationFiles; this.sourceCodeDirectories = Collections.unmodifiableCollection(new HashSet<>(sourceCodeDirs)); this.codeSourceAggregator = new CodeSourceAggregator(new HashSet<>(compiledCodeDirs)); this.inputCharset = inputCharset; @@ -52,17 +53,20 @@ private ReportAggregator(final ResultOutputStrategy resultOutputStrategy, final } public AggregationResult aggregateReport() throws ReportAggregationException { - final MutationMetaData mutationMetaData = new MutationMetaData(new ArrayList<>(this.mutationLoader.loadData())); - - final MutationResultListener mutationResultListener = createResultListener(mutationMetaData); + final MutationResultListener mutationResultListener = createResultListener(Collections.emptySet()); final ReportAggregatorResultListener reportAggregatorResultListener = new ReportAggregatorResultListener(); reportAggregatorResultListener.runStart(); mutationResultListener.runStart(); - for (final ClassMutationResults mutationResults : mutationMetaData.toClassResults()) { - reportAggregatorResultListener.handleMutationResult(mutationResults); - mutationResultListener.handleMutationResult(mutationResults); + for (File file : mutationFiles) { + MutationResultDataLoader loader = new MutationResultDataLoader(asList(file)); + MutationMetaData mutationMetaData = new MutationMetaData(new ArrayList<>(loader.loadData())); + for (ClassMutationResults classResult : mutationMetaData.toClassResults()) { + reportAggregatorResultListener.handleMutationResult(classResult); + mutationResultListener.handleMutationResult(classResult); + } + } reportAggregatorResultListener.runEnd(); mutationResultListener.runEnd(); @@ -70,12 +74,12 @@ public AggregationResult aggregateReport() throws ReportAggregationException { return reportAggregatorResultListener.result(); } - private MutationResultListener createResultListener(final MutationMetaData mutationMetaData) throws ReportAggregationException { + private MutationResultListener createResultListener(Collection mutatorNames) throws ReportAggregationException { final SourceLocator sourceLocator = new SmartSourceLocator(asPaths(this.sourceCodeDirectories), inputCharset); final CodeSource codeSource = this.codeSourceAggregator.createCodeSource(); final ReportCoverage coverageDatabase = calculateCoverage(codeSource); - final Collection mutatorNames = new HashSet<>(FCollection.flatMap(mutationMetaData.getMutations(), resultToMutatorName())); + //final Collection mutatorNames = new HashSet<>(FCollection.flatMap(mutationMetaData.getMutations(), resultToMutatorName())); return new MutationHtmlReportListener(outputCharset, coverageDatabase, this.resultOutputStrategy, mutatorNames, sourceLocator); }