Class ChameleonTestFinder

java.lang.Object
com.sun.javatest.TestFinder
com.sun.javatest.finder.ChameleonTestFinder

public class ChameleonTestFinder extends TestFinder
A TestFinder that delegates to different test finders in different areas of the test suite, as described by a special "map" file.
  • Constructor Details

    • ChameleonTestFinder

      public ChameleonTestFinder()
      Create an uninitialized ChameleonTestFinder.
  • Method Details

    • exclude

      public void exclude(String name)
      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

      public void exclude(String... names)
      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

      public void init(String[] args, File testSuiteRoot, TestEnvironment env) throws TestFinder.Fault
      Generic initialization routine. You can also initialize the test finder directly, with exclude(java.lang.String), readEntries(java.io.File), etc.
      Overrides:
      init in class TestFinder
      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

      public void readEntries(File file) throws TestFinder.Fault
      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

      protected int decodeArg(String[] args, int i) throws TestFinder.Fault
      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 class TestFinder
      Parameters:
      args - The array of arguments
      i - 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

      protected void scan(File file)
      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 class TestFinder
      Parameters:
      file - The file to scan
    • getFiles

      public File[] getFiles()
      Description copied from class: TestFinder
      Get the files that were found by the most recent call of read.
      Overrides:
      getFiles in class TestFinder
      Returns:
      the files that were found by the most recent call of read.
      See Also:
    • 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 class TestFinder
      Returns:
      the test descriptions that were found by the most recent call of read.
      See Also: