Class TestFinderQueue

java.lang.Object
com.sun.javatest.TestFinderQueue

public class TestFinderQueue extends Object
An iterator-based interface to the tests in a test suite, as read by a test finder.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    This interface provides a means for TestFinder to report on events that might be of interest as it executes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final byte
    A constant specifying the test finder queue should perform complete read ahead, reading all tests from the test finder before returning any from this object.
    static final byte
    A constant specifying the test finder queue should perform minimal read ahead.
    static final byte
    A constant specifying the test finder queue should perform medium (typical) read ahead.
    static final byte
    A constant specifying that the test finder queue should not perform any read ahead.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a test finder queue.
    Create a test finder queue, using a specified test finder.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Add an observer to monitor the progress of the TestFinder.
    void
    Flush all readahead.
    int
    Get the number of errors that have been found so far by the test finder while reading the tests.
    int
    Get the number of files that have been found and read so far.
    int
    Get the number of files that have been found so far.
    int
    Get the number of files that have been found but not yet read so far.
    Get the root directory for the test finder.
    Get the test finder being used by this object.
    int
    Get the number of tests that have been read from this object so far.
    int
    Get the number of tests that have been found so far.
    int
    Get the number of tests which have been found but not yet from this object so far.
    Get the next test description if one is available, or null when all have been returned.
    void
    Remove an observer form the set currently monitoring the progress of the TestFinder.
    void
    Deprecated.
    retained for historical purposes
    void
    setFilters(TestFilter... filters)
    Set an array of filters that will be used to filter the tests read by the test finder.
    void
    setReadAheadMode(byte mode)
    Set the amount of read-ahead done by the finder.
    void
    Set the test finder to be used by this object.
    void
    setTests(String... initTests)
    Set the initial set of files to be read by the test finder.
    void
    setZeroTestsOK(boolean zeroTestsOK)
    Set a flag indicating whether it is OK to find no tests in the specified set of files.

    Methods inherited from class java.lang.Object

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

    • NO_READ_AHEAD

      public static final byte NO_READ_AHEAD
      A constant specifying that the test finder queue should not perform any read ahead.
      See Also:
    • LOW_READ_AHEAD

      public static final byte LOW_READ_AHEAD
      A constant specifying the test finder queue should perform minimal read ahead.
      See Also:
    • MEDIUM_READ_AHEAD

      public static final byte MEDIUM_READ_AHEAD
      A constant specifying the test finder queue should perform medium (typical) read ahead.
      See Also:
    • FULL_READ_AHEAD

      public static final byte FULL_READ_AHEAD
      A constant specifying the test finder queue should perform complete read ahead, reading all tests from the test finder before returning any from this object.
      See Also:
  • Constructor Details

    • TestFinderQueue

      public TestFinderQueue()
      Create a test finder queue.
    • TestFinderQueue

      public TestFinderQueue(TestFinder finder)
      Create a test finder queue, using a specified test finder.
      Parameters:
      finder - the test finder to be used to read the tests
  • Method Details

    • getTestFinder

      public TestFinder getTestFinder()
      Get the test finder being used by this object.
      Returns:
      the test finder being used by this object
      See Also:
    • setTestFinder

      public void setTestFinder(TestFinder finder)
      Set the test finder to be used by this object. It may only be set once.
      Parameters:
      finder - the test finder to be used by this object
      Throws:
      NullPointerException - if the finder is null
      IllegalStateException - if the finder has already been set
      See Also:
    • setFilters

      public void setFilters(TestFilter... filters)
      Set an array of filters that will be used to filter the tests read by the test finder. Each test must be accepted by all the filters to be put in the queue.
      Parameters:
      filters - the filters to be used.
    • setTests

      public void setTests(String... initTests)
      Set the initial set of files to be read by the test finder. Additional files may be read as a result of reading these and subsequent files.
      Parameters:
      initTests - the initial set of files to be read by the test finder
    • setZeroTestsOK

      public void setZeroTestsOK(boolean zeroTestsOK)
      Set a flag indicating whether it is OK to find no tests in the specified set of files. If set to false, and if no tests have been found by the time the last file has been read, an error will be notified to any observers.
      Parameters:
      zeroTestsOK - set to true to suppress an error being generated if no tests are found by the time that all files have been read
    • repeat

      @Deprecated public void repeat(TestDescription... tds)
      Deprecated.
      retained for historical purposes
      Set the queue to "repeat" a set of test descriptions by putting them in the test found queue again.
      Parameters:
      tds - the test descriptions to be "found again".
    • next

      public TestDescription next()
      Get the next test description if one is available, or null when all have been returned.
      Returns:
      A test description or null.
    • getRoot

      public File getRoot()
      Get the root directory for the test finder.
      Returns:
      the root directory, as set in the test finder
    • getFilesFoundCount

      public int getFilesFoundCount()
      Get the number of files that have been found so far.
      Returns:
      the number of files that have been found so far
    • getFilesDoneCount

      public int getFilesDoneCount()
      Get the number of files that have been found and read so far.
      Returns:
      the number of files that have been found and read so far
    • getFilesRemainingCount

      public int getFilesRemainingCount()
      Get the number of files that have been found but not yet read so far.
      Returns:
      the number of files that have been found but not yet read so far
    • getTestsFoundCount

      public int getTestsFoundCount()
      Get the number of tests that have been found so far.
      Returns:
      the number of tests that have been found so far
    • getTestsDoneCount

      public int getTestsDoneCount()
      Get the number of tests that have been read from this object so far.
      Returns:
      the number of tests that have been read from this object so far
    • getTestsRemainingCount

      public int getTestsRemainingCount()
      Get the number of tests which have been found but not yet from this object so far.
      Returns:
      the number of tests which have been found but not yet read from this object so far
    • getErrorCount

      public int getErrorCount()
      Get the number of errors that have been found so far by the test finder while reading the tests.
      Returns:
      the number of errors that have been found so far by the test finder while reading the tests.
    • addObserver

      public void addObserver(TestFinderQueue.Observer o)
      Add an observer to monitor the progress of the TestFinder.
      Parameters:
      o - the observer
    • removeObserver

      public void removeObserver(TestFinderQueue.Observer o)
      Remove an observer form the set currently monitoring the progress of the TestFinder.
      Parameters:
      o - the observer
    • setReadAheadMode

      public void setReadAheadMode(byte mode)
      Set the amount of read-ahead done by the finder.
      Parameters:
      mode - acceptable values are as follows:
      0: no read ahead
      Files are not read ahead more than necessary
      1: low read ahead
      A low priority thread is created to read the test files when the system is otherwise idle
      2: medium read ahead
      A low priority thread is created to read the test files when the system is otherwise idle. In addition, if the number of tests done approaches the number of tests read, then more tests will be read.
      3: full and immediate read ahead
      All the tests will be read now
    • flush

      public void flush()
      Flush all readahead.