com.sun.javatest.finder
Class ExpandTestFinder

java.lang.Object
  extended by com.sun.javatest.TestFinder
      extended by com.sun.javatest.finder.TagTestFinder
          extended by com.sun.javatest.finder.ExpandTestFinder

public class ExpandTestFinder
extends TagTestFinder

This class allows a new tag "@expand" which allows a single test description to be expanded into multiple test descriptions using variable substitution. Variables are declared in the .jte file. The list of valid entries is identical to those found for JCK. There is no list of pre-defined keywords. If keyword checking is needed, then the list of allowed keywords must be provided via the -allowKeyword option.

See Also:
TagTestFinder

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
ExpandTestFinder()
           
 
Method Summary
protected  int decodeArg(java.lang.String[] args, int i)
          Decode the arg at a specified position in the arg array.
protected  void foundTestDescription(java.util.Map entries, java.io.File file, int line)
          Report that data for a test description has been found.
 void init(java.lang.String[] args, java.io.File testSuiteRoot, TestEnvironment env)
          Initialize the data required by the finder.
protected  void processEntry(java.util.Map entries, java.lang.String name, java.lang.String value)
          Handle a test description entry read from a file.
 
Methods inherited from class com.sun.javatest.finder.TagTestFinder
addExtension, exclude, exclude, getClassForExtension, getCurrentFile, getInitialTag, parseComment, scan, scanFile, setInitialTag
 
Methods inherited from class com.sun.javatest.TestFinder
clearErrors, decodeAllArgs, error, error, error, foundFile, foundTestDescription, getComparator, getDefaultComparator, getErrorCount, getErrorHandler, getErrors, getFiles, getRoot, getRootDir, getTests, init, isFolder, lastModified, localizedError, normalize, read, setComparator, setErrorHandler, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExpandTestFinder

public ExpandTestFinder()
Method Detail

decodeArg

protected int decodeArg(java.lang.String[] args,
                        int i)
                 throws TestFinder.Fault
Description copied from class: TagTestFinder
Decode the arg at a specified position in the arg array. If overridden by a subtype, the subtype should try and decode any arg it recognizes, and then call super.decodeArg to give the superclass(es) a chance to recognize any arguments.

Overrides:
decodeArg in class TagTestFinder
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.

init

public void init(java.lang.String[] args,
                 java.io.File testSuiteRoot,
                 TestEnvironment env)
          throws TestFinder.Fault
Description copied from class: TestFinder
Initialize the data required by the finder. Clients creating instances of test finders should call this before allowing use of the finder. Not doing so may result in unexpected results.

Overrides:
init in class TestFinder
Parameters:
args - An array of strings specified as arguments in the environment. Null indicates no args.
testSuiteRoot - The root file that will be passed to test descriptions read by the finder.
env - The environment being used to run the test. May be null.
Throws:
TestFinder.Fault - if there is a problem interpreting any of args.

foundTestDescription

protected void foundTestDescription(java.util.Map entries,
                                    java.io.File file,
                                    int line)
Description copied from class: TestFinder
Report that data for a test description has been found.

Overrides:
foundTestDescription in class TestFinder
Parameters:
entries - The data for the test description
file - The file being read
line - The line number within the file (used for error messages)

processEntry

protected void processEntry(java.util.Map entries,
                            java.lang.String name,
                            java.lang.String value)
Description copied from class: TestFinder
Handle a test description entry read from a file. By default, the name-value pair is inserted into the entries dictionary; however, the method can be overridden by a subtype to adjust the name or value before putting it into the dictionary, or even to ignore/fault the pair.

Overrides:
processEntry in class TestFinder
Parameters:
entries - The dictionary of the entries being read
name - The name of the entry that has been read
value - The value of the entry that has been read


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.