Class SignatureTestDriver
java.lang.Object
ee.jakarta.tck.concurrent.common.signature.SignatureTestDriver
- Direct Known Subclasses:
ApiCheckDriver
,SigTestDriver
Allows the sigtest framework to be extended using different signature test
implementations (e.g. ApiCheck, or SigTest)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
A simple data structure containing the fully qualified path to the signature file as well as the version being tested. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Implementation of the cleanup method defined in both the SigTest and SigTestEE class.protected abstract String[]
createTestArguments
(String packageListFile, String mapFile, String signatureRepositoryDir, String packageOrClassUnderTest, String classpath, boolean bStaticMode) Using a common set of information, create arguments that are appropriate to be used with the underlying signature test framework.executeSigTest
(String packageListFile, String mapFile, String signatureRepositoryDir, String[] packagesUnderTest, String[] classesUnderTest, String classpath, ArrayList<String> unaccountedTechPkgs, String optionalPkgToIgnore) Execute the signature test.getMapFileImpl
(String binDir) Implementation of the getMapFile method defined in both the SigTest and SigTestEE class.getPackageFileImpl
(String binDir) Implementation of the getPackageFile method defined in both the SigTest and SigTestEE class.getRepositoryDirImpl
(String tsHome) Implementation of the getRepositoryDir method defined in both the SigTest and SigTestEE class.protected SignatureTestDriver.SignatureFileInfo
getSigFileInfo
(String originalPackage, String mapFile, String repositoryDir) Returns the name and path to the signature file that contains the specified package's signatures.protected String
getSigFileName
(String baseName, String repositoryDir, String version) This method will attempt to build a fully-qualified filename in the format ofrespositoryDir
+ baseName +.sig_
+ version.isJavaSEVersion
(String ver) Returns true if the passed in version matches the current Java version being used.loadMapFile
(String mapFile) Loads the specified file into a Properties object provided the specified file exists and is a regular file.protected abstract String
protected abstract boolean
runPackageSearch
(String packageOrClassName, String[] testArguments) This checks if a class exists or not within the impl.protected abstract boolean
runSignatureTest
(String packageOrClassName, String[] testArguments) Invoke the underlying signature test framework for the specified package or class.protected abstract boolean
verifyJTAJarForNoXA
(String classpath, String repositoryDir) This method checks whether JTA API jar contains classes from javax.transaction.xa package
-
Constructor Details
-
SignatureTestDriver
public SignatureTestDriver()
-
-
Method Details
-
getPackageFileImpl
Implementation of the getPackageFile method defined in both the SigTest and SigTestEE class. -
getMapFileImpl
Implementation of the getMapFile method defined in both the SigTest and SigTestEE class. -
isJavaSEVersion
Returns true if the passed in version matches the current Java version being used. -
getRepositoryDirImpl
Implementation of the getRepositoryDir method defined in both the SigTest and SigTestEE class. -
cleanupImpl
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 torunSignatureTest(String, String[])
.- Parameters:
packageListFile
- - file containing the packages/classes that are to be verifiedmapFile
- sig-test.map filesignatureRepositoryDir
- directory containing the recorded signaturespackagesUnderTest
- packages, defined by the test client, that should be testedclassesUnderTest
- classes, defined by the test client, that should be testedclasspath
- 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 verifiedmapFile
- sig-test.map filesignatureRepositoryDir
- directory containing the recorded signaturespackageOrClassUnderTest
- the class or packageclasspath
- 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 validatedtestArguments
- the arguments necessary to invoke the signature test framework- Returns:
true
if the test passed, otherwisefalse
- 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, otherwisefalse
- 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 jarrepositoryDir
- the directory containing an empty signature file- Returns:
true
if the package javax.transaction.xa is not found in the JTA API jar, otherwisefalse
- Throws:
Exception
-
loadMapFile
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 ofrespositoryDir
+ baseName +.sig_
+ version.- Parameters:
baseName
- the base portion of the signature filenamerepositoryDir
- the directory in which the signatures are storedversion
- 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
-
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 testmapFile
- The name of the file that maps package names to versionsrepositoryDir
- 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
-