Package org.netbeans.jemmy
Class ActionProducer
java.lang.Object
java.lang.Thread
org.netbeans.jemmy.ActionProducer
- All Implemented Interfaces:
Runnable
,Action
,Timeoutable
,Waitable
- Direct Known Subclasses:
Test
Runs actions with or without waiting.
Timeouts used:
ActionProducer.MaxActionTime - time action should be finished in.
Timeouts used:
ActionProducer.MaxActionTime - time action should be finished in.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Creates a producer.protected
ActionProducer
(boolean nw) Creates a producer.Creates a producer for an action.ActionProducer
(Action a, boolean nw) Creates a producer for an action. -
Method Summary
Modifier and TypeMethodDescriptionfinal Object
actionProduced
(Object obj) Inquire for a reference to the object returned by a launched action.Returns the description value.Returns the exception value.boolean
Check if a launched action has finished.Get the result of a launched action.Get all the time outs used by sleeps or waits used by the launched action.Does nothing; the method should be overridden by inheritors.produceAction
(Object obj) Starts execution.final void
run()
Launch an action in a separate thread of execution.void
setActionPriority
(int newPriority) Defines action priority in terms of thread priority.void
Identity of the streams or writers used for print output.void
setTimeouts
(Timeouts ts) Set all the time outs used by sleeps or waits used by the launched action.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Constructor Details
-
ActionProducer
Creates a producer for an action.- Parameters:
a
- Action implementation.
-
ActionProducer
Creates a producer for an action.- Parameters:
a
- Action implementation.nw
- Defines ifproduceAction
method should wait for the end of action.
-
ActionProducer
protected ActionProducer()Creates a producer.produceAction
must be overridden. -
ActionProducer
protected ActionProducer(boolean nw) Creates a producer.produceAction
must be overridden.- Parameters:
nw
- Defines ifproduceAction
method should wait for the end of action.
-
-
Method Details
-
setTimeouts
Set all the time outs used by sleeps or waits used by the launched action.- Specified by:
setTimeouts
in interfaceTimeoutable
- Parameters:
ts
- An object containing timeout information.- See Also:
-
getTimeouts
Get all the time outs used by sleeps or waits used by the launched action.- Specified by:
getTimeouts
in interfaceTimeoutable
- Returns:
- an object containing information about timeouts.
- See Also:
-
setOutput
Identity of the streams or writers used for print output.- Parameters:
out
- An object containing print output assignments for output and error streams.- See Also:
-
getException
Returns the exception value.- Returns:
- a Throwable object representing the exception value
-
setActionPriority
public void setActionPriority(int newPriority) Defines action priority in terms of thread priority. Increase (decrease) parameter value to Thread.MIN_PRIORITY(MAX_PRIORITY) in case if it is less(more) then it.- Parameters:
newPriority
- New thread priority.
-
getResult
Get the result of a launched action.- Returns:
- a launched action's result.
without waiting in case if
getFinished()
- See Also:
-
getFinished
public boolean getFinished()Check if a launched action has finished.- Returns:
true
if the launched action has completed, either normally or with an exception;false
otherwise.
-
launch
Does nothing; the method should be overridden by inheritors. -
getDescription
Description copied from interface:Action
Returns the description value.- Specified by:
getDescription
in interfaceAction
- Specified by:
getDescription
in interfaceWaitable
- Returns:
- this
ActionProducer
's description. - See Also:
-
produceAction
Starts execution. Uses ActionProducer.MaxActionTime timeout.- Parameters:
obj
- Parameter to be passed into action'slaunch(Object)
method. This parameter might be ajava.lang.String[]
that lists a test's command line arguments.- Returns:
launch(Object)
result.- Throws:
TimeoutExpiredException
InterruptedException
-
run
public final void run()Launch an action in a separate thread of execution. When the action finishes, record that fact. If the action finishes normally, store it's result. UsegetFinished()
andgetResult
to answer questions about test completion and return value, respectively. -
actionProduced
Inquire for a reference to the object returned by a launched action.- Specified by:
actionProduced
in interfaceWaitable
- Parameters:
obj
- Not used.- Returns:
- the result returned when a launched action finishes normally.
- See Also:
-