junit.extensions.awt.script
Class ScriptStep

java.lang.Object
  |
  +--junit.extensions.awt.script.ScriptStep
All Implemented Interfaces:
Step, Tags, XMLifiable
Direct Known Subclasses:
MethodInvocation, SendEvent, StepSequence

public abstract class ScriptStep
extends java.lang.Object
implements Step

Encapsulate one step (line) from a script. Argument evaluation is deferred until the actual method invocation.


Fields inherited from interface junit.extensions.awt.script.Tags
TAG_ACTION, TAG_ARGS, TAG_ASSERT, TAG_AWTTESTSCRIPT, TAG_CLASS, TAG_COMPONENT, TAG_COUNT, TAG_DESC, TAG_EVENT, TAG_FILENAME, TAG_ID, TAG_INVERT, TAG_INVOKER, TAG_KEYCHAR, TAG_KEYCODE, TAG_KIND, TAG_LAUNCH, TAG_METHOD, TAG_MODIFIERS, TAG_NAME, TAG_PARENT, TAG_POLL_INTERVAL, TAG_SCRIPT, TAG_SEQUENCE, TAG_TAG, TAG_TERMINATE, TAG_TIMEOUT, TAG_TITLE, TAG_TRIGGER, TAG_TYPE, TAG_VALUE, TAG_WAIT, TAG_WINDOW, TAG_X, TAG_Y
 
Constructor Summary
ScriptStep(ComponentManager manager, java.util.HashMap attributes)
           
ScriptStep(ComponentManager manager, java.lang.String description)
           
 
Method Summary
static Step createStep(org.w3c.dom.Element el, ComponentManager manager)
          Factory method, equivalent to a "fromXML".
static Step createStep(java.lang.String xml, ComponentManager manager)
           
protected  java.lang.String getAttributes()
          Attributes to save in script.
protected  java.lang.String getContents()
          Override if the step actually has some contents.
protected abstract  java.lang.String getDefaultDescription()
          Return a reasonable default description for this script step.
protected  java.lang.String getDescription()
           
 java.lang.Throwable getError()
           
 junit.framework.AssertionFailedError getFailure()
           
protected  ComponentManager getManager()
           
protected  ComponentTester getTester()
           
protected abstract  java.lang.String getUsage()
          Provide a usage String for this step.
protected abstract  java.lang.String getXMLTag()
          Define the XML tag to use for this script step.
protected  java.awt.Component resolve(java.lang.String name)
          Resolve the given name into a component.
protected  ComponentTester resolveTester()
          Override this to provide a more specific tester.
 void run()
          Main run method, which stores any failures or exceptions for later retrieval.
protected abstract  void runStep()
          Define this function to perform the actual script step work.
protected  void setError(java.lang.Throwable thr)
           
protected  void setFailure(junit.framework.AssertionFailedError err)
           
 java.lang.String toString()
          Return a description of this script step.
 java.lang.String toXML()
          Convert the object to XML.
protected  void usage()
          Throw an invalid script exception describing the proper script usage.
protected  void usage(java.lang.String details)
          Throw an invalid script exception describing the proper script usage.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScriptStep

public ScriptStep(ComponentManager manager,
                  java.util.HashMap attributes)

ScriptStep

public ScriptStep(ComponentManager manager,
                  java.lang.String description)
Method Detail

getXMLTag

protected abstract java.lang.String getXMLTag()
Define the XML tag to use for this script step.

getUsage

protected abstract java.lang.String getUsage()
Provide a usage String for this step.

getDefaultDescription

protected abstract java.lang.String getDefaultDescription()
Return a reasonable default description for this script step. This value is used in the absence of an explicit description.

usage

protected void usage()
              throws InvalidScriptException
Throw an invalid script exception describing the proper script usage.

usage

protected void usage(java.lang.String details)
              throws InvalidScriptException
Throw an invalid script exception describing the proper script usage.

getAttributes

protected java.lang.String getAttributes()
Attributes to save in script. FIXME use a hash table?

resolve

protected java.awt.Component resolve(java.lang.String name)
                              throws ComponentNotFoundException
Resolve the given name into a component.

resolveTester

protected ComponentTester resolveTester()
Override this to provide a more specific tester.

getTester

protected ComponentTester getTester()

getDescription

protected java.lang.String getDescription()

getManager

protected ComponentManager getManager()

getError

public java.lang.Throwable getError()

setError

protected void setError(java.lang.Throwable thr)

getFailure

public junit.framework.AssertionFailedError getFailure()

setFailure

protected void setFailure(junit.framework.AssertionFailedError err)

runStep

protected abstract void runStep()
                         throws java.lang.Throwable
Define this function to perform the actual script step work.

run

public void run()
         throws java.lang.Throwable
Main run method, which stores any failures or exceptions for later retrieval.
Specified by:
run in interface Step

getContents

protected java.lang.String getContents()
Override if the step actually has some contents. In most cases, it wont't.

toXML

public java.lang.String toXML()
Convert the object to XML.
Specified by:
toXML in interface XMLifiable

toString

public java.lang.String toString()
Return a description of this script step.
Overrides:
toString in class java.lang.Object

createStep

public static Step createStep(java.lang.String xml,
                              ComponentManager manager)
                       throws InvalidScriptException

createStep

public static Step createStep(org.w3c.dom.Element el,
                              ComponentManager manager)
                       throws InvalidScriptException
Factory method, equivalent to a "fromXML".