Class 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.
    • 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, retaining suiteNames.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • 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.
      • outer

        private JUnit4 outer
        Outer task.
    • Constructor Detail

      • ExecutionTimesReport

        public ExecutionTimesReport()
    • 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.
      • 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 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, retaining suiteNames. If suiteNames is null, everything is retained.