com.googlecode.lightest.core
Class TaskDispatcher

java.lang.Object
  extended by com.googlecode.lightest.core.TaskDispatcher
All Implemented Interfaces:
ITaskDispatcher, groovy.lang.GroovyObject

public class TaskDispatcher
extends Object
implements groovy.lang.GroovyObject, ITaskDispatcher

Responsible for actually performing tasks.


Constructor Summary
TaskDispatcher(ThreadedLightestContext context)
           
 
Method Summary
 ITaskResult dispatch(TaskNode taskNode, ITaskResult parentResult, ITestResult testResult)
          Dispatches the task and all nested tasks represented by the Node tree, as available in the API of the current testcase, and using the current dispatch strategy.
 LightestContext getContext()
          Returns the thread local context associated with this dispatcher, for the currently executing thread.
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
 LightestTestCase getTestCase()
          Returns the testcase this dispatcher is currently assigned to, or null if it is not assigned to a testcase.
 Object invokeMethod(String name, Object args)
           
 void setEnvironment(ITestEnvironment env)
           
 void setListener(ILightestTestListener listener)
           
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setPreferences(IPreferences prefs)
           
 void setProperty(String name, Object value)
           
 void setStrategy(ITaskDispatchStrategy strategy)
           
 void setTestCase(LightestTestCase testcase)
          Assigns a testcase to this dispatcher.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskDispatcher

public TaskDispatcher(ThreadedLightestContext context)
Method Detail

setPreferences

public void setPreferences(IPreferences prefs)
Specified by:
setPreferences in interface ITaskDispatcher

setEnvironment

public void setEnvironment(ITestEnvironment env)
Specified by:
setEnvironment in interface ITaskDispatcher

setStrategy

public void setStrategy(ITaskDispatchStrategy strategy)
Specified by:
setStrategy in interface ITaskDispatcher
Parameters:
strategy -

setListener

public void setListener(ILightestTestListener listener)
Specified by:
setListener in interface ITaskDispatcher

setTestCase

public void setTestCase(LightestTestCase testcase)
Assigns a testcase to this dispatcher. The testcase can be unassigned by passing in null. Makes the association between the test class and its test environment, which eventually will be needed by the report, available to the listener. We perform the mapping through the listener because TestNG does not allow us to inject this information any other way.

Specified by:
setTestCase in interface ITaskDispatcher
Parameters:
testcase -

getTestCase

public LightestTestCase getTestCase()
Returns the testcase this dispatcher is currently assigned to, or null if it is not assigned to a testcase.

Specified by:
getTestCase in interface ITaskDispatcher

getContext

public LightestContext getContext()
Returns the thread local context associated with this dispatcher, for the currently executing thread.

Specified by:
getContext in interface ITaskDispatcher

dispatch

public ITaskResult dispatch(TaskNode taskNode,
                            ITaskResult parentResult,
                            ITestResult testResult)
Dispatches the task and all nested tasks represented by the Node tree, as available in the API of the current testcase, and using the current dispatch strategy. The currently attached listener will be notified of the task result. "parentResult" will be null for root tasks. Returns the result of dispatching the task.

Specified by:
dispatch in interface ITaskDispatcher
Parameters:
taskNode -
parentResult -

getMetaClass

public groovy.lang.MetaClass getMetaClass()
Specified by:
getMetaClass in interface groovy.lang.GroovyObject

setMetaClass

public void setMetaClass(groovy.lang.MetaClass metaClass)
Specified by:
setMetaClass in interface groovy.lang.GroovyObject

invokeMethod

public Object invokeMethod(String name,
                           Object args)
Specified by:
invokeMethod in interface groovy.lang.GroovyObject

getProperty

public Object getProperty(String name)
Specified by:
getProperty in interface groovy.lang.GroovyObject

setProperty

public void setProperty(String name,
                        Object value)
Specified by:
setProperty in interface groovy.lang.GroovyObject


Copyright © 2009. All Rights Reserved.