Class SignatureTestDriver

java.lang.Object
ee.jakarta.tck.pages.signaturetest.SignatureTestDriver
Direct Known Subclasses:
SigTestDriver

public abstract class SignatureTestDriver extends Object
Allows the sigtest framework to be extended using different signature test implementations (e.g. ApiCheck, or SigTest)
  • Constructor Details

    • SignatureTestDriver

      public SignatureTestDriver()
  • Method Details

    • executeSigTest

      public SigTestResult executeSigTest(String packageListFile, String mapFile, String signatureRepositoryDir, String[] packagesUnderTest, String[] classesUnderTest, String classpath) throws Exception

      Execute the signature test. By default, this method passes the result of createTestArguments(String, String, String, String, String, boolean) and passes the result to runSignatureTest(String, String[]).

      Parameters:
      packageListFile - - file containing the packages/classes that are to be verified
      mapFile - sig-test.map file
      signatureRepositoryDir - directory containing the recorded signatures
      packagesUnderTest - packages, defined by the test client, that should be tested
      classesUnderTest - classes, defined by the test client, that should be tested
      classpath - The location of the API being verified. Normally the checked API will be available in the test environment and testClasspath will be null. In some rare cases the tested API may not be part of the test environment and will have to specified using this parameter.
      Returns:
      a SigTestResult containing the result of the test execution
      Throws:
      Exception
    • createTestArguments

      protected abstract String[] createTestArguments(String packageListFile, String mapFile, String signatureRepositoryDir, String packageOrClassUnderTest, String classpath, boolean bStaticMode) throws Exception
      Using a common set of information, create arguments that are appropriate to be used with the underlying signature test framework.
      Parameters:
      packageListFile - - file containing the packages/classes that are to be verified
      mapFile - sig-test.map file
      signatureRepositoryDir - directory containing the recorded signatures
      packageOrClassUnderTest - the class or package
      classpath - The location of the API being verified. Normally the checked API will be available in the test environment and testClasspath will be null. In some rare cases the tested API may not be part of the test environment and will have to specified using this parameter.
      Throws:
      Exception
    • runSignatureTest

      protected abstract boolean runSignatureTest(String packageOrClassName, String[] testArguments) throws Exception
      Invoke the underlying signature test framework for the specified package or class.
      Parameters:
      packageOrClassName - the package or class to be validated
      testArguments - the arguments necessary to invoke the signature test framework
      Returns:
      true if the test passed, otherwise false
      Throws:
      Exception
    • loadMapFile

      public Properties loadMapFile(String mapFile) throws IOException, FileNotFoundException
      Loads the specified file into a Properties object provided the specified file exists and is a regular file. The call to new FileInputStream verifies that the specfied file is a regular file and exists.
      Parameters:
      mapFile - the path and name of the map file to be loaded
      Returns:
      Properties The Properties object initialized with the contents of the specified file
      Throws:
      IOException - If the specified map file does not exist or is not a regular file, can also be thrown if there is an error creating an input stream from the specified file.
      FileNotFoundException
    • getSigFileName

      protected String getSigFileName(String baseName, String repositoryDir, String version) throws FileNotFoundException
      This method will attempt to build a fully-qualified filename in the format of respositoryDir + baseName + .sig_ + version.
      Parameters:
      baseName - the base portion of the signature filename
      repositoryDir - the directory in which the signatures are stored
      version - the version of the signature file
      Returns:
      a valid, fully qualified filename, appropriate for the system the test is being run on
      Throws:
      FileNotFoundException - if the file cannot be validated as existing and is in fact a file
    • getSigFileInfo

      protected SignatureTestDriver.SignatureFileInfo getSigFileInfo(String packageName, String mapFile, String repositoryDir) throws Exception
      Returns the name and path to the signature file that contains the specified package's signatures.
      Parameters:
      packageName - The package under test
      mapFile - The name of the file that maps package names to versions
      repositoryDir - The directory that conatisn all signature files
      Returns:
      String The path and name of the siganture file that contains the specified package's signatures
      Throws:
      Exception - if the determined signature file is not a regular file or does not exist