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 int
DEFAULT_HISTORY_LENGTH
private java.util.Map<java.lang.String,java.util.List<java.lang.Long>>
hints
Execution time hints.private java.io.File
hintsFile
The file where suite hints are stored/ updated.private int
historyLength
private JUnit4
outer
Outer task.
-
Constructor Summary
Constructors Constructor Description ExecutionTimesReport()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
mergeHints(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
.void
onEnd(AggregatedQuitEvent e)
Write back to hints file.void
onSuiteResult(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.void
setFile(java.io.File hintsFile)
Hints file (key-value pairs).void
setHistoryLength(int length)
How many execution times to store per-suite? The history must be larger than 0.void
setOuter(JUnit4 outer)
Link to the container.static void
writeHints(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:AggregatedEventListener
Link to the container. Listener can throwBuildException
if parameter validation doesn't succeed, for example.- Specified by:
setOuter
in 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.IOException
Read 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.IOException
Read 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.IOException
Writes 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
. IfsuiteNames
is null, everything is retained.
-
-