Package com.sun.javatest.finder
Class TestFinderDecorator
- java.lang.Object
-
- com.sun.javatest.TestFinder
-
- com.sun.javatest.finder.TestFinderDecorator
-
public class TestFinderDecorator extends TestFinder
A test finder decorator that reads tests from a delegate, and returns the results in the reverse/random order. This is primarily for debugging and testing purposes.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.javatest.TestFinder
TestFinder.ErrorHandler, TestFinder.Fault
-
-
Field Summary
-
Fields inherited from class com.sun.javatest.TestFinder
debug, env
-
-
Constructor Summary
Constructors Constructor Description TestFinderDecorator(TestFinder testFinder)
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Comparator<java.lang.String>
getComparator()
Get the current comparator being used.TestFinder
getCurrentTestFinder()
java.io.File[]
getFiles()
Get the files that were found by the most recent call of read.java.io.File
getRoot()
Get the root file of the test suite, as passed in to theinit
method.java.io.File
getRootDir()
Get the root directory of the test suite; this is either the root passed in to the init method or if that is a file, it is the directory containing the file.TestDescription[]
getTests()
Get the test descriptions that were found by the most recent call of read.boolean
isFolder(java.io.File path)
Determine whether a location corresponds to a directory (folder) or an actual file.long
lastModified(java.io.File f)
Determine when the last time this path was modified.void
read(java.io.File file)
Read a file, looking for test descriptions and other files that might need to be read.protected void
scan(java.io.File file)
Scan a file, looking for test descriptions and other files that might need to be scanned.void
setComparator(java.util.Comparator<java.lang.String> c)
Incoming files and test descriptions are sorted by their name during processing, this method allows adjustment of the comparison method to be used during this sorting.java.util.Optional<java.lang.Integer>
totalNumberOfTestsInTheSuite()
Returns the total number of tests in the inspected suite if it is known.-
Methods inherited from class com.sun.javatest.TestFinder
clearErrors, decodeAllArgs, decodeArg, error, error, error, foundFile, foundTestDescription, foundTestDescription, getDefaultComparator, getErrorCount, getErrorHandler, getErrors, init, init, localizedError, normalize, processEntry, setErrorHandler, setRoot
-
-
-
-
Constructor Detail
-
TestFinderDecorator
public TestFinderDecorator(TestFinder testFinder)
Default constructor
-
-
Method Detail
-
getRoot
public java.io.File getRoot()
Description copied from class:TestFinder
Get the root file of the test suite, as passed in to theinit
method.- Overrides:
getRoot
in classTestFinder
- Returns:
- the root file of the test suite
- See Also:
TestFinder.setRoot(java.io.File)
-
getRootDir
public java.io.File getRootDir()
Description copied from class:TestFinder
Get the root directory of the test suite; this is either the root passed in to the init method or if that is a file, it is the directory containing the file.- Overrides:
getRootDir
in classTestFinder
- Returns:
- the root directory of the test suite
-
read
public void read(java.io.File file)
Description copied from class:TestFinder
Read a file, looking for test descriptions and other files that might need to be read. If the file is relative, it will be evaluated relative to getRootDir. Depending on the test finder, the file may be either a plain file or a directory.- Overrides:
read
in classTestFinder
- Parameters:
file
- The file to be read.
-
getTests
public TestDescription[] getTests()
Description copied from class:TestFinder
Get the test descriptions that were found by the most recent call of read.- Overrides:
getTests
in classTestFinder
- Returns:
- the test descriptions that were found by the most recent call of read.
- See Also:
TestFinder.read(java.io.File)
,TestFinder.foundTestDescription(java.util.Map<java.lang.String, java.lang.String>, java.io.File, int)
-
getFiles
public java.io.File[] getFiles()
Description copied from class:TestFinder
Get the files that were found by the most recent call of read.- Overrides:
getFiles
in classTestFinder
- Returns:
- the files that were found by the most recent call of read.
- See Also:
TestFinder.read(java.io.File)
,TestFinder.foundFile(java.io.File)
-
getComparator
public java.util.Comparator<java.lang.String> getComparator()
Description copied from class:TestFinder
Get the current comparator being used.- Overrides:
getComparator
in classTestFinder
- Returns:
- The current comparator, may be null.
- See Also:
TestFinder.setComparator(java.util.Comparator<java.lang.String>)
-
setComparator
public void setComparator(java.util.Comparator<java.lang.String> c)
Description copied from class:TestFinder
Incoming files and test descriptions are sorted by their name during processing, this method allows adjustment of the comparison method to be used during this sorting. Sorting can be disabled by calling this method with anull
parameter. By default, this class will do US Locale sorting.- Overrides:
setComparator
in classTestFinder
- Parameters:
c
- The comparison operator to be used. Null indicates no sorting (old behavior).- See Also:
TestFinder.getComparator()
,TestFinder.foundTestDescription(TestDescription)
,TestFinder.foundFile(File)
-
getCurrentTestFinder
public TestFinder getCurrentTestFinder()
-
lastModified
public long lastModified(java.io.File f)
Description copied from class:TestFinder
Determine when the last time this path was modified. This is used to decide whether to rescan that location or not. The default implementation defers the choice to the java.- Overrides:
lastModified
in classTestFinder
- Parameters:
f
- The location in question.
-
isFolder
public boolean isFolder(java.io.File path)
Description copied from class:TestFinder
Determine whether a location corresponds to a directory (folder) or an actual file. If the finder implementation chooses, the locations used in read() and scan() may be real or virtual. This method will be queried to determine if a location is a container or something that should be scanned for tests. If it is both...- Overrides:
isFolder
in classTestFinder
- Parameters:
path
- The location in question.
-
totalNumberOfTestsInTheSuite
public java.util.Optional<java.lang.Integer> totalNumberOfTestsInTheSuite()
Description copied from class:TestFinder
Returns the total number of tests in the inspected suite if it is known. (For example if preliminary quick scan of the suite was done). Default implementation returns empty Optional.- Overrides:
totalNumberOfTestsInTheSuite
in classTestFinder
- Returns:
- total number of tests or empty optional if there's no info available
-
scan
protected void scan(java.io.File file)
Description copied from class:TestFinder
Scan a file, looking for test descriptions and other files that might need to be scanned. The implementation depends on the type of test finder.- Specified by:
scan
in classTestFinder
- Parameters:
file
- The file to scan
-
-