TPTP 4.4.0 Testing Tools Project
Public API Specification

org.eclipse.hyades.test.core.services
Class AbstractTestExecutionService

java.lang.Object
  extended byorg.eclipse.hyades.automation.core.AbstractService
      extended byorg.eclipse.hyades.automation.server.AbstractService
          extended byorg.eclipse.hyades.automation.server.AbstractRelaunchableService
              extended byorg.eclipse.hyades.automation.server.AbstractWorkspaceSensitiveService
                  extended byorg.eclipse.hyades.automation.server.AbstractProjectSensitiveService
                      extended byorg.eclipse.hyades.test.core.services.AbstractTestExecutionService
All Implemented Interfaces:
java.io.Serializable, org.eclipse.hyades.automation.core.Service
Direct Known Subclasses:
TestExecutionService

public abstract class AbstractTestExecutionService
extends org.eclipse.hyades.automation.server.AbstractProjectSensitiveService

Abstract class that all test core execution related services should extend, common execution related methods and state are located in this class. The idea is that this class will define a template method with associated abstract or default implementation concrete methods that will be extended by the various test types and situations. It might very well be the case that the default is fine for most test types without having to extend this class. For the service properties, variables named specifiers indicate zero to one values whereas a selector is interpreted as a variable that can have zero to many values. The template method is the execute method and is marked final, for subclasses to participate as test execution services they must override the template method associate methods in a way to receive the desired results. The associated template methos are listed below and referenced in order that they are invoked, for the latest order please verify with the code in this classes' execute method. Note that the suite property takes either a string or a list of strings to specify the tests to execute and that the results property is also used as an list out value (a list of strings naming the results)

See Also:
initialize(), beforeLaunch(String), launch(ILaunchConfiguration, String, IProgressMonitor), afterLaunch(ILaunch), #afterExecution(), handleThrowable(Throwable), cleanup(), Auxiliary supporting associated template method methods:, #waitForCompletion(ILaunch, int), loadDeployment(IProject, String), loadModelElement(IProject, String), loadTestSuite(IProject, String), getProgressMonitor(), getWaitForCompletionInterval(), createDerivedTestSuiteFile(IProject, String, boolean), Serialized Form

Nested Class Summary
 
Nested classes inherited from class org.eclipse.hyades.automation.core.Service
org.eclipse.hyades.automation.core.Service.Discoverable, org.eclipse.hyades.automation.core.Service.Executable, org.eclipse.hyades.automation.core.Service.Requestable
 
Field Summary
protected  java.lang.String classpathSpecifier
          The classpath specifier, if specified, specifies the classpath that will be prepended to any previously associated classpath with the test execution of interest.
protected  java.lang.String configurationSelector
          The configuration selector, if specified, specifies the launch configuration to be used as the starting point for this test execution.
protected  java.lang.String connectionSpecifier
          The connection specifier, if specified, shadows the previously associated and store connection-related state, this specifier can suggest scheme, server class, host, port and server instance.
protected  java.lang.String deploymentSelector
          The deployment selector, if specified, identifies one to potentially many deployments involved in this test execution, the concrete service determines how to use the selector specified.
protected  boolean overwriteSpecifier
          The overwrite specifier, indicates if results should be overwritten each time or if result names will be generated in order to preserve the original results and not overwrite them.
protected  java.lang.String resultProjectDir
          Result string containing file system path to project for locating project relative result files in results member
protected  java.util.List results
          Result list to return to callers of the service
protected  java.lang.String resultsSpecifier
          The results specifier, if specified, indicates zero to one specified values for this the results, the concrete service determines how to use the specified value (used as input and not necessarily the concrete file names of the results)
protected  java.util.List suiteSelector
          The test suite selector, if specified, identifies one to potentially many test suites involved in this test execution, the concrete service determines how to use the selector specified.
 
Fields inherited from class org.eclipse.hyades.automation.server.AbstractProjectSensitiveService
project, projectSpecifier
 
Fields inherited from class org.eclipse.hyades.automation.server.AbstractWorkspaceSensitiveService
workspace, workspaceSpecifier
 
Constructor Summary
protected AbstractTestExecutionService()
          Default constructor invokes up hierarchy for any initialization required
 
Method Summary
protected  org.eclipse.emf.ecore.EObject afterExecution(org.eclipse.debug.core.model.IProcess process)
          Executed after the execution completion has been waited on and it is found to be complete.
protected  org.eclipse.debug.core.model.IProcess afterLaunch(org.eclipse.debug.core.ILaunch launch)
          Invoke after the launch but before the execution is waited on and completed.
protected  org.eclipse.debug.core.ILaunchConfiguration beforeLaunch(java.lang.String suiteSpecifier)
          Before the execution has launched but after the initialize method sets up, could be used to select the actual instance objects to use based on the various selector and specifier variables before a launch.
protected  void cleanup()
          Before the execution will return, used in normal cases and exceptional cases.
protected  java.io.File createDerivedTestSuiteFile(org.eclipse.core.resources.IProject project, java.lang.String sourceTestSuite, boolean deleteOnExit)
          Derives a new test suite model element and corresponding file representing it from a source test suite, retrieved by file identifier (test suite project relative name or absolute path)
 java.lang.Object execute()
           
protected  org.eclipse.debug.core.model.IProcess getProcessOfInterest(org.eclipse.debug.core.ILaunch launch)
          Retrieve process of interest from launch, the test execution process
protected  org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
          The default method creates and offers a null progress monitor, overwrite this to create a custom progress monitor
protected  int getWaitForCompletionInterval()
          The time to wait before polling the test execution process for its completion status.
protected  void handleThrowable(java.lang.Throwable t)
          Default outputs throwable to standard console out
protected  void initialize()
          Invoked at the beginning before any other template method, used to initialize instance variable state and any other actions that are required before anything else is begun.
protected  org.eclipse.debug.core.ILaunch launch(org.eclipse.debug.core.ILaunchConfiguration configuration, java.lang.String mode, org.eclipse.core.runtime.IProgressMonitor monitor)
          Launches a given configuration, using the specified mode (typically ILaunchManager.RUN_MODE) and an optional progress monitor.
protected  org.eclipse.hyades.models.common.testprofile.TPFDeployment loadDeployment(org.eclipse.core.resources.IProject project, java.lang.String deploymentName)
          Load deployment model element given the project and deployment name
protected  org.eclipse.hyades.models.common.common.CMNNamedElement loadModelElement(org.eclipse.core.resources.IProject project, java.lang.String modelElementName)
          Loads a model element, given a project and model element name
protected  org.eclipse.hyades.models.common.testprofile.TPFTestSuite loadTestSuite(org.eclipse.core.resources.IProject project, java.lang.String testSuiteName)
          Load test suite model element given the project and test suite name
protected  java.lang.Object returnResult()
          The result to return from this service
protected  void waitForCompletion(org.eclipse.debug.core.model.IProcess process, int interval)
          Waits for the test to be fully complete, then returns
 
Methods inherited from class org.eclipse.hyades.automation.server.AbstractProjectSensitiveService
getProject, refreshProject
 
Methods inherited from class org.eclipse.hyades.automation.server.AbstractRelaunchableService
copy, reconstructCommandLine
 
Methods inherited from class org.eclipse.hyades.automation.server.AbstractService
execute
 
Methods inherited from class org.eclipse.hyades.automation.core.AbstractService
configure, configure, createMemento, getIdentifier, getProperties, getProperty, getProperty, getPublicProperties, getRoot, isQuiet, print, println, println, setMemento, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

classpathSpecifier

protected java.lang.String classpathSpecifier
The classpath specifier, if specified, specifies the classpath that will be prepended to any previously associated classpath with the test execution of interest.


configurationSelector

protected java.lang.String configurationSelector
The configuration selector, if specified, specifies the launch configuration to be used as the starting point for this test execution. It is possible that this selector identifies more than one configuration. The concrete services interpret how to use the selector assigned.


connectionSpecifier

protected java.lang.String connectionSpecifier
The connection specifier, if specified, shadows the previously associated and store connection-related state, this specifier can suggest scheme, server class, host, port and server instance. Scheme is almost always set to "TPTP" whereas, server class is "RAC, IAC, etc" and host is the network host name and port is the port number to connect to the agent controller on, the server instance is "default"


deploymentSelector

protected java.lang.String deploymentSelector
The deployment selector, if specified, identifies one to potentially many deployments involved in this test execution, the concrete service determines how to use the selector specified.


results

protected java.util.List results
Result list to return to callers of the service


resultProjectDir

protected java.lang.String resultProjectDir
Result string containing file system path to project for locating project relative result files in results member

Provisional API: This API is subject to change in the next release.
As of TPTP V4.4.0, this is stable provisional API (see http://www.eclipse.org/tptp/home/documents/process/development/api_contract.html).

overwriteSpecifier

protected boolean overwriteSpecifier
The overwrite specifier, indicates if results should be overwritten each time or if result names will be generated in order to preserve the original results and not overwrite them.


resultsSpecifier

protected java.lang.String resultsSpecifier
The results specifier, if specified, indicates zero to one specified values for this the results, the concrete service determines how to use the specified value (used as input and not necessarily the concrete file names of the results)


suiteSelector

protected java.util.List suiteSelector
The test suite selector, if specified, identifies one to potentially many test suites involved in this test execution, the concrete service determines how to use the selector specified. The suite selector is a list of strings.

Constructor Detail

AbstractTestExecutionService

protected AbstractTestExecutionService()
Default constructor invokes up hierarchy for any initialization required

Method Detail

afterExecution

protected org.eclipse.emf.ecore.EObject afterExecution(org.eclipse.debug.core.model.IProcess process)
Executed after the execution completion has been waited on and it is found to be complete. This might also be reached in cases where subclasses override the behavior of the after launch method -- making that particular method not block for the entire length of the test. In this case, this method is most appropriately during execution.


afterLaunch

protected org.eclipse.debug.core.model.IProcess afterLaunch(org.eclipse.debug.core.ILaunch launch)
Invoke after the launch but before the execution is waited on and completed.


beforeLaunch

protected org.eclipse.debug.core.ILaunchConfiguration beforeLaunch(java.lang.String suiteSpecifier)
                                                            throws org.eclipse.core.runtime.CoreException
Before the execution has launched but after the initialize method sets up, could be used to select the actual instance objects to use based on the various selector and specifier variables before a launch.

Throws:
org.eclipse.core.runtime.CoreException

cleanup

protected void cleanup()
Before the execution will return, used in normal cases and exceptional cases.


createDerivedTestSuiteFile

protected java.io.File createDerivedTestSuiteFile(org.eclipse.core.resources.IProject project,
                                                  java.lang.String sourceTestSuite,
                                                  boolean deleteOnExit)
                                           throws java.io.IOException
Derives a new test suite model element and corresponding file representing it from a source test suite, retrieved by file identifier (test suite project relative name or absolute path)

Parameters:
project - the project of interest
sourceTestSuite - the source test suite the created suite is deriving from
deleteOnExit - indicates if the derived test suite file representation should be deleted on exit of the vm
Returns:
the file representing the derived test suite model element
Throws:
java.io.IOException

execute

public final java.lang.Object execute()

getProcessOfInterest

protected org.eclipse.debug.core.model.IProcess getProcessOfInterest(org.eclipse.debug.core.ILaunch launch)
Retrieve process of interest from launch, the test execution process

Parameters:
launch - the launch associated with this test execution
Returns:
the test execution process of interest

getProgressMonitor

protected org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
The default method creates and offers a null progress monitor, overwrite this to create a custom progress monitor

Returns:
the progress monitor to use for the launch

getWaitForCompletionInterval

protected int getWaitForCompletionInterval()
The time to wait before polling the test execution process for its completion status. If not specified the default value is used.

Returns:

handleThrowable

protected void handleThrowable(java.lang.Throwable t)
Default outputs throwable to standard console out

Parameters:
t - the throwable caught to be handled

initialize

protected void initialize()
Invoked at the beginning before any other template method, used to initialize instance variable state and any other actions that are required before anything else is begun.


launch

protected org.eclipse.debug.core.ILaunch launch(org.eclipse.debug.core.ILaunchConfiguration configuration,
                                                java.lang.String mode,
                                                org.eclipse.core.runtime.IProgressMonitor monitor)
                                         throws org.eclipse.core.runtime.CoreException
Launches a given configuration, using the specified mode (typically ILaunchManager.RUN_MODE) and an optional progress monitor.

Parameters:
configuration - the launch configuration to launch
mode - the mode to launch in
monitor - ability to cancel and report status
Returns:
the launch object associated with this particular launch
Throws:
org.eclipse.core.runtime.CoreException

loadDeployment

protected org.eclipse.hyades.models.common.testprofile.TPFDeployment loadDeployment(org.eclipse.core.resources.IProject project,
                                                                                    java.lang.String deploymentName)
Load deployment model element given the project and deployment name

Parameters:
project - the project containing (or that should be containing) the deployment
deploymentName - the deployment identifier
Returns:
the loaded model element

loadModelElement

protected org.eclipse.hyades.models.common.common.CMNNamedElement loadModelElement(org.eclipse.core.resources.IProject project,
                                                                                   java.lang.String modelElementName)
Loads a model element, given a project and model element name

Parameters:
project - the project the model element is found in
modelElementName - the model element within the project to load
Returns:
the named element loaded

loadTestSuite

protected org.eclipse.hyades.models.common.testprofile.TPFTestSuite loadTestSuite(org.eclipse.core.resources.IProject project,
                                                                                  java.lang.String testSuiteName)
Load test suite model element given the project and test suite name

Parameters:
project - the project the test suite is contained in (or should be contained in)
testSuiteName - the test suite name identifying the test suite
Returns:
the loaded model element

returnResult

protected java.lang.Object returnResult()
The result to return from this service

Returns:
returns an instance of self to avoid sending back a null object (not used for anything)

waitForCompletion

protected void waitForCompletion(org.eclipse.debug.core.model.IProcess process,
                                 int interval)
Waits for the test to be fully complete, then returns

Parameters:
interval - the amount of time to wait before checking time completion status

TPTP 4.4.0 Testing Tools Project
Public API Specification