com.sun.javatest
Class TestFinderQueue

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

public class TestFinderQueue
extends java.lang.Object

An iterator-based interface to the tests in a test suite, as read by a test finder.


Nested Class Summary
static interface TestFinderQueue.Observer
          This interface provides a means for TestFinder to report on events that might be of interest as it executes.
 
Field Summary
static 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.
static byte LOW_READ_AHEAD
          A constant specifying the test finder queue should perform minimal read ahead.
static byte MEDIUM_READ_AHEAD
          A constant specifying the test finder queue should perform medium (typical) read ahead.
static byte NO_READ_AHEAD
          A constant specifying that the test finder queue should not perform any read ahead.
 
Constructor Summary
TestFinderQueue()
          Create a test finder queue.
TestFinderQueue(TestFinder finder)
          Create a test finder queue, using a specified test finder.
 
Method Summary
 void addObserver(TestFinderQueue.Observer o)
          Add an observer to monitor the progress of the TestFinder.
 void flush()
          Flush all readahead.
 int getErrorCount()
          Get the number of errors that have been found so far by the test finder while reading the tests.
 int getFilesDoneCount()
          Get the number of files that have been found and read so far.
 int getFilesFoundCount()
          Get the number of files that have been found so far.
 int getFilesRemainingCount()
          Get the number of files that have been found but not yet read so far.
 java.io.File getRoot()
          Get the root directory for the test finder.
 TestFinder getTestFinder()
          Get the test finder being used by this object.
 int getTestsDoneCount()
          Get the number of tests that have been read from this object so far.
 int getTestsFoundCount()
          Get the number of tests that have been found so far.
 int getTestsRemainingCount()
          Get the number of tests which have been found but not yet from this object so far.
 TestDescription next()
          Get the next test description if one is available, or null when all have been returned.
 void removeObserver(TestFinderQueue.Observer o)
          Remove an observer form the set currently monitoring the progress of the TestFinder.
 void repeat(TestDescription[] tds)
          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 setTestFinder(TestFinder finder)
          Set the test finder to be used by this object.
 void setTests(java.lang.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 Detail

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:
Constant Field Values

LOW_READ_AHEAD

public static final byte LOW_READ_AHEAD
A constant specifying the test finder queue should perform minimal read ahead.

See Also:
Constant Field Values

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:
Constant Field Values

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:
Constant Field Values
Constructor Detail

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 Detail

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(com.sun.javatest.TestFinder)

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:
java.lang.NullPointerException - if the finder is null
java.lang.IllegalStateException - if the finder has already been set
See Also:
getTestFinder()

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(java.lang.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

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 java.io.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.



Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.