nl.hsac.fitnesse.testrun.DurationBasedWikiPagePartitioner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hsac-fitnesse-plugin Show documentation
Show all versions of hsac-fitnesse-plugin Show documentation
Plugin to add features to a FitNesse installation
package nl.hsac.fitnesse.testrun;
import fitnesse.testrunner.run.PositionMapBasedWikiPagePartitioner;
import fitnesse.wiki.WikiPage;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Partitions pages based on provided DurationRecords.
*/
public class DurationBasedWikiPagePartitioner extends PositionMapBasedWikiPagePartitioner {
private List> durationRecords;
public DurationBasedWikiPagePartitioner(List> durationRecords) {
if (durationRecords != null) {
setDurationRecords(durationRecords);
}
}
@Override
public List> split(List pages, int partitionCount) {
Map positionMap = createPartitionMap(pages, partitionCount);
setPartitionMap(positionMap);
return super.split(pages, partitionCount);
}
protected Map createPartitionMap(List pages, int partitionCount) {
List names = getFullPaths(pages);
return new PositionFinder().getPositionMap(names, durationRecords, partitionCount);
}
protected List getFullPaths(List pages) {
return pages.stream().map(this::getFullPath).collect(Collectors.toList());
}
public void setDurationRecords(List> durationRecords) {
this.durationRecords = durationRecords;
}
public List> getDurationRecords() {
return durationRecords;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy