|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object abbot.script.Step abbot.script.Call abbot.script.Launch
public class Launch
Provides scripted static method invocation. Usage:
<launch class="package.class" method="methodName" args="..."
classpath="..." [threaded=true]>
The args attribute is a comma-separated list of arguments to pass to the class method, and may use square brackets to denote an array, e.g. "[one,two,three]" will be interpreted as an array length 3 of String. The square brackets may be escaped ('\[' or '\]') to include them literally in an argument.
The class path attribute may use either colon or semicolon as a path separator, but should preferably use relative paths to avoid making the containing script platform- and location-dependent.
In most cases, the classes under test will only be found under the custom class path, and so the parent class loader will fail to find them. If this is the case then the classes under test will be properly discarded on each launch when a new class loader is created.
The 'threaded' attribute is provided in case your code under test requires GUI event processing prior to returning from its invoked method. An example might be a main method which invokes dialog and waits for the response before continuing. In general, it's better to refactor the code if possible so that the main method turns over control to the event dispatch thread as soon as possible. Otherwise, if the application under test is background threaded by the Launch step, any runtime exceptions thrown from the launch code will cause errors in the launch step out of sequence with the other script steps. While this won't cause any problems for the Abbot framework, it can be very confusing for the user.
Note that if the "reload" attribute is set true (i.e. Abbot's class loader is used to reload code under test), ComponentTester extensions must also be loaded by that class loader, so the path to extensions should be included in the Launch class path.
Nested Class Summary | |
---|---|
static interface |
Launch.ThreadedLaunchListener
|
Field Summary |
---|
Fields inherited from interface abbot.script.XMLConstants |
---|
TAG_ACTION, TAG_APPLETVIEWER, TAG_ARCHIVE, TAG_ARGS, TAG_ASSERT, TAG_AWT, 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_EXPR, TAG_FILENAME, TAG_FIXTURE, 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 | |
---|---|
Launch(Resolver resolver,
Map attributes)
|
|
Launch(Resolver resolver,
String description,
String className,
String methodName,
String[] args)
|
|
Launch(Resolver resolver,
String description,
String className,
String methodName,
String[] args,
String classpath,
boolean threaded)
|
Method Summary | |
---|---|
protected AppClassLoader |
createClassLoader()
|
boolean |
equivalent(UIContext context)
No two launches are ever considered equivalent. |
Map |
getAttributes()
Attributes to save in script. |
String |
getClasspath()
|
ClassLoader |
getContextClassLoader()
Return the class loader that uses the classpath defined in this step. |
String |
getDefaultDescription()
Return a reasonable default description for this script step. |
Hierarchy |
getHierarchy()
A context must maintain the same Hierarchy for the lifetime of
the fixture. |
Method |
getMethod()
Return the method to be used for invocation. |
protected Object |
getTarget(Method m)
Return the target for the method invocation. |
Class |
getTargetClass()
Get the class of the target of the method invocation. |
String |
getUsage()
Provide a usage String for this step. |
String |
getXMLTag()
Define the XML tag to use for this script step. |
protected void |
install()
Install the class loader context for the code being launched. |
boolean |
isLaunched()
|
boolean |
isThreaded()
|
void |
launch(StepRunner runner)
Launches the UI described by this Launch step,
using the given runner as controller/monitor. |
Class |
resolveClass(String className)
Overrides the default implementation to always use the class loader defined by this step. |
void |
runStep()
Implement the step's behavior here. |
void |
setClasspath(String cp)
|
void |
setThreaded(boolean thread)
|
void |
setThreadedLaunchListener(Launch.ThreadedLaunchListener l)
Set a listener to respond to events when the launch step is threaded. |
protected void |
synchronizedRunStep()
|
void |
terminate()
Perform steps necessary to remove any setup performed by this Launch step. |
Methods inherited from class abbot.script.Call |
---|
disambiguateMethod, evaluateParameter, evaluateParameters, getArgs, getArguments, getArgumentsDescription, getEncodedArguments, getMethodName, getMethods, getTargetClassName, invoke, resolveMethod, resolveMethods, setArguments, setArguments, setMethodName, setTargetClassName |
Methods inherited from class abbot.script.Step |
---|
addAttributes, addContent, createAttributeMap, createStep, createStep, getDescription, getResolver, parseStepAttributes, resolveTester, run, setDescription, setScriptError, simpleClassName, toEditableString, toString, toXML, toXMLString, usage, usage |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Launch(Resolver resolver, Map attributes)
public Launch(Resolver resolver, String description, String className, String methodName, String[] args)
public Launch(Resolver resolver, String description, String className, String methodName, String[] args, String classpath, boolean threaded)
Method Detail |
---|
public String getClasspath()
public void setClasspath(String cp)
public boolean isThreaded()
public void setThreaded(boolean thread)
protected AppClassLoader createClassLoader()
protected void install()
protected void synchronizedRunStep() throws Throwable
Throwable
public void terminate()
Launch
step.
terminate
in interface UIContext
public void launch(StepRunner runner) throws Throwable
Launch
step,
using the given runner as controller/monitor.
launch
in interface UIContext
Throwable
public boolean isLaunched()
isLaunched
in interface UIContext
public Hierarchy getHierarchy()
UIContext
Hierarchy
for the lifetime of
the fixture.
getHierarchy
in interface UIContext
public void runStep() throws Throwable
Step
runStep
in class Call
Throwable
public Class resolveClass(String className) throws ClassNotFoundException
resolveClass
in class Step
ClassNotFoundException
public ClassLoader getContextClassLoader()
getContextClassLoader
in interface UIContext
ClassLoader
providing access to classes in this
context.public Class getTargetClass() throws ClassNotFoundException
Call
getTargetClass
in class Call
ClassNotFoundException
protected Object getTarget(Method m)
getTarget
in class Call
public Method getMethod() throws ClassNotFoundException, NoSuchMethodException
getMethod
in class Call
ClassNotFoundException
NoSuchMethodException
public Map getAttributes()
Call
getAttributes
in class Call
public String getDefaultDescription()
Step
getDefaultDescription
in class Call
public String getUsage()
Step
getUsage
in class Call
public String getXMLTag()
Step
getXMLTag
in class Call
public void setThreadedLaunchListener(Launch.ThreadedLaunchListener l)
public boolean equivalent(UIContext context)
UIContext
, use a Fixture
.
equivalent
in interface UIContext
UIContext
is equivalent to another.UIContext.equivalent(abbot.script.UIContext)
,
StepRunner.run(Step)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |