Package com.sun.javatest
Class TestFinderQueue
java.lang.Object
com.sun.javatest.TestFinderQueue
An iterator-based interface to the tests in a test suite, as read by a test finder.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This interface provides a means for TestFinder to report on events that might be of interest as it executes. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic 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
ConstructorsConstructorDescriptionCreate a test finder queue.TestFinderQueue
(TestFinder finder) Create a test finder queue, using a specified test finder. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an observer to monitor the progress of the TestFinder.void
flush()
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.getRoot()
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.next()
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
repeat
(TestDescription... tds) Deprecated.retained for historical purposesvoid
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
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.
-
Field Details
-
NO_READ_AHEAD
public static final byte NO_READ_AHEADA constant specifying that the test finder queue should not perform any read ahead.- See Also:
-
LOW_READ_AHEAD
public static final byte LOW_READ_AHEADA constant specifying the test finder queue should perform minimal read ahead.- See Also:
-
MEDIUM_READ_AHEAD
public static final byte MEDIUM_READ_AHEADA constant specifying the test finder queue should perform medium (typical) read ahead.- See Also:
-
FULL_READ_AHEAD
public static final byte FULL_READ_AHEADA 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
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
Get the test finder being used by this object.- Returns:
- the test finder being used by this object
- See Also:
-
setTestFinder
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 nullIllegalStateException
- if the finder has already been set- See Also:
-
setFilters
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
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.retained for historical purposesSet 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
Get the next test description if one is available, or null when all have been returned.- Returns:
- A test description or null.
-
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
Add an observer to monitor the progress of the TestFinder.- Parameters:
o
- the observer
-
removeObserver
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.
-