com.sun.javatest
Class TestDescription

java.lang.Object
  extended by com.sun.javatest.TestDescription
All Implemented Interfaces:
java.io.Serializable

public class TestDescription
extends java.lang.Object
implements java.io.Serializable

TestDescription objects embody the parameters of a test and provide the ability to run a test. The parameters are normally found by parsing HTML files and looking for distinguished constructions whose parameters provide the necessary description of a test.

See Also:
Serialized Form

Constructor Summary
TestDescription(java.io.File root, java.io.File file, java.util.Map params)
          Construct a test description from the parameters of a recognized descriptions.
 
Method Summary
 boolean equals(java.lang.Object td)
           
 java.lang.String getClassDir()
          Deprecated. use getParameter("classDir") instead
 java.io.File getDir()
          Get the directory for this test description.
 java.lang.String getExecuteArgs()
          Deprecated. use getParameter("executeArgs") instead
 java.lang.String getExecuteClass()
          Deprecated. use getParameter("executeClass") instead
 java.io.File getFile()
          Get the file for this test description.
 java.lang.String getId()
          Get the id within the file for this test description.
 java.lang.String[] getKeywords()
          Get the set of keywords for this test description, as specified by the "keywords" parameter.
 java.util.Set getKeywordTable()
          Get the set of keywords for this test description, as specified by the "keywords" parameter.
 java.lang.String getName()
          Get the name of this test description; if not given explicitly, it defaults to the filename root of the first source file.
 java.lang.String getParameter(java.lang.String key)
          Get a parameter of the test description by name.
 int getParameterCount()
          Get the number of parameters contained in this test description.
 java.util.Iterator getParameterKeys()
          Get an iterator for the names of the parameters contained in this test description.
 java.io.File getRoot()
          Deprecated. No longer relevant for some test suites, so will not be supported in the future. If needed the value can be determined by asking the test suite's TestFinder.
 java.lang.String getRootDir()
          Get the root directory for this test suite WARNING: If this description has been read in from a .jtr file, the rootDir may be inappropriate for this system.
 java.io.File getRootRelativeDir()
          Deprecated. Use getRootRelativeFile().getParent()
 java.io.File getRootRelativeFile()
          Get the file of the test, relative to the root dir for the test suite.
 java.lang.String getRootRelativePath()
          Get the path of the test, relative to the root dir for the test suite.
 java.lang.String getRootRelativeURL()
          Get the url of the test, relative to the root dir for the test suite.
 java.io.File[] getSourceFiles()
          Get the set of source files for this test description, as specified by the "source" parameter.
 java.lang.String[] getSources()
          Get the set of source files for this test description, as specified by the "source" parameter.
 int getTimeout()
          Deprecated. use getParameter("timeout") instead
 java.lang.String getTitle()
          Get the title of this test description.
 java.lang.String toString()
          Simple standard debugging output.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TestDescription

public TestDescription(java.io.File root,
                       java.io.File file,
                       java.util.Map params)
                throws java.lang.IllegalArgumentException
Construct a test description from the parameters of a recognized descriptions.

Parameters:
root - The root file of the test suite
file - The file containing the test description
params - The collected parameters of the test description
Throws:
java.lang.IllegalArgumentException - if the file argument is an absolute filename and does not begin with the root filename.
Method Detail

equals

public boolean equals(java.lang.Object td)
Overrides:
equals in class java.lang.Object

getDir

public java.io.File getDir()
Get the directory for this test description.

Returns:
the directory containing this test description

getFile

public java.io.File getFile()
Get the file for this test description. WARNING: If this description has been read in from a .jtr file, the rootDir may be inappropriate for this system.

Returns:
the file containing this test description

getId

public java.lang.String getId()
Get the id within the file for this test description.

Returns:
the id within the file of this test description

getTitle

public java.lang.String getTitle()
Get the title of this test description. This title is determined from the "title" parameter, if present, defaulting to the value returned by getName().

Returns:
the title of this test description

getName

public java.lang.String getName()
Get the name of this test description; if not given explicitly, it defaults to the filename root of the first source file.

Returns:
the name of this test description

getKeywords

public java.lang.String[] getKeywords()
Get the set of keywords for this test description, as specified by the "keywords" parameter.

Returns:
the set of keywords

getKeywordTable

public java.util.Set getKeywordTable()
Get the set of keywords for this test description, as specified by the "keywords" parameter. They are returned in canonical form (lower-case).

Returns:
the set of keywords

getSources

public java.lang.String[] getSources()
Get the set of source files for this test description, as specified by the "source" parameter.

Returns:
The sources as specified in the HTML test description
See Also:
getSourceFiles()

getSourceFiles

public java.io.File[] getSourceFiles()
Get the set of source files for this test description, as specified by the "source" parameter. The files in the "source" parameter should normally be relative, in which case, they will be evaluated relative to the directory containing this test description. Then, if any of the files are under the user's current directory, they will be returned relative to that directory; otherwise, they will be returned as absolute filenames.

Returns:
filenames specified by the source parameter.
See Also:
getSources()

getClassDir

public java.lang.String getClassDir()
Deprecated. use getParameter("classDir") instead

Get the optional class directory for this test description, as specified by the "classDir" parameter.

Returns:
the class directory, or null if not specified

getExecuteClass

public java.lang.String getExecuteClass()
Deprecated. use getParameter("executeClass") instead

Get the execution class for this test description, as specified by the "executeClass" parameter.

Returns:
the execute class name, or null if not specified

getExecuteArgs

public java.lang.String getExecuteArgs()
Deprecated. use getParameter("executeArgs") instead

Get the execution args for this test description, as specified by the "executeArgs" parameter.

Returns:
the execute args, or null if not specified

getTimeout

public int getTimeout()
Deprecated. use getParameter("timeout") instead

Get the requested timeout value for this test description, as specified by the "timeout" parameter.

Returns:
the timeout value, or 0 if not specified

getRoot

public java.io.File getRoot()
Deprecated. No longer relevant for some test suites, so will not be supported in the future. If needed the value can be determined by asking the test suite's TestFinder.

Get the root file for this test suite; THIS IS PROVIDED FOR BACKWARDS COMPATIBILTY FOR JCK ONLY. It returns the name of testsuite.html within the root directory of the test suite. WARNING: If this description has been read in from a .jtr file, the rootDir may be inappropriate for this system.

Returns:
the root file for this test suite
See Also:
getRootDir()

getRootDir

public java.lang.String getRootDir()
Get the root directory for this test suite WARNING: If this description has been read in from a .jtr file, the rootDir may be inappropriate for this system.

Returns:
the root directory for this test suite

getRootRelativePath

public java.lang.String getRootRelativePath()
Get the path of the test, relative to the root dir for the test suite. This is the path to the source file for this description. The internal separator is always '/'.

Returns:
the path for this test description within the test suite

getRootRelativeFile

public java.io.File getRootRelativeFile()
Get the file of the test, relative to the root dir for the test suite.

Returns:
A platform specific path to the source file.

getRootRelativeURL

public java.lang.String getRootRelativeURL()
Get the url of the test, relative to the root dir for the test suite. This is the path to the source file for this description, plus the test id if necessary. Again, the path separator is always '/'.

Returns:
a relative URL for this test within the test suite

getRootRelativeDir

public java.io.File getRootRelativeDir()
Deprecated. Use getRootRelativeFile().getParent()

Get the path of the test directory, relative to the root directory for the test suite.

Returns:
the a relative path to the directory containing this test description

getParameterCount

public int getParameterCount()
Get the number of parameters contained in this test description.

Returns:
the number of parameters

getParameterKeys

public java.util.Iterator getParameterKeys()
Get an iterator for the names of the parameters contained in this test description.

Returns:
an iterator for the names of the parameters

getParameter

public java.lang.String getParameter(java.lang.String key)
Get a parameter of the test description by name.

Parameters:
key - the name of the parameter value to be returned
Returns:
the value of the specified parameter, or null if not found

toString

public java.lang.String toString()
Simple standard debugging output.

Overrides:
toString in class java.lang.Object


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