Package com.sun.javatest
Class TestFinderQueue
- java.lang.Object
-
- com.sun.javatest.TestFinderQueue
-
public class TestFinderQueue extends java.lang.ObjectAn 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 interfaceTestFinderQueue.ObserverThis 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 byteFULL_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.static byteLOW_READ_AHEADA constant specifying the test finder queue should perform minimal read ahead.static byteMEDIUM_READ_AHEADA constant specifying the test finder queue should perform medium (typical) read ahead.static byteNO_READ_AHEADA constant specifying that the test finder queue should not perform any read ahead.
-
Constructor Summary
Constructors Constructor Description TestFinderQueue()Create a test finder queue.TestFinderQueue(TestFinder finder)Create a test finder queue, using a specified test finder.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddObserver(TestFinderQueue.Observer o)Add an observer to monitor the progress of the TestFinder.voidflush()Flush all readahead.intgetErrorCount()Get the number of errors that have been found so far by the test finder while reading the tests.intgetFilesDoneCount()Get the number of files that have been found and read so far.intgetFilesFoundCount()Get the number of files that have been found so far.intgetFilesRemainingCount()Get the number of files that have been found but not yet read so far.java.io.FilegetRoot()Get the root directory for the test finder.TestFindergetTestFinder()Get the test finder being used by this object.intgetTestsDoneCount()Get the number of tests that have been read from this object so far.intgetTestsFoundCount()Get the number of tests that have been found so far.intgetTestsRemainingCount()Get the number of tests which have been found but not yet from this object so far.TestDescriptionnext()Get the next test description if one is available, or null when all have been returned.voidremoveObserver(TestFinderQueue.Observer o)Remove an observer form the set currently monitoring the progress of the TestFinder.voidrepeat(TestDescription... tds)Deprecated.retained for historical purposesvoidsetFilters(TestFilter... filters)Set an array of filters that will be used to filter the tests read by the test finder.voidsetReadAheadMode(byte mode)Set the amount of read-ahead done by the finder.voidsetTestFinder(TestFinder finder)Set the test finder to be used by this object.voidsetTests(java.lang.String... initTests)Set the initial set of files to be read by the test finder.voidsetZeroTestsOK(boolean zeroTestsOK)Set a flag indicating whether it is OK to find no tests in the specified set of files.
-
-
-
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 nulljava.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
@Deprecated public void repeat(TestDescription... tds)
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
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.
-
-