public abstract class AbstractTestScriptInterpret extends Object implements TestScriptInterpret, Plugin, DocumentListener, ScriptTypeProvider
T-Plan Robot Enterprise, (C) 2009-2022 T-Plan Limited. All rights reserved.
Modifier and Type | Field and Description |
---|---|
static String |
BACKUP_FILE_SUFFIX |
TYPE_JAVA, TYPE_PROPRIETARY, TYPE_UNKNOWN
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(ChangeListener cl) |
String |
applyVariablesToCommand(String command,
ScriptingContext repository) |
void |
backUp() |
void |
changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed.
|
void |
checkDependencies(PluginManager manager)
Check whether all dependencies are installed.
|
void |
deleteBackup() |
void |
deleteBackup(URI uri)
Delete the back up file associated with the specified script file.
|
void |
destroy()
Clean up method.
|
File |
getBackup(File scriptFile) |
String |
getCode()
Get plugin code.
|
ScriptingContext |
getCompilationContext()
Get context from the last compilation.
|
Date |
getDate()
Get plugin release date.
|
ScriptingContext |
getExecutionContext()
Get context from the last execution.
|
long |
getFileLastModified()
Get the last modification time (in millis) of the file that the interpret
owns.
|
Class |
getImplementedInterface()
Get Class of the exposed functional interface that this plugin implements.
|
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.
|
ScriptManager |
getScriptManager()
Get the script manager associated with this test interpret instance.
|
URI |
getSourceURI()
Get the URI.
|
String |
getSupportContact()
Get support contact.
|
String |
getUID()
Get the test script unique Id (UID).
|
URI |
getURI()
Get test script source code URI.
|
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 |
hasSource()
Find out if the interpret has access to the source code.
|
void |
insertUpdate(DocumentEvent e)
Gives notification that there was an insert into the document.
|
boolean |
isDestroyed()
Test out whether the interpret has been destroyed by a call of
TestScriptInterpret.destroy() . |
boolean |
isEditable(String extension)
Find out if a test script file of the given extension is a text one
(source code) and can be edited in the script editor.This method allows
to prevent users from opening of binary test scripts, such as for example
Java byte code (.class).
|
boolean |
isExecuting()
Find out whether the test script is currently executing.
|
boolean |
isManualStop()
Indicates whether the script execution was stopped manually by the user.
|
boolean |
isModified()
Find out if the script is modified or not.
|
boolean |
isPartiallyExecuting()
Indicates whether the interpret is currently executing a subset of code.
|
boolean |
isPause()
Indicates whether the script is currently paused/suspended.
|
boolean |
isRunning()
Find out if the script is currently running, i.e.
|
boolean |
isStop()
Indicates whether the execution was stopped.
|
boolean |
isSupportedTestScript()
Test whether the interpret is a supported script, i.e.
|
void |
reload()
Reload the content from the URI set through the
setURI(java.net.URI, boolean) method. |
void |
removeChangeListener(ChangeListener cl) |
void |
removeUpdate(DocumentEvent e)
Gives notification that a portion of the document has been
removed.
|
boolean |
requiresRestart()
Indicate whether installation of this plugin requires application restart.
|
void |
save() |
void |
save(File f) |
void |
save(String text,
File f) |
void |
setFileLastModified(long time)
Set the last modification time (in millis) of the file that the interpret
owns.
|
void |
setModified(boolean modified)
Indicate that the test script has been modified.
|
void |
setPause(Object source,
boolean pause,
String reason)
Pause or resume the executing script.
|
void |
setScriptManager(ScriptManager sm)
Set the script manager associated with this test script interpret.
|
void |
setScriptOwner(ScriptOwner owner)
Set the script owner, typically the GUI editor.
|
void |
setSourceURI(URI sourceURI)
Set the source URI.
|
void |
setStop(Object source,
boolean stop,
boolean isManual,
String manualStopJustification)
Request to stop the script execution.
|
void |
setURI(URI uri,
boolean load)
Set the test script URI.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
compile, execute, getDocument, getSupportedFileExtensions, getType, getTypeDescription, isPartialExecutionAllowed, isPartialExecutionAllowed, resetSelection, setSelection
getDescription, getDisplayName, getUniqueId
getType
public static final String BACKUP_FILE_SUFFIX
public void addChangeListener(ChangeListener cl)
public void removeChangeListener(ChangeListener cl)
public URI getURI()
TestScriptInterpret
getURI
in interface TestScriptInterpret
public void setURI(URI uri, boolean load) throws IOException
TestScriptInterpret
load
argument is true, the interpret
should load content from the URI to the document. A value of false
is
usually used in "Save As" operations where the URI changes for the
current document content. Saving of the file is however not performed by
this method.setURI
in interface TestScriptInterpret
uri
- test script URI.load
- whether to open the URI in the current document (see TestScriptInterpret.getDocument()
).IOException
- if the load parameter is true and loading of test script fails.public void save() throws FileNotFoundException, UnsupportedEncodingException, BadLocationException
public void reload() throws IOException
setURI(java.net.URI, boolean)
method.reload
in interface TestScriptInterpret
IOException
- on an I/O error.public boolean isModified()
TestScriptInterpret
isModified
in interface TestScriptInterpret
public void backUp()
public void deleteBackup()
public void deleteBackup(URI uri)
uri
- the script file URI.public void setModified(boolean modified)
TestScriptInterpret
setModified
in interface TestScriptInterpret
modified
- true sets the script status to modified, false to unmodified.public void setScriptOwner(ScriptOwner owner)
TestScriptInterpret
setScriptOwner
in interface TestScriptInterpret
owner
- the owner.public void save(String text, File f) throws IOException
IOException
public void save(File f) throws IOException
IOException
public long getFileLastModified()
TestScriptInterpret
getFileLastModified
in interface TestScriptInterpret
public void setFileLastModified(long time)
TestScriptInterpret
setFileLastModified
in interface TestScriptInterpret
time
- last time of saving of the script to the file.public void setScriptManager(ScriptManager sm)
TestScriptInterpret
setScriptManager
in interface TestScriptInterpret
sm
- a script manager.public String getCode()
Plugin
Get 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.
public String getVendorName()
Plugin
getVendorName
in interface Plugin
public String getSupportContact()
Plugin
getSupportContact
in interface Plugin
public int[] getVersion()
Plugin
new int[] { 1, 2, 3 }
.getVersion
in interface Plugin
public Class getImplementedInterface()
Plugin
com.tplan.robot.remoteclient.RemoteDesktopClient.class
.getImplementedInterface
in interface Plugin
public boolean requiresRestart()
Plugin
requiresRestart
in interface Plugin
public String getVendorHomePage()
Plugin
getVendorHomePage
in interface Plugin
public int[] getLowestSupportedVersion()
Plugin
getLowestSupportedVersion
in interface Plugin
public String getMessageBeforeInstall()
Plugin
getMessageBeforeInstall
in interface Plugin
public String getMessageAfterInstall()
Plugin
getMessageAfterInstall
in interface Plugin
public void checkDependencies(PluginManager manager) throws DependencyMissingException
checkDependencies
in interface Plugin
manager
- plugin manager instance.DependencyMissingException
- when one or more required dependencies is not installed.public ScriptManager getScriptManager()
TestScriptInterpret
getScriptManager
in interface TestScriptInterpret
public ScriptingContext getExecutionContext()
TestScriptInterpret
TestScriptInterpret.execute(ScriptingContext)
, the method should return null.getExecutionContext
in interface TestScriptInterpret
public ScriptingContext getCompilationContext()
TestScriptInterpret
TestScriptInterpret.compile(ScriptingContext)
, the method should return null.getCompilationContext
in interface TestScriptInterpret
public boolean isExecuting()
TestScriptInterpret
isExecuting
in interface TestScriptInterpret
isExecuting
in interface ScriptedExecutable
public boolean isRunning()
TestScriptInterpret
TestScriptInterpret.isExecuting()
or it is in the post-execution phase involving
posting of final events, result creating and cleaning up.isRunning
in interface TestScriptInterpret
public boolean isPartiallyExecuting()
TestScriptInterpret
isPartiallyExecuting
in interface TestScriptInterpret
public boolean isStop()
TestScriptInterpret
isStop
in interface TestScriptInterpret
isStop
in interface ScriptedExecutable
public boolean isManualStop()
TestScriptInterpret
isManualStop
in interface TestScriptInterpret
public void setStop(Object source, boolean stop, boolean isManual, String manualStopJustification)
TestScriptInterpret
Request to stop the script execution. The method is not supposed to stop the automated task immediately. It is rather expected to set an internal "stop" flag. The interpret should periodically test the flag, for example between individual command calls, and stop the execution as soon as possible.
The method should not fire a stop event through the ScriptListener
interface. It should be rather fired when the execution is really stopped,
not when the request is made.
setStop
in interface TestScriptInterpret
setStop
in interface ScriptedExecutable
source
- request source.stop
- true stops (false doesn't really make sense).isManual
- this is additional flag allowing to specify whether the
stop is manual, i.e. requested by the user either through GUI controls or
by pressing Ctrl+C in CLI. This information is saved to the context for
the benefit of report providers and doesn't affect the way the stop action
is carried out.manualStopJustification
- optional string describing why or how the
script was stopped. It is used just for reporting purposes.public boolean isPause()
TestScriptInterpret
isPause
in interface TestScriptInterpret
isPause
in interface ScriptedExecutable
public void setPause(Object source, boolean pause, String reason)
TestScriptInterpret
setPause
in interface TestScriptInterpret
setPause
in interface ScriptedExecutable
source
- the object requesting the pause (for tracking purposes only)pause
- true to pause, false to resumereason
- optional string describing why or how the
script was paused or resumed.public void insertUpdate(DocumentEvent e)
insertUpdate
in interface DocumentListener
e
- the document eventpublic void removeUpdate(DocumentEvent e)
removeUpdate
in interface DocumentListener
e
- the document eventpublic void changedUpdate(DocumentEvent e)
changedUpdate
in interface DocumentListener
e
- the document eventpublic void destroy()
TestScriptInterpret
destroy
in interface TestScriptInterpret
public boolean isDestroyed()
TestScriptInterpret
TestScriptInterpret.destroy()
.isDestroyed
in interface TestScriptInterpret
public boolean isEditable(String extension)
TestScriptInterpret
isEditable
in interface TestScriptInterpret
extension
- the file extension.public boolean isSupportedTestScript()
TestScriptInterpret
isSupportedTestScript
in interface TestScriptInterpret
public String applyVariablesToCommand(String command, ScriptingContext repository)
public URI getSourceURI()
public void setSourceURI(URI sourceURI)
sourceURI
- the sourceURI to setpublic boolean hasSource()
TestScriptInterpret
hasSource
in interface TestScriptInterpret
public String getUID()
getUID
in interface TestScriptInterpret