com.sun.javatest.finder
Class HTMLTestFinder

java.lang.Object
  extended by com.sun.javatest.TestFinder
      extended by com.sun.javatest.finder.HTMLTestFinder

public class HTMLTestFinder
extends TestFinder

This class searches out test descriptions as represented by certain HTML elements in a hierarchy of HTML files.

See Also:
TestFinder

Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.javatest.TestFinder
TestFinder.ErrorHandler, TestFinder.Fault
 
Field Summary
static int DIR_WALK
          A value for setMode(int) to specify that the child files within the test tree should be determined by sub-directories and HTML files within directories.
static int WEB_WALK
          A value for setMode(int) to specify that the child files within the test tree should be determined from the HTML <a href=...> tags.
 
Fields inherited from class com.sun.javatest.TestFinder
debug, env
 
Constructor Summary
HTMLTestFinder()
          Create an HTMLTestFinder.
 
Method Summary
protected  int decodeArg(java.lang.String[] args, int i)
          Decode the arg at a specified position in the arg array.
protected  java.io.File getCurrentFile()
          Get the name of the file currently being read.
 int getMode()
          Get the current mode for how this test finder determines the child files to be scanned.
 java.io.File getRoot()
          Get the root file of the test suite, as passed in to the init method.
protected  void localizedError(java.lang.String msg)
          Report a message to the error handler, without additional processing.
protected  void scan(java.io.File file)
          Scan a file, looking for test descriptions and other files that might need to be scanned.
 void setMode(int mode)
          Specify the mode for how this test finder determines the child files to be scanned.
 
Methods inherited from class com.sun.javatest.TestFinder
clearErrors, decodeAllArgs, error, error, error, foundFile, foundTestDescription, foundTestDescription, getComparator, getDefaultComparator, getErrorCount, getErrorHandler, getErrors, getFiles, getRootDir, getTests, init, init, isFolder, lastModified, normalize, processEntry, read, setComparator, setErrorHandler, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WEB_WALK

public static final int WEB_WALK
A value for setMode(int) to specify that the child files within the test tree should be determined from the HTML <a href=...> tags.

See Also:
Constant Field Values

DIR_WALK

public static final int DIR_WALK
A value for setMode(int) to specify that the child files within the test tree should be determined by sub-directories and HTML files within directories.

See Also:
Constant Field Values
Constructor Detail

HTMLTestFinder

public HTMLTestFinder()
Create an HTMLTestFinder.

Method Detail

decodeArg

protected int decodeArg(java.lang.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.

getRoot

public java.io.File getRoot()
Description copied from class: TestFinder
Get the root file of the test suite, as passed in to the init method.

Overrides:
getRoot in class TestFinder
Returns:
the root file of the test suite
See Also:
TestFinder.setRoot(java.io.File)

localizedError

protected void localizedError(java.lang.String msg)
Description copied from class: TestFinder
Report a message to the error handler, without additional processing.

Overrides:
localizedError in class TestFinder
Parameters:
msg - The message to be reported
See Also:
TestFinder.error(com.sun.javatest.util.I18NResourceBundle, java.lang.String)

setMode

public void setMode(int mode)
Specify the mode for how this test finder determines the child files to be scanned. The default is DIR_WALK.

Parameters:
mode - One of WEB_WALK or DIR_WALK
See Also:
getMode()

getMode

public int getMode()
Get the current mode for how this test finder determines the child files to be scanned.

Returns:
One of WEB_WALK or DIR_WALK
See Also:
setMode(int)

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 class TestFinder
Parameters:
file - The file to scan

getCurrentFile

protected java.io.File getCurrentFile()
Get the name of the file currently being read.

Returns:
the name of the file currently being read.


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