|
T-Plan Robot Enterprise 3.2 Build No. 3.2-20121217.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.tplan.robot.remoteclient.AbstractRemoteDesktopClient
com.tplan.robot.remoteclient.image.ImageClient
public class ImageClient
Static image client allows to perform testing of images loaded from a file.
The client supports all Java-compliant lossless image formats such as PNG, BMP,
WBMP and GIF. The client accepts standard file URLs in form of
"file://<image_path>". For example, to connect to an image at C:\testdata\images\test.png
one would specify "Connect file://C:\testdata\images\test.png" in the test
script or call the corresponding connect() method from the
Java test class extending DefaultJavaTestScript.
The client has been extended in v2.3 to support loading of images packaged in a JAR file. The connect string format is in such a case "file://<JAR_file_path>!<image_path>". For example, to load an image called "screen.png" from a JAR file "C:\testdata\images.jar" where the image is zipped into a folder called "examples" use "Connect file://C:\testdata\images.jar!/examples/screen.png".
Version 2.3 also supports images specified relatively to the Robot's install folder (to the location of robot.jar). For example, to connect to image screen.png stored in the install folder one may use an URL like "file://screen.png".
As there's a mechanism causing the client to reload the image when the file gets updated, the client may be also used to interface with applications generating graphical output to an image in the file system. The client keeps checking the image file for size and time stamp and reloads automatically when a change is detected. This behavior is connected in the client preferences (see the Preference window in the GUI).
The client by default refuses key events and makes the GUI report
a syntax error on any the Press, Type or Typeline
commands specified in the test script. This is is intended to make it
clear that static images do not consume any key events. To suppress this
behavior and make the client consume key events (and discard them silently)
see the client preferences.
T-Plan Robot Enterprise, (C) 2009-2012 T-Plan Limited. All rights reserved.
| Field Summary | |
|---|---|
static String |
CONGIG_KEY_DUMMY_KEY_SUPPORT
|
static String |
CONGIG_KEY_ENABLE_POOLING
|
static String |
CONGIG_KEY_LAST_FILE
|
static String |
CONGIG_KEY_READ_TIME_MS
|
static String |
CONGIG_KEY_REFRESH_ON_SIZE_CHANGE
|
static String |
CONGIG_KEY_REFRESH_PERIOD_MS
|
| Fields inherited from interface com.tplan.robot.remoteclient.RemoteDesktopClient |
|---|
LOGIN_PARAM_PASSWORD, LOGIN_PARAM_URI, LOGIN_PARAM_USER |
| Constructor Summary | |
|---|---|
ImageClient()
|
|
| Method Summary | |
|---|---|
boolean |
canFreeze()
This method allows the implementing clients to disable freezing dynamically. |
void |
checkDependencies(PluginManager manager)
Check whether the current product installation contains all dependencies (other plugins) required to install this plugin. |
void |
clientPooled()
This method is called when the client is pooled and made ready for reuse. |
void |
clientReused()
This method is called when the client is picked up from the pool by a new test scripts. |
Thread |
close()
Close the connection to the RFB server. |
Thread |
connect()
Connect the client to the specified host. |
void |
destroy()
Destroy the client and make it ready for garbage collection. |
String |
getCode()
Get plugin code. |
String |
getConnectString()
Get the connect string (URL). |
Date |
getDate()
Get plugin release date. |
int |
getDefaultPort()
Get the default server port. |
String |
getDescription()
Get plugin description to be displayed in the GUI. |
int |
getDesktopHeight()
Get the remote desktop height. |
String |
getDesktopName()
Get the remote desktop name. |
int |
getDesktopWidth()
Get the remote desktop width. |
String |
getDisplayName()
Get short plugin name to be displayed in the GUI. |
String |
getHost()
Get the server host name. |
Image |
getImage()
Get the remote desktop image. |
Class |
getImplementedInterface()
Get Class of the exposed functional interface that this plugin implements. |
MouseEvent |
getLastMouseEvent()
This is a convenience method allowing to track the mouse pointer coordinates. |
List<Preference> |
getLoginParamsSpecification()
Get the list of login parameters (parameters). |
int[] |
getLowestSupportedVersion()
Get the lowest required version of T-Plan Robot Enterprise. |
String |
getMessageAfterInstall()
Get text of a message to be displayed after installation of this plugin. |
String |
getMessageBeforeInstall()
Get text of a message to be displayed before installation of this plugin. |
String |
getPassword()
Get the password. |
int |
getPort()
Get the port of the target RFB server. |
List<Preference> |
getPreferences()
Get metadata of displayable/editable configurable parameters. |
String |
getProtocol()
Get the protocol and eventually version supported by the client. |
String |
getSupportContact()
Get support contact. |
String |
getUniqueId()
Get unique ID associated with the plugin. |
String |
getUser()
Get the user. |
String |
getVendorHomePage()
Get the vendor home page. |
String |
getVendorName()
Get vendor (provider) name to be displayed in the GUI. |
int[] |
getVersion()
Get plugin version in form of an integer array. |
boolean |
hasSufficientConnectInfo()
Indicate whether the client has sufficient connect information or not. |
boolean |
isConnected()
Should indicate whether the client is connected to an RFB server, i.e. |
boolean |
isConnectedTo(String connectString)
Test whether this client is connected to a desktop identified by a particular URL (connect string). |
boolean |
isConnecting()
Should indicate whether the client is currently connecting to an RFB server but the communication hasn't passed the authentication and init phases, i.e. |
boolean |
isConsoleMode()
Indicates if the client runs in the console or GUI mode. |
boolean |
isFreeze()
Get the current status. |
boolean |
isKeyTransferSupported()
Allows to switch dynamically support of key events. |
boolean |
isLocalDisplay()
Find out whether the client is connected to the local display. |
boolean |
isPointerTransferSupported()
Allows to switch dynamically support of pointer events. |
boolean |
isPoolingCapable()
Define whether the client can be pooled at the moment or not. |
boolean |
isStatic()
The client is by default considered dynamic (the method returns false). |
boolean |
requiresRestart()
Indicate whether installation of this plugin requires application restart. |
void |
sendClientCutText(String text)
Implementation of the ClientCutText client-to-server RFB v3.3 message. |
void |
sendKeyEvent(KeyEvent evt)
Dummy method to consume key events. |
void |
sendPointerEvent(MouseEvent evt,
boolean sendModifiers)
Send a pointer event to the server. |
void |
setConfiguration(UserConfiguration cfg)
If an object implementing this interface is a plugin (i.e. |
void |
setConsoleMode(boolean consoleMode)
Set the console mode flag. |
void |
setFreeze(boolean freeze)
Freeze or resume. |
void |
setLoginParams(Map<String,Object> params)
Set the client login parameter values. |
| Methods inherited from class com.tplan.robot.remoteclient.AbstractRemoteDesktopClient |
|---|
addClientListener, addServerListener, fireRemoteClientEvent, fireRemoteServerEvent, isActivelyUpdating, removeClientListener, removeServerListener |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONGIG_KEY_LAST_FILE
public static final String CONGIG_KEY_REFRESH_ON_SIZE_CHANGE
public static final String CONGIG_KEY_REFRESH_PERIOD_MS
public static final String CONGIG_KEY_READ_TIME_MS
public static final String CONGIG_KEY_DUMMY_KEY_SUPPORT
public static final String CONGIG_KEY_ENABLE_POOLING
| Constructor Detail |
|---|
public ImageClient()
| Method Detail |
|---|
public boolean isLocalDisplay()
RemoteDesktopClientFind out whether the client is connected to the local display. By "local display" we mean the very same desktop displayed on the local display device (such as users's computer screen). An example of a local display is VNC server running on Windows or Java client connected directly to the system desktop buffer. On contrary, VNC servers running on ports 5901 and higher on a local Linux/Unix machine (localhost:1, localhost:2,...) must not be considered local by this method.
Value returned by this method affects behavior of the T-Plan Robot Enterprise GUI. If the display is local, the viewer doesn't display the desktop image because it would lead to recursive image (infinite mirroring effect). When a test script is executed on the local display, the GUI minimizes in order to hide from eventual screenshots.
isLocalDisplay in interface RemoteDesktopClientpublic String getProtocol()
RemoteDesktopClient
getProtocol in interface RemoteDesktopClientpublic String getHost()
RemoteDesktopClientsetHost(), the method returns null.
getHost in interface RemoteDesktopClientpublic int getPort()
RemoteDesktopClient
getPort in interface RemoteDesktopClientpublic int getDefaultPort()
RemoteDesktopClient
getDefaultPort in interface RemoteDesktopClientpublic String getPassword()
RemoteDesktopClientsetPassword(), the method returns null.
getPassword in interface RemoteDesktopClientpublic String getUser()
RemoteDesktopClientRemoteDesktopClient.setLoginParams(java.util.Map), the method returns null.
getUser in interface RemoteDesktopClientpublic int getDesktopWidth()
RemoteDesktopClient
getDesktopWidth in interface RemoteDesktopClientpublic int getDesktopHeight()
RemoteDesktopClient
getDesktopHeight in interface RemoteDesktopClientpublic String getDesktopName()
RemoteDesktopClient
getDesktopName in interface RemoteDesktopClientpublic boolean isConsoleMode()
RemoteDesktopClientIn GUI mode the client should rather fire the messages to all registered RfbServerListener instances. The GUI components should then report the messages in an appropriate way.
isConsoleMode in interface RemoteDesktopClientpublic void setConsoleMode(boolean consoleMode)
RemoteDesktopClient
setConsoleMode in interface RemoteDesktopClientconsoleMode - false indicates that the application runs in GUI mode,
true indicates CLI one.public MouseEvent getLastMouseEvent()
RemoteDesktopClientsendMouseEvent() and return it through this method.
getLastMouseEvent in interface RemoteDesktopClientpublic Image getImage()
RemoteDesktopClient
getImage in interface RemoteDesktopClientpublic boolean isConnected()
RemoteDesktopClient
isConnected in interface RemoteDesktopClientpublic boolean isConnecting()
RemoteDesktopClient
isConnecting in interface RemoteDesktopClient
public Thread connect()
throws Exception,
PasswordRequiredException
RemoteDesktopClient
connect in interface RemoteDesktopClientException
PasswordRequiredExceptionpublic boolean hasSufficientConnectInfo()
RemoteDesktopClient
hasSufficientConnectInfo in interface RemoteDesktopClient
public Thread close()
throws IOException
RemoteDesktopClientClose the connection to the RFB server. If there's no connection, the method should do nothing.
close in interface RemoteDesktopClientIOException
public void sendClientCutText(String text)
throws IOException
RemoteDesktopClient
sendClientCutText in interface RemoteDesktopClienttext - content of the local clipboard.
IOExceptionpublic List<Preference> getLoginParamsSpecification()
RemoteDesktopClient
getLoginParamsSpecification in interface RemoteDesktopClientpublic void setLoginParams(Map<String,Object> params)
RemoteDesktopClientSet the client login parameter values. This is the entry point to specify
connection URI (parameter name RemoteDesktopClient.LOGIN_PARAM_URI), user name (RemoteDesktopClient.LOGIN_PARAM_USER)
and password (RemoteDesktopClient.LOGIN_PARAM_PASSWORD). The client is expected to parse
the URI for the host name and port number to be returned by the RemoteDesktopClient.getHost() and
RemoteDesktopClient.getPort() methods. The point is to let the client to provide default
values when the URI doesn't contain them.
Save for these standard parameters listed above
the table can be populated with any other protocol specific parameters
understood by the client. Any such parameter should be declared through
the RemoteDesktopClient.getLoginParamsSpecification() method to make the
Login Dialog to display an appropriate GUI component
and allow user to enter a parameter value.
Custom parameters can be also passed through the --clientparam
CLI option. Any such instance will be parsed and passed to the client
through this method.
setLoginParams in interface RemoteDesktopClientparams - map of the [parameter name, parameter value] pairs.public String getCode()
PluginGet plugin code. This string serves as an identifier of the functionality delivered by the plugin. For example, desktop client plugins return protocol name like "RFB" or "RDP" as their code.
Plugin code is used by pluggable instance factories to identify
a particular plugin. It may be used to replace internal plugins with
third party code. For
example if you develop a class which implements this and the
com.tplan.robot.remoteclient.RemoteDesktop interfaces and the
getCode() method returns "RFB", it will replace the internal
implementation of the RFB (VNC) client.
getCode in interface Pluginpublic String getDisplayName()
Plugin
getDisplayName in interface Pluginpublic String getDescription()
Plugin
getDescription in interface Pluginpublic String getVendorName()
Plugin
getVendorName in interface Pluginpublic String getSupportContact()
Plugin
getSupportContact in interface Pluginpublic int[] getVersion()
Pluginnew int[] { 1, 2, 3 }.
getVersion in interface Pluginpublic Class getImplementedInterface()
Plugincom.tplan.robot.remoteclient.RemoteDesktopClient.class.
getImplementedInterface in interface Pluginpublic boolean requiresRestart()
Plugin
requiresRestart in interface Pluginpublic String getVendorHomePage()
Plugin
getVendorHomePage in interface Pluginpublic Date getDate()
Plugin
getDate in interface Pluginpublic String getUniqueId()
PluginGet unique ID associated with the plugin. The plugin manager uses the ID together with the version string to identify whether a plugin is already installed and whether a newer version of the same plugin is available.
The unique ID in fact identifies a particular plugin delivered by a particular vendor. Plugin developers are recommended to choose an ID and keep it constant for all versions of one particular plugin. The ID is never displayed in the GUI so it doesn't have to be a readable text. To avoid conflicts with other vendors it is recommended to elaborate vendor or author name and feature description into the ID, for example "custom RFB client implemented by John Doe".
getUniqueId in interface Pluginpublic int[] getLowestSupportedVersion()
Plugin
getLowestSupportedVersion in interface Pluginpublic String getMessageBeforeInstall()
Plugin
getMessageBeforeInstall in interface Pluginpublic String getMessageAfterInstall()
Plugin
getMessageAfterInstall in interface Plugin
public void checkDependencies(PluginManager manager)
throws DependencyMissingException
PluginDependencyMissingException
if one or more dependencies are missing.
checkDependencies in interface Pluginmanager - shared instance of the plugin manager.
DependencyMissingException - when one or more dependencies requested by this plugin is missing.public boolean isPointerTransferSupported()
PointerTransferCapable
isPointerTransferSupported in interface PointerTransferCapable
public void sendPointerEvent(MouseEvent evt,
boolean sendModifiers)
throws IOException
PointerTransferCapable
sendPointerEvent in interface PointerTransferCapableevt - a mouse event.sendModifiers - true sends modifiers like Ctrl or Alt, false not.
IOException - if an I/O error happens in the client-server communication.public void destroy()
AbstractRemoteDesktopClient
destroy in interface RemoteDesktopClientdestroy in class AbstractRemoteDesktopClientpublic String getConnectString()
RemoteDesktopClient
getConnectString in interface RemoteDesktopClientpublic boolean isConnectedTo(String connectString)
RemoteDesktopClient
isConnectedTo in interface RemoteDesktopClientisConnectedTo in class AbstractRemoteDesktopClientconnectString - an URL (connect string).
public boolean isStatic()
AbstractRemoteDesktopClient
isStatic in interface ImageOwnerisStatic in class AbstractRemoteDesktopClientpublic void setConfiguration(UserConfiguration cfg)
ConfigurableIf an object implementing this interface is a plugin (i.e. implements also the Plugin interface) and is instantiated through a supported plugin factory, the Plugin Manager calls this method right after an instance of this object is created.
Custom objects which do not already have their configuration parameters in
the default configuration file should take advantage of this method
to store their configuration into the shared User Configuration instance.
It is recommended to call the UserConfiguration.saveConfiguration()
method in the end to save the configuration to the hard drive.
Objects wishing to be notified of changes of configuration parameters
should implement the ConfigurationChangeListener interface and register
with the UserConfiguration instance through the
addConfigurationChangeListener() method.
setConfiguration in interface Configurablecfg - global shared instance of user configuration preloaded with
parameters from the default and user configuration files.public List<Preference> getPreferences()
Configurable
getPreferences in interface Configurablepublic boolean isKeyTransferSupported()
KeyTransferCapable
isKeyTransferSupported in interface KeyTransferCapable
public void sendKeyEvent(KeyEvent evt)
throws IOException
sendKeyEvent in interface KeyTransferCapableevt - a key event
IOException - declared but never thrown because the image client
discards any key events.public boolean isPoolingCapable()
PoolingCapable
isPoolingCapable in interface PoolingCapablepublic void clientPooled()
PoolingCapableRemoteDesktopServerEvent event
to notify its listeners that the connection was pooled.
clientPooled in interface PoolingCapablepublic void clientReused()
PoolingCapable
clientReused in interface PoolingCapablepublic boolean canFreeze()
ImageFreezeCapable
canFreeze in interface ImageFreezeCapablepublic void setFreeze(boolean freeze)
ImageFreezeCapabletrue the
image should stop updating and become still. When resuming (the argument
is false the image should refresh the image and resume the
update process.
setFreeze in interface ImageFreezeCapablefreeze - true freezes the image, false resumes.public boolean isFreeze()
ImageFreezeCapable
isFreeze in interface ImageFreezeCapable
|
T-Plan Robot Enterprise 3.2 Build No. 3.2-20121217.1 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||