Package com.sun.javatest.finder
Class ChameleonTestFinder
java.lang.Object
com.sun.javatest.TestFinder
com.sun.javatest.finder.ChameleonTestFinder
A TestFinder that delegates to different test finders in different
areas of the test suite, as described by a special "map" file.
-
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Decode the arg at a specified position in the arg array.void
Exclude all files with a particular name from being scanned.void
Exclude all files with particular names from being scanned.File[]
getFiles()
Get the files that were found by the most recent call of read.boolean
Check whether or not to ignore case when matching files against entries.getTests()
Get the test descriptions that were found by the most recent call of read.void
init
(String[] args, File testSuiteRoot, TestEnvironment env) Generic initialization routine.void
readEntries
(File file) Read the entries in a file which describe which test finder to use in which part of the test suite.protected void
Scan a file, looking for test descriptions and other files that might need to be scanned.void
setIgnoreCase
(boolean b) Set whether or not to ignore case when matching files against entries.Methods inherited from class com.sun.javatest.TestFinder
clearErrors, decodeAllArgs, error, error, error, foundFile, foundTestDescription, foundTestDescription, getComparator, getDefaultComparator, getErrorCount, getErrorHandler, getErrors, getRoot, getRootDir, init, isFolder, lastModified, localizedError, normalize, processEntry, read, setComparator, setErrorHandler, setRoot, totalNumberOfTestsInTheSuite
-
Constructor Details
-
ChameleonTestFinder
public ChameleonTestFinder()Create an uninitialized ChameleonTestFinder.
-
-
Method Details
-
exclude
Exclude all files with a particular name from being scanned. This will typically be for directories like SCCS, Codemgr_wsdata, etc- Parameters:
name
- The name of files to be excluded
-
exclude
Exclude all files with particular names from being scanned. This will typically be for directories like SCCS, Codemgr_wsdata, etc- Parameters:
names
- The names of files to be excluded
-
getIgnoreCase
public boolean getIgnoreCase()Check whether or not to ignore case when matching files against entries.By default, case will be ignored on Windows platforms. (
System.getProperty("os.name").startsWith("Windows")
) This can be overridden by setting the following system property:-Djavatest.chameleon.ignoreCase=true|false
This in turn can be overridden by using -ignoreCase or -dontIgnoreCase in the args to
init
.- Returns:
- whether or not to ignore case when matching files against entries.
- See Also:
-
setIgnoreCase
public void setIgnoreCase(boolean b) Set whether or not to ignore case when matching files against entries.- Parameters:
b
- whether or not to ignore case when matching files against entries.- See Also:
-
init
Generic initialization routine. You can also initialize the test finder directly, withexclude(java.lang.String)
,readEntries(java.io.File)
, etc.- Overrides:
init
in classTestFinder
- Parameters:
args
- An array of strings giving initialization data. The primary option is "-f file" to specify the name of the file describing which test finder to use in which section of the test suite.testSuiteRoot
- The root file of the test suite.env
- This argument is not required by this test finder.- Throws:
TestFinder.Fault
- if an error is found during initialization.
-
readEntries
Read the entries in a file which describe which test finder to use in which part of the test suite. The file is read line by line. If a line is empty or begins with a '#' character, the line is ignored. Otherwise the line is broken up as follows:
directory-or-file finder-class-name finder-args ...
Then, when a file is to be read by the test finder, the entries above are checked in the order they were read for an entry whose first word matches the beginning of the name of the file to be read. If and when a match is found, the test finder delegates the request to the test finder specified in the rest of the entry that provided the match.- Parameters:
file
- The file containing the entries to be read.- Throws:
TestFinder.Fault
- if a problem occurs while reading the file.
-
decodeArg
Description copied from class:TestFinder
Decode the arg at a specified position in the arg array. If overridden by a subtype, the subtype should try and decode any args it recognizes, and then call super.decodeArg to give the superclass(es) a chance to recognize any arguments.- Overrides:
decodeArg
in classTestFinder
- Parameters:
args
- The array of argumentsi
- The next argument to be decoded- Returns:
- The number of elements consumed in the array; for example, for a simple option like "-v" the result should be 1; for an option with an argument like "-f file" the result should be 2, etc.
- Throws:
TestFinder.Fault
- If there is a problem with the value of the current arg, such as a bad value to an option, the Fault exception can be thrown. The exception should NOT be thrown if the current arg is unrecognized: in that case, an implementation should delegate the call to the supertype.
-
scan
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
-
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:
-
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:
-