Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.jemmy
Class ActionProducer

    java.lang.Object
      |
      +--java.lang.Thread
            |
            +--org.netbeans.jemmy.ActionProducer

All Implemented Interfaces:
  Action, java.lang.Runnable, Timeoutable, Waitable

Direct Known Subclasses:
  Test

public class ActionProducer
extends java.lang.Thread
implements Action, Waitable, Timeoutable

Runs actions with or without waiting.
Timeouts used:
ActionProducer.MaxActionTime - time action should be finished in.

Author:
  Alexandre Iline (alexandre.iline@sun.com)
See Also:
  `Action`, `Timeouts`

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`protected` | `ActionProducer()` Creates a producer.
`` | `ActionProducer(Action a)` Creates a producer for an action.
`` | `ActionProducer(Action a, boolean nw)` Creates a producer for an action.
`protected` | `ActionProducer(boolean nw)` Creates a producer.

Method Summary
`java.lang.Object` | `actionProduced(java.lang.Object obj)` Inquire for a reference to the object returned by a launched action.
`java.lang.String` | `getDescription()` Returns the description value.
`java.lang.Throwable` | `getException()` Returns the exception value.
`boolean` | `getFinished()` Check if a launched action has finished.
`java.lang.Object` | `getResult()` Get the result of a launched action.
`Timeouts` | `getTimeouts()` Get all the time outs used by sleeps or waits used by the launched action.
`java.lang.Object` | `launch(java.lang.Object obj)` Does nothing; the method should be overridden by inheritors.
`java.lang.Object` | `produceAction(java.lang.Object obj)` Starts execution.
`void` | `run()` Launch an action in a separate thread of execution.
`void` | `setActionPriority(int newPriority)` Defines action priority in terms of thread priority.
`void` | `setOutput(TestOut out)` 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, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ActionProducer

    public ActionProducer(Action a)

  Creates a producer for an action.
  Parameters:
    `a` - Action implementation.

### ActionProducer

    public ActionProducer(Action a,
                          boolean nw)

  Creates a producer for an action.
  Parameters:
    `a` - Action implementation.
    `nw` - Defines if `produceAction` 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 if `produceAction` method should wait for the end of action.

Method Detail

### setTimeouts

    public void setTimeouts(Timeouts ts)

  Set all the time outs used by sleeps or waits used by the launched action.
  Specified by:
    `setTimeouts` in interface `Timeoutable`
  Parameters:
    `ts` - An object containing timeout information.
  See Also:
    `Timeouts`, `Timeoutable`, `getTimeouts()`

### getTimeouts

    public Timeouts getTimeouts()

  Get all the time outs used by sleeps or waits used by the launched action.
  Specified by:
    `getTimeouts` in interface `Timeoutable`
  Returns:
    an object containing information about timeouts.
  See Also:
    `Timeouts`, `Timeoutable`, `setTimeouts(org.netbeans.jemmy.Timeouts)`

### setOutput

    public void setOutput(TestOut out)

  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:
    `TestOut`, `Outputable`

### getException

    public java.lang.Throwable 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

    public java.lang.Object getResult()

  Get the result of a launched action.
  Returns:
    a launched action's result. without waiting in case if `getFinished()`
  See Also:
    `getFinished()`

### 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

    public java.lang.Object launch(java.lang.Object obj)

  Does nothing; the method should be overridden by inheritors.
  Specified by:
    `launch` in interface `Action`
  Parameters:
    `obj` - An object used to modify execution. This might be a `java.lang.String[]` that lists a test's command line arguments.
  Returns:
    An object - result of the action.
  See Also:
    `Action`

### getDescription

    public java.lang.String getDescription()

  Description copied from interface: `Action`
  Returns the description value.
  Specified by:
    `getDescription` in interface `Action`
  Returns:
    this `ActionProducer`'s description.
  See Also:
    `Action`

### produceAction

    public java.lang.Object produceAction(java.lang.Object obj)
                                   throws java.lang.InterruptedException

  Starts execution. Uses ActionProducer.MaxActionTime timeout.
  Parameters:
    `obj` - Parameter to be passed into action's `launch(Object)` method. This parameter might be a `java.lang.String[]` that lists a test's command line arguments.
  Returns:
    `launch(Object)` result.
  Throws:
    `TimeoutExpiredException` -
    `java.lang.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. Use `getFinished()` and `getResult` to answer questions about test completion and return value, respectively.
  Overrides:
    `run` in class `java.lang.Thread`
  See Also:
    `getFinished()`, `getResult()`, `Runnable`

### actionProduced

    public final java.lang.Object actionProduced(java.lang.Object obj)

  Inquire for a reference to the object returned by a launched action.
  Specified by:
    `actionProduced` in interface `Waitable`
  Parameters:
    `obj` - Not used.
  Returns:
    the result returned when a launched action finishes normally.
  See Also:
    `Waitable`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD