API Documentation | All Packages | All Classes | Index | Frames No Frames |
AsyncListenerWatcher

Package | org.flexunit.runner.notification.async
Class | public class AsyncListenerWatcher
Inheritance | AsyncListenerWatcher Object

The `AsyncListenerWatcher` is responsible for determing whether all `IAsyncStartupRunListener`s that it is watching are ready. This is used in order to make sure that all potential `IAsyncStartupRunListener`s that are used in a test run are ready before the test run begins. In order to track a `IAsyncStartupRunListener`, the listener must be watched by calling the `#watchListener()` method. Once a listener is being watched, it will be counted as a pending listener. Once the lister reports that it is ready or it has failed, it will be removed as a pending listener. Once all listeners are no longer pending, the test run can begin. In order to unwatch a listener, the `#unwatchListener()` method needs to be called, providing the method with the `IAsyncStartupRunListener` to stop watching.

Public Properties

| Property | Defined By
--- | --- | ---
|  | allListenersComplete : Boolean [read-only] Returns a Boolean value indicating whether all are complete | AsyncListenerWatcher
|  | allListenersReady : Boolean [read-only] Returns a Boolean value indicating whether all listeners are ready | AsyncListenerWatcher
|  | completeToken : AsyncCoreStartupToken [read-only] Returns the complete AsyncCoreStartupToken | AsyncListenerWatcher
|  | pendingCount : int [read-only] Returns the number of pending start ups | AsyncListenerWatcher
|  | startUpToken : AsyncCoreStartupToken [read-only] Returns the start up AsyncCoreStartupToken | AsyncListenerWatcher
|  | totalCount : int [read-only] Returns the number of total start ups | AsyncListenerWatcher

Public Methods

| Method | Defined By
--- | --- | ---
|  | AsyncListenerWatcher(notifier:IRunNotifier, logger:*) Constructor. | AsyncListenerWatcher
|  | unwatchListener(listener:IAsyncStartupRunListener):void Makes the AsyncListenerWatcher stop watching the provided IAsyncStartupRunListener | AsyncListenerWatcher
|  | watchListener(listener:IAsyncStartupRunListener):void Makes the AsyncListenerWatcher start watching the provided IAsyncStartupRunListener | AsyncListenerWatcher

Protected Methods

| Method | Defined By
--- | --- | ---
|  | cleanupStartupListeners(listener:IAsyncStartupRunListener):void Stop monitoring the IAsyncStartupRunListener | AsyncListenerWatcher
|  | handleListenerFailed(event:Event):void Stops listening when the listener will be ready, removes the listener from the IRunNotifier. | AsyncListenerWatcher
|  | handleListenerReady(event:Event):void Stops listening when the listener will be ready and determines if all other listeners are ready | AsyncListenerWatcher
|  | monitorForAsyncStartup(listener:IAsyncStartupRunListener):void Monitors the IAsyncStartupRunListener to determine if the listener is ready or if the listener has failed | AsyncListenerWatcher
|  | sendReadyNotification():void Instruct the start up token that all listeners are now ready | AsyncListenerWatcher

Public Constants

| Constant | Defined By
--- | --- | ---
|  | LISTENER_COMPLETE : String = listenerComplete [static] | AsyncListenerWatcher
|  | LISTENER_FAILED : String = listenerFailed [static] | AsyncListenerWatcher
|  | LISTENER_READY : String = listenerReady [static] | AsyncListenerWatcher

Property Detail

allListenersComplete | property

`allListenersComplete:Boolean` [read-only]

Returns a Boolean value indicating whether all are complete

Implementation
`public function get allListenersComplete():Boolean`

allListenersReady | property |

`allListenersReady:Boolean` [read-only]

Returns a Boolean value indicating whether all listeners are ready

Implementation
`public function get allListenersReady():Boolean`

completeToken | property |

`completeToken:AsyncCoreStartupToken` [read-only]

Returns the complete `AsyncCoreStartupToken`

Implementation
`public function get completeToken():AsyncCoreStartupToken`

pendingCount | property |

`pendingCount:int` [read-only]

Returns the number of pending start ups

Implementation
`public function get pendingCount():int`

startUpToken | property |

`startUpToken:AsyncCoreStartupToken` [read-only]

Returns the start up `AsyncCoreStartupToken`

Implementation
`public function get startUpToken():AsyncCoreStartupToken`

totalCount | property |

`totalCount:int` [read-only]

Returns the number of total start ups

Implementation
`public function get totalCount():int`
Constructor Detail

AsyncListenerWatcher | () | Constructor

`public function AsyncListenerWatcher(notifier:IRunNotifier, logger:*)`

Constructor.

Parameters

| `notifier:IRunNotifier`
| `logger:*`

Method Detail

cleanupStartupListeners | () | method

`protected function cleanupStartupListeners(listener:IAsyncStartupRunListener):void`

Stop monitoring the `IAsyncStartupRunListener`

Parameters

| `listener:IAsyncStartupRunListener` — The `IAsyncStartupRunListener` to stop listening to

handleListenerFailed | () | method |

`protected function handleListenerFailed(event:Event):void`

Stops listening when the listener will be ready, removes the listener from the `IRunNotifier`. and determines if all other listeners are ready

Parameters

| `event:Event`

handleListenerReady | () | method |

`protected function handleListenerReady(event:Event):void`

Stops listening when the listener will be ready and determines if all other listeners are ready

Parameters

| `event:Event`

monitorForAsyncStartup | () | method |

`protected function monitorForAsyncStartup(listener:IAsyncStartupRunListener):void`

Monitors the `IAsyncStartupRunListener` to determine if the listener is ready or if the listener has failed

Parameters

| `listener:IAsyncStartupRunListener` — The `IAsyncStartupRunListener` to listen to

sendReadyNotification | () | method |

`protected function sendReadyNotification():void`

Instruct the start up token that all listeners are now ready

unwatchListener | () | method |

`public function unwatchListener(listener:IAsyncStartupRunListener):void`

Makes the AsyncListenerWatcher stop watching the provided `IAsyncStartupRunListener`

Parameters

| `listener:IAsyncStartupRunListener` — The `IAsyncStartupRunListener` to stop watching

watchListener | () | method |

`public function watchListener(listener:IAsyncStartupRunListener):void`

Makes the AsyncListenerWatcher start watching the provided `IAsyncStartupRunListener`

Parameters

| `listener:IAsyncStartupRunListener` — The `IAsyncStartupRunListener` to watch

Constant Detail

LISTENER_COMPLETE | Constant

`public static const LISTENER_COMPLETE:String = listenerComplete`

LISTENER_FAILED | Constant |

`public static const LISTENER_FAILED:String = listenerFailed`

LISTENER_READY | Constant |

`public static const LISTENER_READY:String = listenerReady`

Thu Apr 10 2014, 08:07 AM +10:00