Class SignatureTestDriver
java.lang.Object
com.sun.ts.tests.el.signaturetest.SignatureTestDriver
- Direct Known Subclasses:
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 TypeMethodDescriptionprotected 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) Execute the signature test.protected SignatureTestDriver.SignatureFileInfo
getSigFileInfo
(String packageName, 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.loadMapFile
(String mapFile) Loads the specified file into a Properties object provided the specified file exists and is a regular file.protected abstract boolean
runSignatureTest
(String packageOrClassName, String[] testArguments) Invoke the underlying signature test framework for the specified package or class.
-
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 calls
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.- 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
-
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
-
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 testmapFile
- The name of the file that maps package names to versionsrepositoryDir
- 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
-