sofya.viewers
Class TestSelectionViewer

java.lang.Object
  extended by sofya.viewers.Viewer
      extended by sofya.viewers.TestSelectionViewer

public class TestSelectionViewer
extends Viewer

The TestSelectionViewer is used to display the list of selected tests in a human readable format, or as a list for further processing.

Usage:
java sofya.viewers.TestSelectionViewer <test_file> [-t t|l|s] [OutputFile]
     -t t|l|s : Format of the output.
     OutputFile : Redirect output of viewer to OutputFile

Version:
07/20/2005
Author:
Rogan Creswick, Alex Kinneer

Field Summary
static int LIST
          Constant flag for list format.
static int STATISTICAL
          Constant flag for statistical format.
static int TABULAR
          Constant flag for tabular format.
 
Fields inherited from class sofya.viewers.Viewer
destStream, inputFile, LINE_SEP, outputFile, stdin
 
Constructor Summary
TestSelectionViewer(java.lang.String inputFile, int format)
          Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format.
TestSelectionViewer(java.lang.String inputFile, java.io.OutputStream stream, int format)
          Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format to the specified output stream.
TestSelectionViewer(java.lang.String inputFile, java.lang.String outputFile, int format)
          Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format to the specified output file.
TestSelectionViewer(TestSelectionHandler tsHandler)
          Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format.
 
Method Summary
 int getOutputFormat()
          Gets the output format currently set to be used.
 boolean isVerbose()
          Gets whether headers are to be printed for methods that did not contribute any selected tests.
static void main(java.lang.String[] argv)
          Entry point for TestSelectionViewer.
 void print(java.io.PrintWriter stream)
          Prints the test selection information to the specified stream.
 void setOutputFormat(int format)
          Sets the output format to be used.
 void setVerbose(boolean enable)
          Sets whether headers should be printed for methods that did not contribute any selected tests.
 
Methods inherited from class sofya.viewers.Viewer
print, printMethodName, rightJust, setInputFile, setOutputFile, setOutputStream, sizeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TABULAR

public static final int TABULAR
Constant flag for tabular format.

See Also:
Constant Field Values

STATISTICAL

public static final int STATISTICAL
Constant flag for statistical format.

See Also:
Constant Field Values

LIST

public static final int LIST
Constant flag for list format.

See Also:
Constant Field Values
Constructor Detail

TestSelectionViewer

public TestSelectionViewer(java.lang.String inputFile,
                           int format)
Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format.

Parameters:
inputFile - Name of the test selection file to be displayed.
format - Output format to be used. Should be one of the following:
     TestSelectionViewer.TABULAR
     TestSelectionViewer.STATISTICAL
     TestSelectionViewer.LIST

TestSelectionViewer

public TestSelectionViewer(java.lang.String inputFile,
                           java.lang.String outputFile,
                           int format)
                    throws SameFileNameException,
                           java.io.IOException
Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format to the specified output file.

Parameters:
inputFile - Name of the test selection file to be displayed.
outputFile - Name of the file to which the viewer output should be written.
format - Output format to be used. Should be one of the following:
     TestSelectionViewer.TABULAR
     TestSelectionViewer.STATISTICAL
     TestSelectionViewer.LIST
Throws:
SameFileNameException
java.io.IOException

TestSelectionViewer

public TestSelectionViewer(java.lang.String inputFile,
                           java.io.OutputStream stream,
                           int format)
Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format to the specified output stream.

Parameters:
inputFile - Name of the test selection file to be displayed.
stream - Stream to which the viewer output should be written.
format - Output format to be used. Should be one of the following:
     TestSelectionViewer.TABULAR
     TestSelectionViewer.STATISTICAL
     TestSelectionViewer.LIST

TestSelectionViewer

public TestSelectionViewer(TestSelectionHandler tsHandler)
Standard constructor, creates a TestSelectionViewer to display the selected tests in the specified format.

The TestSelectionHandler passed to this constructor must have useful test selection data available prior to calling a print method.

Parameters:
tsHandler - TestSelectionHandler for the file of interest.
Method Detail

setOutputFormat

public void setOutputFormat(int format)
Sets the output format to be used.

Parameters:
format - Output format to be used. Should be one of the following:
     TestSelectionViewer.TABULAR
     TestSelectionViewer.STATISTICAL
     TestSelectionViewer.LIST
Throws:
java.lang.IllegalArgumentException - If the specified output format is not recognized.

getOutputFormat

public int getOutputFormat()
Gets the output format currently set to be used.

Returns:
An integer representing the currently specified output format (see setOutputFormat(int)).

setVerbose

public void setVerbose(boolean enable)
Sets whether headers should be printed for methods that did not contribute any selected tests.

Parameters:
enable - true to enable printing of headers for non-contributing methods, false otherwise.

isVerbose

public boolean isVerbose()
Gets whether headers are to be printed for methods that did not contribute any selected tests.

Returns:
true if printing of headers for non-contributing methods is enabled, false otherwise.

print

public void print(java.io.PrintWriter stream)
           throws java.io.IOException
Prints the test selection information to the specified stream.

Specified by:
print in class Viewer
Parameters:
stream - Stream to which the test selection information should be written.
Throws:
java.io.IOException - If there is an error writing to the stream, or creating the output file, if applicable.

main

public static void main(java.lang.String[] argv)
Entry point for TestSelectionViewer.