com.sun.javatest.finder
Class BinaryTestFinder

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

public class BinaryTestFinder
extends TestFinder

A TestFinder to read a compressed binary file containing the previously "compiled" results of some other test finder.


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
BinaryTestFinder()
          Create an uninitialized binary test finder.
BinaryTestFinder(java.io.File jtdFile)
          Deprecated. Use BinaryTestFinder(File testSuiteRoot, File jtdFile) instead
BinaryTestFinder(java.io.File testSuiteRoot, java.io.File jtdFile)
          Deprecated. Use BinaryTestFinder(File, File, TestEnvironment) with null as the last argument.
 
Method Summary
protected  int decodeArg(java.lang.String[] args, int i)
          Decodes any args needed by BinaryTestFinder.
 void init(java.io.File testSuiteRoot, java.io.File jtdFile)
          Deprecated. Use init(File, File TestEnvironment) with null args as needed.
 void init(java.lang.String[] args, java.io.File testSuiteRoot, TestEnvironment env)
          Initialize a new BinaryTestFinder.
 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.
protected  void scan(java.io.File file)
          Given a File, scan to look for other files or tests.
 
Methods inherited from class com.sun.javatest.TestFinder
clearErrors, decodeAllArgs, error, error, error, foundFile, foundTestDescription, foundTestDescription, getComparator, getDefaultComparator, getErrorCount, getErrorHandler, getErrors, getFiles, getRoot, getRootDir, getTests, init, localizedError, normalize, processEntry, read, setComparator, setErrorHandler, setRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryTestFinder

public BinaryTestFinder()
Create an uninitialized binary test finder. Use one of the init methods to initialize it.


BinaryTestFinder

public BinaryTestFinder(java.io.File jtdFile)
                 throws TestFinder.Fault
Deprecated. Use BinaryTestFinder(File testSuiteRoot, File jtdFile) instead

Create and initialize a binary test finder.

Parameters:
jtdFile - The binary file containing the precompiled test descriptions. The file should be an absolute file.
Throws:
TestFinder.Fault - if there is a problem while reading the data file.
See Also:
BinaryTestFinder(File, File)

BinaryTestFinder

public BinaryTestFinder(java.io.File testSuiteRoot,
                        java.io.File jtdFile)
                 throws TestFinder.Fault
Deprecated. Use BinaryTestFinder(File, File, TestEnvironment) with null as the last argument.

Create and initialize a binary test finder.

Parameters:
jtdFile - The binary file containing the precompiled test descriptions. If the file is relative, it will be evaluated relative to testSuiteRoot.
testSuiteRoot - The root file of the Test Suite. This is usually a file called testsuite.html
Throws:
TestFinder.Fault - if there is a problem while reading the data file.
Method Detail

init

public void init(java.lang.String[] args,
                 java.io.File testSuiteRoot,
                 TestEnvironment env)
          throws TestFinder.Fault
Initialize a new BinaryTestFinder. This method opens the binary file to read from, calls methods to read the data, and initializes other variables.

Overrides:
init in class TestFinder
Parameters:
args - Any arguments needed by the TestFinder. You must pass "-binary" followed by the path to the binary file. If the file is relative, it will be evaluated relative to testSuiteRoot.
testSuiteRoot - The root file of the Test Suite. This is usually a file called testsuite.html
env - Environment file for the TestFinder. Not used by BinaryTestFinder.
Throws:
TestFinder.Fault - if there is a problem while reading the data file.

init

public void init(java.io.File testSuiteRoot,
                 java.io.File jtdFile)
          throws TestFinder.Fault
Deprecated. Use init(File, File TestEnvironment) with null args as needed.

Initialize a new BinaryTestFinder. This method opens the binary file to read from, calls methods to read the data, and initializes other variables.

Parameters:
testSuiteRoot - The root file of the Test Suite. This is usually a file called testsuite.html
jtdFile - The file containing the binary data for the test descriptions. If the file is relative, it will be evaluated relative to testSuiteRoot.
Throws:
TestFinder.Fault - if there is a problem while reading the data file.

decodeArg

protected int decodeArg(java.lang.String[] args,
                        int i)
                 throws TestFinder.Fault
Decodes any args needed by BinaryTestFinder. The only supported args are "-binary" or "-jtd" followed by the name of the binary file, or the name of the binary file as the last argument.

Overrides:
decodeArg in class TestFinder
Parameters:
args - An array of arguments, containing the next argument to be decoded.
i - The position in the args array of the next argument to be decoded.
Returns:
The number of entries in the args array that were taken as part of the next argument.
Throws:
TestFinder.Fault - if any problems occur while decoding the next argument

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 class TestFinder
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 class TestFinder
Parameters:
path - The location in question.

scan

protected void scan(java.io.File file)
Given a File, scan to look for other files or tests. These can then be used through getTests() and getFiles(). This method first takes the file path and makes it relative to the testsuite root. It then finds the corresponding node in the test tree, and calls foundFile and foundTestDescription based on the info in that node, thereby recreating the effect of the original read of this file by the original test finder.

Specified by:
scan in class TestFinder
Parameters:
file - The file to scan


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