|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sofya.base.Handler sofya.apps.dejavu.TestSelectionHandler
public class TestSelectionHandler
The TestSelectionHandler provides methods to manipulate Sofya test selection files and manage test selection information for methods obtained from running the DejaVu tool.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface sofya.base.SConstants |
---|
SConstants.BlockLabel, SConstants.BlockObjectType, SConstants.BlockSubType, SConstants.BlockType, SConstants.BranchObjectType, SConstants.BranchType, SConstants.EDObjectType, SConstants.TraceObjectType |
Field Summary |
---|
Fields inherited from class sofya.base.Handler |
---|
HANDLER_EXTENSIONS, LINE_SEP |
Fields inherited from interface sofya.base.SConstants |
---|
DEFAULT_PORT, INST_COMPATIBLE, INST_OLD_UNSUPPORTED, INST_OPT_NORMAL, INST_OPT_SEQUENCE, SIG_CHKALIVE, SIG_ECHO |
Constructor Summary | |
---|---|
TestSelectionHandler()
Default constructor, creates a test selection handler with no test selections yet registered and no test count set. |
|
TestSelectionHandler(int numTests)
Default constructor, creates a test selection handler with no test selections yet registered and the specified number of tests from which selection may occur. |
Method Summary | |
---|---|
boolean |
containsMethod(java.lang.String methodName)
Reports whether test selection data exists for a given method. |
java.lang.String[] |
getMethodList()
Gets the list of methods names for which test selections are currently registered with the handler. |
int |
getNumberOfTests()
Gets the number of tests. |
int[] |
getSelectedTests(java.lang.String methodName)
Gets the tests selected for a given method. |
static void |
main(java.lang.String[] argv)
Test driver for TestSelectionHandler. |
void |
readTestSelectionFile(java.lang.String fileName)
Reads a test selection file making the information available for request from the handler. |
void |
setSelectedTests(java.lang.String methodName,
int[] selectedTests)
Records the tests selected for a given method. |
void |
writeTestSelectionFile(java.lang.String fileName,
java.lang.String tag)
Writes a test selection file from the test selection information currently registered with the handler. |
Methods inherited from class sofya.base.Handler |
---|
copyFile, createCacheFile, disableParseNumbers, ensureTagExists, formatSignature, isIntAvailable, isStringAvailable, newCache, openCacheFile, openInputFile, openInputFile, openOutputFile, openOutputFile, parseClass, prepareTokenizer, readInt, readIntIgnoreEOL, readJarClasses, readNextLine, readProgFile, readString, readStringIgnoreEOL, readToEOL, readToNextDataLine, toBinary, toHex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TestSelectionHandler()
Note: A handler created with this constructor should
only be used to read an existing test selection file. Any attempt
to add test selection information for a method or write a test
selection file prior to calling readTestSelectionFile(java.lang.String)
will
result in an IllegalStateException
being thrown. To
create a new test selection file, TestSelectionHandler(int)
should be used.
public TestSelectionHandler(int numTests)
numTests
- Number of tests from which selection may occur.Method Detail |
---|
public void writeTestSelectionFile(java.lang.String fileName, java.lang.String tag) throws java.lang.IllegalStateException, java.io.IOException
fileName
- Name of the test selection file to be written.
java.lang.IllegalStateException
- If the number of tests has not yet been
set, either in the constructor or by readTestSelectionFile(java.lang.String)
.
java.io.IOException
- If there is an I/O error creating or writing
the file.public void readTestSelectionFile(java.lang.String fileName) throws java.io.FileNotFoundException, BadFileFormatException, java.io.IOException
getSelectedTests(java.lang.String)
method can be used to
retrieve information loaded by this method.
If the handler was created using the no-argument constructor, this method will set the number of tests, enabling the ability to add new test selection information and write a modified test selection file.
fileName
- Name of the test selection file to be read.
java.io.FileNotFoundException
- If the specified file doesn't exist.
BadFileFormatException
- If the specified file is not a test
selection file, or is otherwise malformed or corrupted.
java.io.IOException
- If there is an I/O error reading the file.public java.lang.String[] getMethodList()
public boolean containsMethod(java.lang.String methodName)
methodName
- Name of the method which the handler should
check for test selection data.
true
if test selection data is available for the
given method, false
otherwise.public int[] getSelectedTests(java.lang.String methodName) throws MethodNotFoundException
methodName
- Name of the method for which the selected tests are
to be retrieved.
MethodNotFoundException
- If the handler has no test selection
information associated with a method of the specified name.public void setSelectedTests(java.lang.String methodName, int[] selectedTests) throws java.lang.IllegalStateException
If test selection information already exists for the specified method, it is overwritten. Otherwise the method and test selection information are added to the set of methods registered with the handler.
methodName
- Name of the method for which test selection information
is being recorded.selectedTests
- The selected tests to be associated with the method.
java.lang.IllegalStateException
- If the number of tests has not yet been
set, either in the constructor or by readTestSelectionFile(java.lang.String)
.public int getNumberOfTests()
public static void main(java.lang.String[] argv) throws java.lang.Exception
java.lang.Exception
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |