Class SignatureTestDriver

java.lang.Object
ee.jakarta.tck.concurrent.common.signature.SignatureTestDriver
Direct Known Subclasses:
ApiCheckDriver, 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

    • getPackageFileImpl

      public String getPackageFileImpl(String binDir)
      Implementation of the getPackageFile method defined in both the SigTest and SigTestEE class.
    • getMapFileImpl

      public String getMapFileImpl(String binDir)
      Implementation of the getMapFile method defined in both the SigTest and SigTestEE class.
    • isJavaSEVersion

      public Boolean isJavaSEVersion(String ver)
      Returns true if the passed in version matches the current Java version being used.
    • getRepositoryDirImpl

      public String getRepositoryDirImpl(String tsHome)
      Implementation of the getRepositoryDir method defined in both the SigTest and SigTestEE class.
    • cleanupImpl

      public void cleanupImpl() throws Exception
      Implementation of the cleanup method defined in both the SigTest and SigTestEE class.
      Throws:
      Exception
    • executeSigTest

      public SigTestResult executeSigTest(String packageListFile, String mapFile, String signatureRepositoryDir, String[] packagesUnderTest, String[] classesUnderTest, String classpath, ArrayList<String> unaccountedTechPkgs, String optionalPkgToIgnore) 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.
      unaccountedTechPkgs - packages that should not exist within the technology under test. These will be searched for and if found, will be flagged as error since they were not explicitly declared as being under test. Their existence requires explicit testing.
      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
    • runPackageSearch

      protected abstract boolean runPackageSearch(String packageOrClassName, String[] testArguments) throws Exception
      This checks if a class exists or not within the impl.
      Parameters:
      packageOrClassName - the package or class to be validated
      Returns:
      true if the package was found to exist, otherwise false
      Throws:
      Exception
    • verifyJTAJarForNoXA

      protected abstract boolean verifyJTAJarForNoXA(String classpath, String repositoryDir) throws Exception
      This method checks whether JTA API jar contains classes from javax.transaction.xa package
      Parameters:
      classpath - the classpath, pointing JTA API jar
      repositoryDir - the directory containing an empty signature file
      Returns:
      true if the package javax.transaction.xa is not found in the JTA API jar, 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
    • normalizeFileName

      protected abstract String normalizeFileName(File f)
    • getSigFileInfo

      protected SignatureTestDriver.SignatureFileInfo getSigFileInfo(String originalPackage, 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 contains 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