|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.javatest.tool.CommandContext
public class CommandContext
An object to carry the shared state required and derived from executing a series of commands.
While the object does provide some behavior, as detailed below, much of its functionality is to provide a repository for values to be passed from one command to another.
CommandManager.parseCommand(java.lang.String, java.util.ListIterator, com.sun.javatest.tool.CommandContext),
Command.run(com.sun.javatest.tool.CommandContext)| Nested Class Summary | |
|---|---|
class |
CommandContext.Fault
This exception is used to report problems while executing a command. |
| Field Summary | |
|---|---|
static int |
DEFAULT_LAF
Code for setting JavaTest default LookAndFeel. |
static int |
METAL_LAF
Code for setting Metal LookAndFeel. |
static int |
NIMBUS_LAF
Code for setting Nimbus LookAndFeel. |
static int |
SYSTEM_LAF
Code for setting default system LookAndFeel. |
| Constructor Summary | |
|---|---|
CommandContext()
Create a new context object. |
|
CommandContext(java.io.PrintWriter out)
Create a new context object, using a specified PrintWriter for the output stream, used by the printXXX methods. |
|
| Method Summary | |
|---|---|
void |
addCommand(Command cmd)
Add a new command to the set of commands to be executed by this object. |
void |
addHarnessObserver(Harness.Observer o)
Add an observer to the set of observers maintained by this object. |
void |
addTestStats(int[] stats)
Add test run statistics into the cumulative counts. |
void |
dispose()
|
Command |
getAutoRunCommand()
Get the "auto run" command registered with this object. |
java.io.File |
getAutoRunReportDir()
Get the "auto run report directory" registered with this object. |
Command[] |
getCommands()
Get the set of commands to be executed by this object. |
InterviewParameters |
getConfig()
Get the configuration associated with this object. |
Desktop |
getDesktop()
Get the desktop associated with this object. |
Harness.Observer[] |
getHarnessObservers()
Get the set of observers that have been registered with this object. |
InterviewParameters |
getInterviewParameters()
Deprecated. Use getConfig(). |
java.io.PrintWriter |
getLogWriter()
Get the log stream associated with this object. |
int |
getPreferredLookAndFeel()
|
int[] |
getTestStats()
Get the cumulative test run statistics. |
TestSuite |
getTestSuite()
Get the test suite associated with this object. |
boolean |
getVerboseOptionValue(java.lang.String name)
Get the value of a verbose option. |
boolean |
getVerboseOptionValue(java.lang.String name,
boolean defaultValue)
Get the value of a verbose option. |
WorkDirectory |
getWorkDirectory()
Get the work directory associated with this object. |
boolean |
hasConfig()
Check whether a configuration has been set yet. |
boolean |
isCloseDesktopWhenDoneEnabled()
Check whether this object indicates that the desktop should be closed when all commands are done. |
boolean |
isDesktopRequired()
Check if a desktop is required by the commands registered with this object. |
boolean |
isTestSuiteSet()
Check whether the test suite has been set yet. |
boolean |
isVerboseOptionSet(java.lang.String name)
Check if a verbose option has been set explicitly with setVerboseOptionValue. |
boolean |
isVerboseTimestampEnabled()
Check whether timestamps should be printed with verbose output. |
boolean |
isWorkDirectorySet()
Check whether the work directory has been set yet. |
void |
printErrorMessage(I18NResourceBundle i18n,
java.lang.String key)
Write an error message to the log stream associated with this object. |
void |
printErrorMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
Write an error message to the log stream associated with this object. |
void |
printErrorMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
Write an error message to the log stream associated with this object. |
void |
printMessage(I18NResourceBundle i18n,
java.lang.String key)
Write a message to the log stream associated with this object. |
void |
printMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
Write a message to the log stream associated with this object. |
void |
printMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
Write a message to the log stream associated with this object. |
void |
runCommands()
Run the set of commands that have been registered with this object. |
void |
setAutoRunCommand(Command c)
Set the "auto run" command registered with this object. |
void |
setAutoRunReportDir(java.io.File dir)
Set the "auto run report directory" registered with this object. |
void |
setCloseDesktopWhenDoneEnabled(boolean b)
Specify whether this object should remember that the desktop should be closed when all commands are done. |
void |
setConfig(java.io.File path)
Set the path for the configuration information to be associated with this object. |
void |
setDesktop(Desktop d)
Set the desktop associated with this object. |
void |
setInterviewParameters(InterviewParameters p)
Deprecated. Use setConfig(). |
void |
setLogWriter(java.io.PrintWriter out)
Set the log stream associated with this object. |
void |
setPreferredLookAndFeel(int lookAndFeel)
Sets preferred LookAndFeel that is used on Desktop creation (should be set before creation) |
void |
setTestSuite(java.io.File path)
Set the path for the test suite to be associated with this object. |
void |
setTestSuite(TestSuite ts)
Set the test suite to be associated with this object. |
void |
setVerboseMax(boolean on)
Specify whether or not to override the setting of all other verbose options to true. |
void |
setVerboseOptionValue(java.lang.String name,
boolean on)
Specify the value of a verbose option. |
void |
setVerboseQuiet(boolean on)
Specify whether or not to override the setting of all other verbose options to false. |
void |
setVerboseTimestampEnabled(boolean on)
Configure whether timestamps are printed with verbose output. |
void |
setWorkDirectory(java.io.File path)
Set the path for the work directory to be associated with this object. |
void |
setWorkDirectory(java.io.File path,
boolean create)
Set the path for the work directory to be associated with this object. |
void |
setWorkDirectory(WorkDirectory wd)
Set the work directory to be associated with this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SYSTEM_LAF
getPreferredLookAndFeel(),
setPreferredLookAndFeel(int),
DEFAULT_LAF,
METAL_LAF,
NIMBUS_LAF,
Constant Field Valuespublic static final int NIMBUS_LAF
getPreferredLookAndFeel(),
setPreferredLookAndFeel(int),
DEFAULT_LAF,
METAL_LAF,
SYSTEM_LAF,
Constant Field Valuespublic static final int METAL_LAF
getPreferredLookAndFeel(),
setPreferredLookAndFeel(int),
DEFAULT_LAF,
NIMBUS_LAF,
SYSTEM_LAF,
Constant Field Valuespublic static final int DEFAULT_LAF
getPreferredLookAndFeel(),
setPreferredLookAndFeel(int),
METAL_LAF,
NIMBUS_LAF,
SYSTEM_LAF,
Constant Field Values| Constructor Detail |
|---|
public CommandContext()
public CommandContext(java.io.PrintWriter out)
out - the output stream to be used by the printXXX methods.| Method Detail |
|---|
public void addCommand(Command cmd)
cmd - The command to be addedrunCommands()public Command[] getCommands()
addCommand(com.sun.javatest.tool.Command),
runCommands()
public void runCommands()
throws CommandContext.Fault
CommandContext.Fault - if any of the commands executed throw Command.Faultpublic void addHarnessObserver(Harness.Observer o)
o - the observer to be addedgetHarnessObservers()public Harness.Observer[] getHarnessObservers()
addHarnessObserver(com.sun.javatest.Harness.Observer)public Command getAutoRunCommand()
setAutoRunCommand(com.sun.javatest.tool.Command),
runCommands()public void setAutoRunCommand(Command c)
c - the "auto run" command to be registered with this objectgetAutoRunCommand(),
runCommands()public java.io.File getAutoRunReportDir()
setAutoRunReportDir(java.io.File)public void setAutoRunReportDir(java.io.File dir)
dir - the "auto run report directory" to be registered with this objectgetAutoRunReportDir()public void addTestStats(int[] stats)
stats - an array of test counts, indexed by the standard Status.XXX values.public int[] getTestStats()
public boolean isCloseDesktopWhenDoneEnabled()
setCloseDesktopWhenDoneEnabled(boolean)public void setCloseDesktopWhenDoneEnabled(boolean b)
b - true if this object should remember that the desktop should be closed
when all commands are done, and false otherwiseisCloseDesktopWhenDoneEnabled()public boolean isTestSuiteSet()
public TestSuite getTestSuite()
throws CommandContext.Fault
CommandContext.Fault - if there is a problem determining the test suite from
the available parameterssetTestSuite(java.io.File)
public void setTestSuite(java.io.File path)
throws CommandContext.Fault
path - the path for the test suite to be associated with this object
CommandContext.Fault - if the test suite has already ben setgetTestSuite()
public void setTestSuite(TestSuite ts)
throws CommandContext.Fault,
TestSuite.Fault
ts - the test suite to be associated with this object
CommandContext.Fault - if the test suite has already been set to
something else, or if there is a problem evaluating related parameters,
such as a configuration file or template, or a work directory.
TestSuite.Fault - if there is a problem evaluating related
parameters.getTestSuite()public boolean isWorkDirectorySet()
public WorkDirectory getWorkDirectory()
throws CommandContext.Fault
CommandContext.Fault - if there is a problem determining the work directory from
the available parameterssetWorkDirectory(java.io.File)
public void setWorkDirectory(java.io.File path)
throws CommandContext.Fault
path - the path for the work directory to be associated with this object
CommandContext.Fault - if the work directory has already been setgetWorkDirectory()
public void setWorkDirectory(java.io.File path,
boolean create)
throws CommandContext.Fault
path - the path for the work directory to be associated with this objectcreate - create the work directory if it does not already exist
CommandContext.Fault - if the work directory has already been setgetWorkDirectory()
public void setWorkDirectory(WorkDirectory wd)
throws CommandContext.Fault,
TestSuite.Fault
wd - the work directory to be associated with this object
CommandContext.Fault - if there is a problem evaluating related
parameters, such as a configuration file or template, or a
test suite.
TestSuite.Fault - if there is a problem evaluating related
parameters.
CommandContext.Fault - if the work directory has already
been set to something elsegetWorkDirectory()
public InterviewParameters getInterviewParameters()
throws CommandContext.Fault
CommandContext.Fault - if there is a problem evaluating the parameters
that define the configurationgetConfig(),
setInterviewParameters(com.sun.javatest.InterviewParameters)
public InterviewParameters getConfig()
throws CommandContext.Fault
CommandContext.Fault - if there is a problem evaluating the parameters
that define the configurationsetConfig(java.io.File)public boolean hasConfig()
public void setConfig(java.io.File path)
throws CommandContext.Fault
path - the path for the configuration information to be associated
with this object.
CommandContext.Fault - if the configuration has already been evaluatedgetConfig()
public void setInterviewParameters(InterviewParameters p)
throws CommandContext.Fault
p - the configuration to be associated with this object
CommandContext.Fault - if the configuration is incompatible with
other parameters that have previously been set up, such as
the test suite and work directory.setConfig(java.io.File),
getInterviewParameters()public boolean isDesktopRequired()
public void setDesktop(Desktop d)
d - the desktop to be associated with this object
java.lang.NullPointerException - if the argument is nullgetDesktop()public Desktop getDesktop()
setDesktop(com.sun.javatest.tool.Desktop)public void setVerboseMax(boolean on)
on - If true, the value of all other verbose options will
be given as true.public void setVerboseQuiet(boolean on)
on - If true, the value of all other verbose options will
be given as false.public void setVerboseTimestampEnabled(boolean on)
on - False for no timestamps.
public void setVerboseOptionValue(java.lang.String name,
boolean on)
name - the name of the verbose optionon - the value of the verbose optiongetVerboseOptionValue(java.lang.String)public boolean getVerboseOptionValue(java.lang.String name)
name - the name of the verbose option
setVerboseOptionValue(java.lang.String, boolean)
public boolean getVerboseOptionValue(java.lang.String name,
boolean defaultValue)
name - the name of the verbose optiondefaultValue - the default value to be used if necessary
setVerboseOptionValue(java.lang.String, boolean)public boolean isVerboseOptionSet(java.lang.String name)
name - the name of the option to be checked
public boolean isVerboseTimestampEnabled()
setVerboseTimestampEnabled(boolean)public void setPreferredLookAndFeel(int lookAndFeel)
lookAndFeel - LookAndFeel code to be setgetPreferredLookAndFeel(),
DEFAULT_LAF,
METAL_LAF,
NIMBUS_LAF,
SYSTEM_LAFpublic int getPreferredLookAndFeel()
#setPreferredLookAndFeel(java.lang.String),
DEFAULT_LAF,
METAL_LAF,
NIMBUS_LAF,
SYSTEM_LAFpublic void setLogWriter(java.io.PrintWriter out)
out - the log stream to be associated with this objectgetLogWriter()public java.io.PrintWriter getLogWriter()
setLogWriter(java.io.PrintWriter)
public void printMessage(I18NResourceBundle i18n,
java.lang.String key)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundlesetLogWriter(java.io.PrintWriter)
public void printMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundlearg - an argument to be formatted into the localized messagesetLogWriter(java.io.PrintWriter)
public void printMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundleargs - an array of arguments to be formatted into the localized messagesetLogWriter(java.io.PrintWriter)
public void printErrorMessage(I18NResourceBundle i18n,
java.lang.String key)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundlesetLogWriter(java.io.PrintWriter)
public void printErrorMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object arg)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundlearg - an argument to be formatted into the localized messagesetLogWriter(java.io.PrintWriter)
public void printErrorMessage(I18NResourceBundle i18n,
java.lang.String key,
java.lang.Object[] args)
i18n - the resource bundle containing the localized text of the messagekey - the key for the required message in the bundleargs - an array of arguments to be formatted into the localized messagesetLogWriter(java.io.PrintWriter)public void dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||