|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectabbot.script.Step
abbot.script.Sequence
abbot.script.Script
Provide a structure to encapsulate actions invoked on GUI components and tests performed on those components. Scripts need to be short and concise (and therefore easy to read/write). Extensions don't have to be.
This takes a single filename as a constructor argument.
Use ScriptTestCase and ScriptTestSuite to generate a suite (auto-generate the collection).
| Field Summary | |
(package private) static boolean |
validate
|
| Fields inherited from interface abbot.script.XMLConstants |
TAG_ACTION, TAG_APPLETVIEWER, TAG_ARCHIVE, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_BORDER_TITLE, TAG_CALL, TAG_CLASS, TAG_CLASSPATH, TAG_CODE, TAG_CODEBASE, TAG_COMMENT, TAG_COMPONENT, TAG_COUNT, TAG_DELEGATE, TAG_DESC, TAG_DOCBASE, TAG_EVENT, TAG_FILENAME, TAG_FORKED, TAG_HEIGHT, TAG_HORDER, TAG_ICON, TAG_ID, TAG_INDEX, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LABEL, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARAMS, TAG_PARENT, TAG_POLL_INTERVAL, TAG_PROPERTY, TAG_ROOT, TAG_SAMPLE, TAG_SCRIPT, TAG_SEQUENCE, TAG_SLOW, TAG_STOP_ON_ERROR, TAG_STOP_ON_FAILURE, TAG_TAG, TAG_TERMINATE, TAG_TEXT, TAG_THREADED, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_VMARGS, TAG_VORDER, TAG_WAIT, TAG_WEIGHTED, TAG_WIDTH, TAG_WINDOW, TAG_X, TAG_Y |
| Constructor Summary | |
Script()
Deprecated. Use an explicit hierarchy instead. |
|
Script(Hierarchy h)
|
|
Script(Resolver parent,
Map attributes)
|
|
Script(String filename)
Deprecated. Use an explicit hierarchy instead. |
|
Script(String filename,
Hierarchy h)
Create a script. |
|
| Method Summary | |
ComponentReference |
addComponent(Component comp)
Add a new component reference for the given component. |
void |
addComponentReference(ComponentReference ref)
Add a component reference directly, replacing any existing one with the same ID. |
(package private) ComponentReference |
addComponentReference(org.jdom.Element el)
Add a new component reference to the script. |
org.jdom.Element |
addContent(org.jdom.Element el)
Save component references in addition to everything else. |
void |
addStep(int index,
Step step)
Inserts a step at the given index in the sequence. |
void |
addStep(Step step)
Adds a step to the end of the sequence. |
void |
changeFile(File file)
Change the file system basis for the current script. |
void |
clear()
Set up a blank script, discarding any current state. |
static int |
countLines(Sequence seq,
int index)
Return the number of XML lines in the given sequence that precede the given index. |
protected ComponentReference |
findExistingReference(Component comp)
Return the reference for the given component, or null if none yet exists. |
Map |
getAttributes()
Provide XML attributes for this Step. |
ComponentReference |
getComponentReference(Component comp)
Return the reference for the given component, or null if none yet exists. |
ComponentReference |
getComponentReference(String name)
Convert the given reference ID into a component reference. |
Collection |
getComponentReferences()
Returns a collection of all the existing references. |
String |
getContext(Step step)
Return a meaningful description of where the Step came from. |
ClassLoader |
getContextClassLoader()
Return the class loader for use in this context. |
String |
getDefaultDescription()
Return a reasonable default description for this script step. |
String |
getDescription()
|
File |
getDirectory()
All relative files should be accessed relative to this directory, which is the directory where the script resides. |
File |
getFile()
Return the file where this script is saved. |
static File |
getFile(Step step)
Return the file which defines the given step. |
String |
getFilename()
Return the (possibly relative) path to this script. |
Hierarchy |
getHierarchy()
Get the component corresponding to the given reference. |
Launch |
getLaunchStep()
|
static int |
getLine(Step step)
Return the approximate line number of the given step. |
String |
getName()
|
String |
getProperty(String name)
Provide retrieval of values from temporary storage. |
File |
getRelativeTo()
By default, all pathnames are relative to the current working directory. |
Step |
getStep(int index)
Return the step at the given index in the sequence. |
String |
getUniqueID(ComponentReference ref)
Return a unique reference ID. |
String |
getUsage()
Returns a string describing the proper XML usage for this class. |
String |
getVMArgs()
|
String |
getXMLTag()
Define the XML tag to use for this script step. |
boolean |
hasLaunch()
|
boolean |
hasTerminate()
|
int |
indexOf(Step step)
Returns the index of the given step in the sequence, or -1 if the step is not in the sequence. |
boolean |
isDirty()
Has this script changed since the last save. |
boolean |
isForked()
|
static boolean |
isScript(File file)
Return whether the given file looks like a valid AWT script. |
boolean |
isSlowPlayback()
|
void |
load()
Parse the script file and build internal structures. |
void |
load(Reader reader)
Loads the XML test script. |
protected void |
parseChild(org.jdom.Element el)
|
void |
removeStep(int index)
Removes the step at the given index in the sequence. |
void |
removeStep(Step step)
Removes the step if it exists in the sequence. |
protected void |
runStep(StepRunner runner)
Process each event in our list, using the given runner. |
void |
save()
Write the script to file. |
void |
save(Writer writer)
Write the current state of the script to file. |
void |
setFile(File file)
Set the file system basis for this script object. |
void |
setForked(boolean fork)
|
void |
setHierarchy(Hierarchy h)
|
void |
setProperty(String name,
String value)
Provide temporary storage of String values. |
void |
setRelativeTo(File dir)
Indicate that when invoking toXML, a path relative to the given one should be shown. |
void |
setSlowPlayback(boolean slow)
|
void |
setStep(int index,
Step step)
Replaces the step at the given index. |
void |
setVMArgs(String args)
|
int |
size()
Returns the number of steps contained in this one. |
List |
steps()
Returns a list of the steps contained in this one. |
String |
toEditableString()
Only thing directly editable on a script is its file path. |
String |
toString()
Return a description of this script step. |
| Methods inherited from class abbot.script.Sequence |
parseChildren, runStep |
| Methods inherited from class abbot.script.Step |
addAttributes, createAttributeMap, createStep, createStep, getResolver, parseStepAttributes, resolveClass, resolveTester, run, setDescription, setScriptError, simpleClassName, toXML, toXMLString, usage, usage |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
static boolean validate
| Constructor Detail |
public Script()
public Script(String filename)
public Script(Hierarchy h)
public Script(String filename,
Hierarchy h)
public Script(Resolver parent,
Map attributes)
| Method Detail |
public void setHierarchy(Hierarchy h)
public String getName()
public void setForked(boolean fork)
public boolean isForked()
public void setVMArgs(String args)
public String getVMArgs()
public boolean isSlowPlayback()
public void setSlowPlayback(boolean slow)
public File getFile()
public void changeFile(File file)
public void setFile(File file)
public void save(Writer writer)
throws IOException
IOExceptionpublic String toEditableString()
toEditableString in interface XMLifiabletoEditableString in class Sequencepublic boolean isDirty()
public void save()
throws IOException
IOException
protected void parseChild(org.jdom.Element el)
throws InvalidScriptException
parseChild in class SequenceInvalidScriptException
public void load(Reader reader)
throws InvalidScriptException,
IOException
reader - Provides the script data
InvalidScriptException
IOExceptionpublic int size()
Sequence
size in class Sequencepublic List steps()
Sequence
steps in class Sequencepublic int indexOf(Step step)
Sequence
indexOf in class Sequencepublic Step getStep(int index)
Sequence
getStep in class Sequence
public void addStep(int index,
Step step)
Sequence
addStep in class Sequencepublic void addStep(Step step)
Sequence
addStep in class Sequence
public void setStep(int index,
Step step)
setStep in class Sequencepublic void removeStep(Step step)
Sequence
removeStep in class Sequencepublic void removeStep(int index)
Sequence
removeStep in class Sequence
public void load()
throws InvalidScriptException,
IOException
InvalidScriptException
IOExceptionpublic String getXMLTag()
Step
getXMLTag in class Sequencepublic org.jdom.Element addContent(org.jdom.Element el)
addContent in class Sequencepublic String getFilename()
public Map getAttributes()
getAttributes in class Step
protected void runStep(StepRunner runner)
throws Throwable
Sequence
runStep in class SequenceThrowablepublic String getUniqueID(ComponentReference ref)
getUniqueID in interface Resolverpublic void clear()
clear in class Sequencepublic String getUsage()
Sequence
getUsage in class Sequencepublic String getDescription()
getDescription in class Steppublic String getDefaultDescription()
Step
getDefaultDescription in class Sequencepublic String toString()
Step
toString in class Steppublic boolean hasLaunch()
public boolean hasTerminate()
public File getRelativeTo()
public void setRelativeTo(File dir)
public static boolean isScript(File file)
public Launch getLaunchStep()
public File getDirectory()
getDirectory in interface Resolverpublic Collection getComponentReferences()
Resolver
getComponentReferences in interface Resolverpublic void addComponentReference(ComponentReference ref)
addComponentReference in interface Resolverpublic ComponentReference addComponent(Component comp)
addComponent in interface Resolver
ComponentReference addComponentReference(org.jdom.Element el)
throws InvalidScriptException
InvalidScriptExceptionpublic ComponentReference getComponentReference(Component comp)
getComponentReference in interface Resolverprotected ComponentReference findExistingReference(Component comp)
public ComponentReference getComponentReference(String name)
getComponentReference in interface Resolver
public void setProperty(String name,
String value)
Resolver
setProperty in interface Resolverpublic String getProperty(String name)
Resolver
getProperty in interface Resolverpublic ClassLoader getContextClassLoader()
Resolver
getContextClassLoader in interface Resolverpublic Hierarchy getHierarchy()
Resolver
getHierarchy in interface Resolverpublic String getContext(Step step)
getContext in interface Resolverpublic static File getFile(Step step)
public static int getLine(Step step)
public static int countLines(Sequence seq,
int index)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||