Class TestDescription

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

public class TestDescription extends Object implements 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:
  • Constructor Summary

    Constructors
    Constructor
    Description
    TestDescription(File root, File file, Map<?,?> params)
    Construct a test description from the parameters of a recognized descriptions.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    Deprecated.
    use getParameter("classDir") instead
    Get the directory for this test description.
    Deprecated.
    use getParameter("executeArgs") instead
    Deprecated.
    use getParameter("executeClass") instead
    Get the file for this test description.
    Get the id within the file for this test description.
    Get the set of keywords for this test description, as specified by the "keywords" parameter.
    Get the set of keywords for this test description, as specified by the "keywords" parameter.
    Get the name of this test description; if not given explicitly, it defaults to the filename root of the first source file.
    Get a parameter of the test description by name.
    int
    Get the number of parameters contained in this test description.
    Get an iterator for the names of the parameters contained in this test description.
    Deprecated.
    No longer relevant for some test suites, so will not be supported in the future.
    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.
    Deprecated.
    Use getRootRelativeFile().getParent()
    Get the file of the test, relative to the root dir for the test suite.
    Get the path of the test, relative to the root dir for the test suite.
    Get the url of the test, relative to the root dir for the test suite.
    Get the set of source files for this test description, as specified by the "source" parameter.
    Get the set of source files for this test description, as specified by the "source" parameter.
    URL[]
    Get a list of associated files for a specified test description.
    int
    Deprecated.
    use getParameter("timeout") instead
    Get the title of this test description.
    int
     
    Simple standard debugging output.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • TestDescription

      public TestDescription(File root, File file, Map<?,?> params)
      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:
      IllegalArgumentException - if the file argument is an absolute filename and does not begin with the root filename.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object td)
      Overrides:
      equals in class Object
    • getDir

      public File getDir()
      Get the directory for this test description.
      Returns:
      the directory containing this test description
    • getFile

      public 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 String getId()
      Get the id within the file for this test description.
      Returns:
      the id within the file of this test description
    • getTitle

      public 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 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 String[] getKeywords()
      Get the set of keywords for this test description, as specified by the "keywords" parameter.
      Returns:
      the set of keywords
    • getKeywordTable

      public Set<String> 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 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

      public 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:
    • getSourceURLs

      public URL[] getSourceURLs()
      Get a list of associated files for a specified test description. Normally, this will include the file containing the test description, and any source files used by the test. By default, the source files are determined from the test description's "source" entry.
      Returns:
      a list of associated files for this test description
    • getClassDir

      @Deprecated public 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

      @Deprecated public 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

      @Deprecated public 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

      @Deprecated 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

      @Deprecated public 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

      public 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 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 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 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

      @Deprecated public 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 Iterator<String> 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 String getParameter(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 String toString()
      Simple standard debugging output.
      Overrides:
      toString in class Object