Class ExecutionTimesReport
- java.lang.Object
-
- com.carrotsearch.ant.tasks.junit4.listeners.ExecutionTimesReport
-
- All Implemented Interfaces:
AggregatedEventListener
public class ExecutionTimesReport extends java.lang.Object implements AggregatedEventListener
A report listener that emits per-suite execution times information useful for load balancing tests across JVMs.
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_HISTORY_LENGTHprivate java.util.Map<java.lang.String,java.util.List<java.lang.Long>>hintsExecution time hints.private java.io.FilehintsFileThe file where suite hints are stored/ updated.private inthistoryLengthprivate JUnit4outerOuter task.
-
Constructor Summary
Constructors Constructor Description ExecutionTimesReport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidmergeHints(java.io.InputStream is, java.util.Map<java.lang.String,java.util.List<java.lang.Long>> hints)Read hints from a file and merge with the given hints map.static java.util.Map<java.lang.String,java.util.List<java.lang.Long>>mergeHints(java.util.Collection<org.apache.tools.ant.types.ResourceCollection> resources, java.util.Collection<java.lang.String> suiteNames)Read hints from all resources in a collection, retainingsuiteNames.voidonEnd(AggregatedQuitEvent e)Write back to hints file.voidonSuiteResult(AggregatedSuiteResultEvent e)Remember execution time for all executed suites.static java.util.Map<java.lang.String,java.util.List<java.lang.Long>>readHints(java.io.File hints)Read hints from a file.voidsetFile(java.io.File hintsFile)Hints file (key-value pairs).voidsetHistoryLength(int length)How many execution times to store per-suite? The history must be larger than 0.voidsetOuter(JUnit4 outer)Link to the container.static voidwriteHints(java.io.File file, java.util.Map<java.lang.String,java.util.List<java.lang.Long>> hints)Writes back hints file.
-
-
-
Field Detail
-
DEFAULT_HISTORY_LENGTH
public static final int DEFAULT_HISTORY_LENGTH
- See Also:
setHistoryLength(int), Constant Field Values
-
hintsFile
private java.io.File hintsFile
The file where suite hints are stored/ updated.
-
hints
private java.util.Map<java.lang.String,java.util.List<java.lang.Long>> hints
Execution time hints. Key: suite name, value: execution times.
-
historyLength
private int historyLength
- See Also:
setHistoryLength(int)
-
outer
private JUnit4 outer
Outer task.
-
-
Method Detail
-
setFile
public void setFile(java.io.File hintsFile)
Hints file (key-value pairs).
-
setHistoryLength
public void setHistoryLength(int length)
How many execution times to store per-suite? The history must be larger than 0.
-
onSuiteResult
public void onSuiteResult(AggregatedSuiteResultEvent e)
Remember execution time for all executed suites.
-
onEnd
public void onEnd(AggregatedQuitEvent e)
Write back to hints file.
-
setOuter
public void setOuter(JUnit4 outer) throws org.apache.tools.ant.BuildException
Description copied from interface:AggregatedEventListenerLink to the container. Listener can throwBuildExceptionif parameter validation doesn't succeed, for example.- Specified by:
setOuterin interfaceAggregatedEventListener- Throws:
org.apache.tools.ant.BuildException
-
readHints
public static java.util.Map<java.lang.String,java.util.List<java.lang.Long>> readHints(java.io.File hints) throws java.io.IOExceptionRead hints from a file.- Throws:
java.io.IOException
-
mergeHints
public static void mergeHints(java.io.InputStream is, java.util.Map<java.lang.String,java.util.List<java.lang.Long>> hints) throws java.io.IOExceptionRead hints from a file and merge with the given hints map.- Throws:
java.io.IOException
-
writeHints
public static void writeHints(java.io.File file, java.util.Map<java.lang.String,java.util.List<java.lang.Long>> hints) throws java.io.IOExceptionWrites back hints file.- Throws:
java.io.IOException
-
mergeHints
public static java.util.Map<java.lang.String,java.util.List<java.lang.Long>> mergeHints(java.util.Collection<org.apache.tools.ant.types.ResourceCollection> resources, java.util.Collection<java.lang.String> suiteNames)Read hints from all resources in a collection, retainingsuiteNames. IfsuiteNamesis null, everything is retained.
-
-