com.jayway.android.robotium.remotecontrol.client
Class MessengerRunner

java.lang.Object
  extended by com.jayway.android.robotium.remotecontrol.client.MessengerRunner
All Implemented Interfaces:
MessengerListener, java.lang.Runnable, DebugListener, NamedListener

public class MessengerRunner
extends java.lang.Object
implements MessengerListener, java.lang.Runnable

It is used to handle the messages from 'TCP Messenger' in a separated Thread.

See Also:
AbstractTestRunner, RobotiumTestRunner

Field Summary
static java.lang.String listenerName
           
 
Constructor Summary
MessengerRunner(Messenger mService)
           
MessengerRunner(Messenger mService, CommandListener commandListener)
           
 
Method Summary
 void debug(java.lang.String message)
           
 CommandListener getCommandListener()
           
 DebugListener getDebugListener()
           
 java.lang.String getListenerName()
          Unique name to identify the listener.
 Messenger getmService()
           
 void onReceiveDebug(java.lang.String message)
          A remote client has sent a Debug message to be logged by the listener.
 void onRemoteConnected()
           
 void onRemoteDisconnected()
           
 void onRemoteDispatchFile(java.lang.String message)
           
 void onRemoteDispatchProps(java.util.Properties props)
           
 void onRemoteEngineShutdown()
          Remote request/command to tell the engine to perform a normal shutdown.
 void onRemoteMessage(java.lang.String message)
           
 void onRemoteShutdown()
          Notification that the Remote Controller has shutdown and is no longer available.
 void onServiceShutdown()
          Notification that the Messenger Service has shutdown and is no longer available.
 void prepareNotification(int what)
          MessengerHandler preparing information for Thread switching.
 void run()
          Primary looping test thread remains active for as long as we are bound to a TCP Messenger Service.
 void setCommandListener(CommandListener commandListener)
           
 void setDebugListener(DebugListener debugListener)
           
 void setmService(Messenger mService)
           
 boolean start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listenerName

public static final java.lang.String listenerName
See Also:
Constant Field Values
Constructor Detail

MessengerRunner

public MessengerRunner(Messenger mService)

MessengerRunner

public MessengerRunner(Messenger mService,
                       CommandListener commandListener)
Method Detail

getListenerName

public java.lang.String getListenerName()
Description copied from interface: NamedListener
Unique name to identify the listener.

Specified by:
getListenerName in interface NamedListener
Returns:
name of listener. Might be null.

getmService

public Messenger getmService()

setmService

public void setmService(Messenger mService)

getCommandListener

public CommandListener getCommandListener()

setCommandListener

public void setCommandListener(CommandListener commandListener)

getDebugListener

public DebugListener getDebugListener()

setDebugListener

public void setDebugListener(DebugListener debugListener)

debug

public void debug(java.lang.String message)

onReceiveDebug

public void onReceiveDebug(java.lang.String message)
Description copied from interface: DebugListener
A remote client has sent a Debug message to be logged by the listener.

Specified by:
onReceiveDebug in interface DebugListener

prepareNotification

public void prepareNotification(int what)
MessengerHandler preparing information for Thread switching.

Specified by:
prepareNotification in interface MessengerListener

onRemoteDispatchProps

public void onRemoteDispatchProps(java.util.Properties props)
Specified by:
onRemoteDispatchProps in interface MessengerListener

onRemoteDispatchFile

public void onRemoteDispatchFile(java.lang.String message)
Specified by:
onRemoteDispatchFile in interface MessengerListener

onRemoteMessage

public void onRemoteMessage(java.lang.String message)
Specified by:
onRemoteMessage in interface MessengerListener

onRemoteConnected

public void onRemoteConnected()
Specified by:
onRemoteConnected in interface MessengerListener

onRemoteDisconnected

public void onRemoteDisconnected()
Specified by:
onRemoteDisconnected in interface MessengerListener

onRemoteShutdown

public void onRemoteShutdown()
Notification that the Remote Controller has shutdown and is no longer available.

Specified by:
onRemoteShutdown in interface MessengerListener

onServiceShutdown

public void onServiceShutdown()
Notification that the Messenger Service has shutdown and is no longer available.

Specified by:
onServiceShutdown in interface MessengerListener

onRemoteEngineShutdown

public void onRemoteEngineShutdown()
Remote request/command to tell the engine to perform a normal shutdown.

Specified by:
onRemoteEngineShutdown in interface MessengerListener

run

public void run()
Primary looping test thread remains active for as long as we are bound to a TCP Messenger Service. Synchronizes with the Message handler waiting for new valid instructions then routes test actions according to the content of the data received via the Messenger.

Specified by:
run in interface java.lang.Runnable

start

public boolean start()

stop

public void stop()