com.carrotsearch.ant.tasks.junit4.listeners
Class ExecutionTimesReport

java.lang.Object
  extended by com.carrotsearch.ant.tasks.junit4.listeners.ExecutionTimesReport
All Implemented Interfaces:
AggregatedEventListener

public class ExecutionTimesReport
extends Object
implements AggregatedEventListener

A report listener that emits per-suite execution times information useful for load balancing tests across JVMs.


Field Summary
static int DEFAULT_HISTORY_LENGTH
           
 
Constructor Summary
ExecutionTimesReport()
           
 
Method Summary
static Map<String,List<Long>> mergeHints(Collection<org.apache.tools.ant.types.ResourceCollection> resources, Collection<String> suiteNames)
          Read hints from all resources in a collection, retaining suiteNames.
static void mergeHints(InputStream is, Map<String,List<Long>> hints)
          Read hints from a file and merge with the given hints map.
 void onEnd(AggregatedQuitEvent e)
          Write back to hints file.
 void onSuiteResult(AggregatedSuiteResultEvent e)
          Remember execution time for all executed suites.
static Map<String,List<Long>> readHints(File hints)
          Read hints from a file.
 void setFile(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(File file, Map<String,List<Long>> hints)
          Writes back hints file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_HISTORY_LENGTH

public static final int DEFAULT_HISTORY_LENGTH
See Also:
setHistoryLength(int), Constant Field Values
Constructor Detail

ExecutionTimesReport

public ExecutionTimesReport()
Method Detail

setFile

public void setFile(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 throw BuildException if parameter validation doesn't succeed, for example.

Specified by:
setOuter in interface AggregatedEventListener
Throws:
org.apache.tools.ant.BuildException

readHints

public static Map<String,List<Long>> readHints(File hints)
                                        throws IOException
Read hints from a file.

Throws:
IOException

mergeHints

public static void mergeHints(InputStream is,
                              Map<String,List<Long>> hints)
                       throws IOException
Read hints from a file and merge with the given hints map.

Throws:
IOException

writeHints

public static void writeHints(File file,
                              Map<String,List<Long>> hints)
                       throws IOException
Writes back hints file.

Throws:
IOException

mergeHints

public static Map<String,List<Long>> mergeHints(Collection<org.apache.tools.ant.types.ResourceCollection> resources,
                                                Collection<String> suiteNames)
Read hints from all resources in a collection, retaining suiteNames. If suiteNames is null, everything is retained.



Copyright © 2011-2012 Carrot Search s.c.. All Rights Reserved.