com.jayway.android.robotium.remotecontrol.client.processor
Class SoloProcessor

java.lang.Object
  extended by com.jayway.android.robotium.remotecontrol.client.processor.AbstractProcessor
      extended by com.jayway.android.robotium.remotecontrol.client.processor.SoloProcessor
All Implemented Interfaces:
CacheReferenceInterface, ProcessorInterface

public class SoloProcessor
extends AbstractProcessor
implements CacheReferenceInterface

This class is used to process the "remote command" from the robotium-remote-control
The input parameters are in a Properties object, and the results will be put into
that properties object, which will be sent back to robotium-remote-control
They will be in key-value format in the properties object.
The key is defined as constant in SoloMessage
Refer to the following page to know what key to get and what key to set for each "command"
http://safsdev.sourceforge.net/doc/com/jayway/android/robotium/remotecontrol/solo/Solo.html

For example:
For command "assertCurrentActivityClass", at the Returns part, you can see
(in ):KEY_TARGET=target_solo
(in ):KEY_COMMAND=cmd_assertcurrentactivityclass
(out):KEY_ISREMOTERESULT=true
(out):KEY_REMOTERESULTCODE=String:int:0=success/normal=SoloMessage.STATUS_REMOTERESULT_OK
.....
When it marks a 'in', you should get; while it marks a 'out', you should set it with a result

Since:
Feb 16, 2012

Field Summary
protected  java.util.Hashtable<java.lang.String,Activity> activityCache
          local cache for containing the Activity Note: Don't manipulate it directly like activityCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor
protected  java.util.Hashtable<java.lang.String,ActivityMonitor> activityMonitorCache
          local cache for containing the ActivityMonitor Note: Don't manipulate it directly like activityMonitorCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor
static java.lang.String TAG
           
protected  java.util.Hashtable<java.lang.String,View> viewCache
          local cache for containing the View Note: Don't manipulate it directly like viewCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor
 
Fields inherited from class com.jayway.android.robotium.remotecontrol.client.processor.AbstractProcessor
INITIAL_CACHE_SIZE, remoteCommand, testRunner
 
Constructor Summary
SoloProcessor(RobotiumTestRunner robotiumTestrunner)
           
 
Method Summary
 void addCacheReferenceInterface(CacheReferenceInterface cache)
          CacheReferenceInterface implementation.
protected  boolean checkSolo()
          Test if the solo is null.
 void clearCache(boolean useChain)
          CacheReferenceInterface implementation.
protected  Bitmap getBitmapOfView(View view)
          Get bitmap image of a View.
This method call View#getDrawingCache() to get the bitmap image.
For some special views, we can't generate the bitmap by this way.
 java.lang.Object getCachedObject(java.lang.String key, boolean useChain)
          CacheReferenceInterface implementation.
 void processProperties(java.util.Properties props)
          Before calling this method, you should call setRemoteCommand()
 void removeCacheReferenceInterface(CacheReferenceInterface cache)
          CacheReferenceInterface implementation.
protected  void startMainLauncher(java.util.Properties props)
          This method will launch the main activity.
It will initialize the Solo object of RobotiumTestRunner
This Solo object will also be shared by this class
If you want to use the Solo object, you MUST call this method firstly.
 
Methods inherited from class com.jayway.android.robotium.remotecontrol.client.processor.AbstractProcessor
convertToDelimitedString, convertToKey, convertToKeys, convertToKeys, debug, getCachedItem, getStackTrace, getUniqueSeparator, makeUniqueCacheKey, processMessage, putCachedItem, removeCachedItem, resetExternalModeCache, setGeneralError, setGeneralError, setGeneralErrorWithSpecialInfo, setGeneralErrorWithSpecialInfo, setGeneralSuccess, setGeneralSuccess, setGeneralSuccessWithSpecialInfo, setGeneralWarningWithSpecialInfo, setRemoteCommand, stringIsMatched
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAG

public static java.lang.String TAG

activityMonitorCache

protected java.util.Hashtable<java.lang.String,ActivityMonitor> activityMonitorCache
local cache for containing the ActivityMonitor Note: Don't manipulate it directly like activityMonitorCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor

See Also:
AbstractProcessor.getCachedItem(Hashtable, Object), AbstractProcessor.removeCachedItem(Hashtable, Object), AbstractProcessor.putCachedItem(Hashtable, Object, Object)

activityCache

protected java.util.Hashtable<java.lang.String,Activity> activityCache
local cache for containing the Activity Note: Don't manipulate it directly like activityCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor

See Also:
AbstractProcessor.getCachedItem(Hashtable, Object), AbstractProcessor.removeCachedItem(Hashtable, Object), AbstractProcessor.putCachedItem(Hashtable, Object, Object)

viewCache

protected java.util.Hashtable<java.lang.String,View> viewCache
local cache for containing the View Note: Don't manipulate it directly like viewCache.get(key) etc.
Use the cache-manipulation-methods defined in AbstractProcessor

See Also:
AbstractProcessor.getCachedItem(Hashtable, Object), AbstractProcessor.removeCachedItem(Hashtable, Object), AbstractProcessor.putCachedItem(Hashtable, Object, Object)
Constructor Detail

SoloProcessor

public SoloProcessor(RobotiumTestRunner robotiumTestrunner)
Method Detail

checkSolo

protected boolean checkSolo()
Test if the solo is null. If it is, try to set it with that of RobotiumTestRunner

See Also:
RobotiumTestRunner.getSolo()

processProperties

public void processProperties(java.util.Properties props)
Before calling this method, you should call setRemoteCommand()

Specified by:
processProperties in interface ProcessorInterface
Overrides:
processProperties in class AbstractProcessor
Parameters:
props - The Properties object containing the in and out parameters
See Also:
ProcessorInterface.processProperties(Properties)

startMainLauncher

protected void startMainLauncher(java.util.Properties props)
                          throws ProcessorException
This method will launch the main activity.
It will initialize the Solo object of RobotiumTestRunner
This Solo object will also be shared by this class
If you want to use the Solo object, you MUST call this method firstly.

Parameters:
props - The Properties object containing the in and out parameters
Throws:
ProcessorException
See Also:
RobotiumTestRunner.launchApplication()

getBitmapOfView

protected Bitmap getBitmapOfView(View view)
Get bitmap image of a View.
This method call View#getDrawingCache() to get the bitmap image.
For some special views, we can't generate the bitmap by this way. We can
override this method and provide a special way in the subclass.

Parameters:
view - View, The View object
Returns:
The bitmap object of a view.

getCachedObject

public java.lang.Object getCachedObject(java.lang.String key,
                                        boolean useChain)
CacheReferenceInterface implementation.

Specified by:
getCachedObject in interface CacheReferenceInterface
Parameters:
key - -- String key for identifying the object stored in cache.
useChain - -- true if the instance should search in all chained caches, false if only the individual local cache should be searched.
Returns:
-- the object stored in cache identified by the key, or null if not found.

addCacheReferenceInterface

public void addCacheReferenceInterface(CacheReferenceInterface cache)
CacheReferenceInterface implementation.

Specified by:
addCacheReferenceInterface in interface CacheReferenceInterface
See Also:
CacheReferenceInterface.addCacheReferenceInterface(CacheReferenceInterface)

removeCacheReferenceInterface

public void removeCacheReferenceInterface(CacheReferenceInterface cache)
CacheReferenceInterface implementation.

Specified by:
removeCacheReferenceInterface in interface CacheReferenceInterface
See Also:
CacheReferenceInterface.removeCacheReferenceInterface(CacheReferenceInterface)

clearCache

public void clearCache(boolean useChain)
CacheReferenceInterface implementation.

Specified by:
clearCache in interface CacheReferenceInterface
Parameters:
useChain - -- true if the instance should clear all chained caches, false if only the individual local cache should be cleared.
See Also:
CacheReferenceInterface.clearCache(boolean)