Class BinaryTestFinder

java.lang.Object
com.sun.javatest.TestFinder
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.
  • Constructor Details

    • BinaryTestFinder

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

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

      @Deprecated public BinaryTestFinder(File testSuiteRoot, 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:
      testSuiteRoot - The root file of the Test Suite. This is usually a file called testsuite.html
      jtdFile - The binary file containing the precompiled 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.
  • Method Details

    • init

      public void init(String[] args, 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

      @Deprecated public void init(File testSuiteRoot, 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(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(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(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(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
    • readBinaryFile

      public void readBinaryFile()
      Read the binary file. The input file should be a zip file as written by BinaryTestWriter. All three sections are read, but only the string table and test tree are parsed at this point. The test table is read from an internal byte array as required.
    • getStringTable

      public com.sun.javatest.finder.BinaryTestFinder.StringTable getStringTable()
    • getTestTable

      public BinaryTestFinder.TestTable getTestTable()
    • getTestTree

      public BinaryTestFinder.TestTree getTestTree()
    • totalNumberOfTestsInTheSuite

      public Optional<Integer> totalNumberOfTestsInTheSuite()
      Description copied from class: TestFinder
      Returns the total number of tests in the inspected suite if it is known. (For example if preliminary quick scan of the suite was done). Default implementation returns empty Optional.
      Overrides:
      totalNumberOfTestsInTheSuite in class TestFinder
      Returns:
      total number of tests or empty optional if there's no info available