sir.mts
Class Configuration

java.lang.Object
  extended by sir.mts.Configuration

public final class Configuration
extends java.lang.Object

Records the settings that control various aspects of the operation of MakeTestScript.

Version:
02/14/2006
Author:
Alex Kinneer

Field Summary
static java.lang.String ARISTOTLE_DB_DIR
          Constant specifying the default path to the trace file source for Aristotle.
static java.lang.String INPUT_DIR
          Constant specifying the path the to subject inputs directory.
static java.lang.String OUTPUT_DIR
          Constant specifying the path the to subject outputs directory.
static java.lang.String SOFYA_DB_DIR
          Constant specifying the default path to the trace file source for Sofya.
static java.lang.String TESTSCRIPT_DIR
          Constant specifying the path the to subject testscripts directory, used to locate scripts referenced by STImpL script commands.
static java.lang.String TRACE_DIR
          Constant specifying the path the to subject traces directory.
 
Constructor Summary
Configuration()
          Creates a new configuration with default values where appropriate.
 
Method Summary
 boolean disableEscapes()
          Reports whether the new escape character capabilities of the MakeTestScript lexer are disabled.
 void disableEscapes(boolean on)
          Specifies whether the new escape character capabilities of the MakeTestScript lexer should be disabled.
 boolean enableLegacyMacros()
          Reports whether legacy substitution macros are enabled.
 void enableLegacyMacros(boolean on)
          Specifies whether legacy substitution macros should be enabled.
 java.lang.String getComparisonCommand()
          Gets the command to be used for comparing outputs in comparison scripts.
 java.lang.String getComparisonDirectory()
          Gets the path to the directory containing the files against which outputs should be compared by a comparison script.
 java.lang.String getExecutablePrefix()
          Gets the prefix that will be prepended to the executable name.
 java.lang.String getExecutableSuffix()
          Gets the suffix that will be appended to the executable name.
 java.lang.String getExperimentDirectory()
          Gets the path to the experiment root directory of the subject.
 java.lang.String getInvokePrefix()
          Gets the prefix that will be inserted before the entire test case invocation command.
 java.lang.String getInvokeSuffix()
          Gets the suffix that will be appended to the end of the entire test case invocation command.
 java.lang.String getMTSCommandString()
          Gets the command line string used to invoke MakeTestScript.
 java.lang.String getScriptName()
          Gets the name of the script to be generated.
 java.lang.String getStimpleFile()
          Gets the name of the STImpL file to be processed.
 java.lang.String getSubjectExecutable()
          Gets the name of the executable program to be invoked.
 java.lang.String getTargetType()
          Gets the target type of script to be generated (such as C shell, Bourne shell, etc).
 java.lang.String getTraceName()
          Gets the name of the trace file generated by the tracing tool.
 java.lang.String getTraceSourceDirectory()
          Gets the path to the directory where the trace files produced by the tracing tool in use can be found.
 boolean isComparing()
          Reports whether the script to be generated is an output comparing script.
 boolean isExecutableSuffixConstrained()
          Checks the flag specifying whether the executable suffix will be appended only on test cases specifying a test driver (with the STImpL '-D' command).
 boolean isJava()
          Reports whether the subject program to be tested by the generated script has been indicated to be a Java program.
 boolean isTracing()
          Reports whether the script to be generated is a trace collecting script.
 void setComparing(boolean on)
          Sets whether the script to be generated is an output comparing script.
 void setComparisonCommand(java.lang.String diffCmd)
          Sets the command to be used for comparing outputs in comparison scripts.
 void setComparisonDirectory(java.lang.String compareDir)
          Sets the path to the directory containing the files against which outputs should be compared by a comparison script.
 void setExecutablePrefix(java.lang.String exePrefix)
          Sets a prefix to be prepended to the executable name.
 void setExecutableSuffix(java.lang.String exeSuffix)
          Sets a suffix to be appended to the executable name.
 void setExecutableSuffixConstrained(boolean on)
          Sets a flag indicating that the executable suffix should be appended only on test cases specifying a test driver (with the STImpL '-D' command).
 void setExperimentDirectory(java.lang.String expDir)
          Sets the path to the experiment root directory of the subject.
 void setInvokePrefix(java.lang.String invPrefix)
          Sets a prefix to be inserted before the entire test case invocation command.
 void setInvokeSuffix(java.lang.String invSuffix)
          Sets a suffix that will be appended to the end of the entire test case invocation command.
 void setJava(boolean on)
          Sets a flag indicating whether the subject program to be tested by the generated script is a Java program.
 void setMTSCommandString(java.lang.String cls, java.lang.String[] argv)
          Records the command line string used to invoke MakeTestScript.
 void setScriptName(java.lang.String name)
          Sets the name of the script to be generated.
 void setStimpleFile(java.lang.String name)
          Sets the name of the STImpL file to be processed.
 void setSubjectExecutable(java.lang.String exeName)
          Sets the name of the executable program to be invoked.
 void setTargetType(java.lang.String targetType)
          Sets the target type of script to be generated (such as C shell, Bourne shell, etc).
 void setTraceName(java.lang.String traceName)
          Sets the name of the trace file generated by the tracing tool, which must be invariant.
 void setTraceSourceDirectory(java.lang.String traceDir)
          Sets the path to the directory where the trace files produced by the tracing tool in use can be found.
 void setTracing(boolean on)
          Sets whether the script to be generated is a trace collecting script.
 java.lang.String toString()
          Produces a string representation of the current configuration.
 void validate()
          Checks that the configuration is consistent and complete.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INPUT_DIR

public static final java.lang.String INPUT_DIR
Constant specifying the path the to subject inputs directory.

See Also:
Constant Field Values

OUTPUT_DIR

public static final java.lang.String OUTPUT_DIR
Constant specifying the path the to subject outputs directory.

See Also:
Constant Field Values

TRACE_DIR

public static final java.lang.String TRACE_DIR
Constant specifying the path the to subject traces directory.

See Also:
Constant Field Values

TESTSCRIPT_DIR

public static final java.lang.String TESTSCRIPT_DIR
Constant specifying the path the to subject testscripts directory, used to locate scripts referenced by STImpL script commands.

See Also:
Constant Field Values

SOFYA_DB_DIR

public static final java.lang.String SOFYA_DB_DIR
Constant specifying the default path to the trace file source for Sofya.

See Also:
Constant Field Values

ARISTOTLE_DB_DIR

public static final java.lang.String ARISTOTLE_DB_DIR
Constant specifying the default path to the trace file source for Aristotle.

See Also:
Constant Field Values
Constructor Detail

Configuration

public Configuration()
Creates a new configuration with default values where appropriate.

Method Detail

setMTSCommandString

public void setMTSCommandString(java.lang.String cls,
                                java.lang.String[] argv)
Records the command line string used to invoke MakeTestScript.

Parameters:
cls - Name of the class file used to invoke MakeTestScript.
argv - Arguments passed to the class.

getMTSCommandString

public java.lang.String getMTSCommandString()
Gets the command line string used to invoke MakeTestScript.

Returns:
The command line string used to invoke MakeTestScript.

setStimpleFile

public void setStimpleFile(java.lang.String name)
Sets the name of the STImpL file to be processed.

Parameters:
name - Name of the STImpL file from which to generate a script.

getStimpleFile

public java.lang.String getStimpleFile()
Gets the name of the STImpL file to be processed.

Returns:
The name of the STImpL file from which to generate a script.

setScriptName

public void setScriptName(java.lang.String name)
Sets the name of the script to be generated.

Parameters:
name - Name of the script to be generated.

getScriptName

public java.lang.String getScriptName()
Gets the name of the script to be generated.

Returns:
The name of the script to be generated.

setExperimentDirectory

public void setExperimentDirectory(java.lang.String expDir)
Sets the path to the experiment root directory of the subject.

Parameters:
expDir - Path to the experiment root directory of the subject.

getExperimentDirectory

public java.lang.String getExperimentDirectory()
Gets the path to the experiment root directory of the subject.

Returns:
Path to the experiment root directory of the subject.

setSubjectExecutable

public void setSubjectExecutable(java.lang.String exeName)
Sets the name of the executable program to be invoked.

Parameters:
exeName - Name of the executable to be invoked.

getSubjectExecutable

public java.lang.String getSubjectExecutable()
Gets the name of the executable program to be invoked.

Returns:
The name of the executable to be invoked.

setExecutablePrefix

public void setExecutablePrefix(java.lang.String exePrefix)
Sets a prefix to be prepended to the executable name.

Parameters:
exePrefix - String that will be prepended to the executable name.

getExecutablePrefix

public java.lang.String getExecutablePrefix()
Gets the prefix that will be prepended to the executable name.

Returns:
String that will be prepended to the executable name.

setExecutableSuffix

public void setExecutableSuffix(java.lang.String exeSuffix)
Sets a suffix to be appended to the executable name.

Parameters:
exeSuffix - String that will be appended to the executable name.

getExecutableSuffix

public java.lang.String getExecutableSuffix()
Gets the suffix that will be appended to the executable name.

Returns:
String that will be appended to the executable name.

setExecutableSuffixConstrained

public void setExecutableSuffixConstrained(boolean on)
Sets a flag indicating that the executable suffix should be appended only on test cases specifying a test driver (with the STImpL '-D' command).

Parameters:
on - true to enable, false otherwise.

isExecutableSuffixConstrained

public boolean isExecutableSuffixConstrained()
Checks the flag specifying whether the executable suffix will be appended only on test cases specifying a test driver (with the STImpL '-D' command).

Returns:
boolean true if the suffix appended only on test cases specifying a test driver, false otherwise.

setInvokePrefix

public void setInvokePrefix(java.lang.String invPrefix)
Sets a prefix to be inserted before the entire test case invocation command.

The prefix is inserted with separating whitespace.

Parameters:
invPrefix - String to be inserted before the entire test case invocation command.

getInvokePrefix

public java.lang.String getInvokePrefix()
Gets the prefix that will be inserted before the entire test case invocation command.

Returns:
String that will be inserted before the entire test case invocation command.

setInvokeSuffix

public void setInvokeSuffix(java.lang.String invSuffix)
Sets a suffix that will be appended to the end of the entire test case invocation command.

The suffix is appended with a separating whitespace.

Parameters:
invSuffix - String to be appended to the end of the entire test case invocation command.

getInvokeSuffix

public java.lang.String getInvokeSuffix()
Gets the suffix that will be appended to the end of the entire test case invocation command.

Returns:
String that will be appended to the end of the entire test case invocation command.

setComparing

public void setComparing(boolean on)
Sets whether the script to be generated is an output comparing script.

Parameters:
on - true to generate a script that compares outputs, false otherwise.

isComparing

public boolean isComparing()
Reports whether the script to be generated is an output comparing script.

Returns:
true if the generated script will compare outputs, false otherwise.

setComparisonCommand

public void setComparisonCommand(java.lang.String diffCmd)
Sets the command to be used for comparing outputs in comparison scripts.

If this method is not called, a default value is used.

Parameters:
diffCmd - Command, and any associated options, that should be used for comparing output files by a comparison script.

getComparisonCommand

public java.lang.String getComparisonCommand()
Gets the command to be used for comparing outputs in comparison scripts.

Returns:
The command, and any associated options, that will be used to compare output files by a generated comparison script.

setComparisonDirectory

public void setComparisonDirectory(java.lang.String compareDir)
Sets the path to the directory containing the files against which outputs should be compared by a comparison script.

This method must be called before attempting to generate a comparison script.

Parameters:
compareDir - Path to the directory containing previous outputs against which the current outputs should be compared by the generated comparison script.

getComparisonDirectory

public java.lang.String getComparisonDirectory()
Gets the path to the directory containing the files against which outputs should be compared by a comparison script.

Returns:
The path to the directory containing previous outputs against which the current outputs should be compared by the generated comparison script.

setTracing

public void setTracing(boolean on)
Sets whether the script to be generated is a trace collecting script.

Parameters:
on - true to generate a script that collects traces, false otherwise.

isTracing

public boolean isTracing()
Reports whether the script to be generated is a trace collecting script.

Returns:
true if the generated script will collect traces, false otherwise.

setTraceSourceDirectory

public void setTraceSourceDirectory(java.lang.String traceDir)
Sets the path to the directory where the trace files produced by the tracing tool in use can be found.

Parameters:
traceDir - Path to the directory where trace files produced by the tracing tool in use can be found.

getTraceSourceDirectory

public java.lang.String getTraceSourceDirectory()
Gets the path to the directory where the trace files produced by the tracing tool in use can be found.

Returns:
The path to the directory where trace files produced by the tracing tool in use can be found.

setTraceName

public void setTraceName(java.lang.String traceName)
Sets the name of the trace file generated by the tracing tool, which must be invariant.

Parameters:
traceName - Name of the trace file generated by the tracing tool in use.

getTraceName

public java.lang.String getTraceName()
Gets the name of the trace file generated by the tracing tool.

Returns:
The name of the trace file generated by the tracing tool in use.

setJava

public void setJava(boolean on)
Sets a flag indicating whether the subject program to be tested by the generated script is a Java program.

This configuration option is a shorthand to automatically set various options to values that yield compatibility with the output of the old javamts tool. It is purely a convenience.

Parameters:
on - boolean true to indicate that the subject to be tested by the generated script is a Java program.

isJava

public boolean isJava()
Reports whether the subject program to be tested by the generated script has been indicated to be a Java program.

Returns:
boolean true if the program to be tested by the generated script has been indicated to be a Java program.

setTargetType

public void setTargetType(java.lang.String targetType)
Sets the target type of script to be generated (such as C shell, Bourne shell, etc).

Parameters:
targetType - String that is either a shorthand identifier for a target script type that is understood by MakeTestScript, or the name of a class implementing the TestScriptGenerator interface (which must be found on the classpath).

getTargetType

public java.lang.String getTargetType()
Gets the target type of script to be generated (such as C shell, Bourne shell, etc).

Returns:
String that is either a shorthand identifier for a target script type that is understood by MakeTestScript, or the name of a class implementing the TestScriptGenerator interface (which must be found on the classpath).

disableEscapes

public void disableEscapes(boolean on)
Specifies whether the new escape character capabilities of the MakeTestScript lexer should be disabled.

This option supports backwards compatibility with existing universe (STImpL) files. Universe files should be updated whenever possible, after which this option is unneeded.

Parameters:
on - true to disable slash-escapes in the lexer, false otherwise.

disableEscapes

public boolean disableEscapes()
Reports whether the new escape character capabilities of the MakeTestScript lexer are disabled.

Returns:
true if the slash-style escape sequences are disabled in the MakeTestScript lexer.

enableLegacyMacros

public void enableLegacyMacros(boolean on)
Specifies whether legacy substitution macros should be enabled.

This currently enables only one macro, the '%n%' macro used to substitute the current test number in file move (&apos-F&apos) STImpL commands. The preferred replacement is to use the new STImpL macro command "\{TEST}" for current test number substitution, which works anywhere.

Parameters:
on - true to enable legacy substitution macros, false otherwise.

enableLegacyMacros

public boolean enableLegacyMacros()
Reports whether legacy substitution macros are enabled.

Returns:
true if legacy substitution macros are enabled, false otherwise.

validate

public void validate()
              throws ConfigurationException
Checks that the configuration is consistent and complete.

This method may attempt to guess certain configuration values if they are absent. Messages will be printed to the console if this occurs.

Throws:
ConfigurationException - If a required configuration value is absent and cannot be reasonably guessed.

toString

public java.lang.String toString()
Produces a string representation of the current configuration.

Overrides:
toString in class java.lang.Object
Returns:
A string reporting the current values of all configuration parameters.