com.googlecode.lightest.core
Class LightestContext

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

public class LightestContext
extends Object
implements groovy.lang.GroovyObject

The context available to tasks any test thread. This object is typically managed by the TaskDispatcher, which is capable of associating the environment and testcase with it.


Field Summary
protected  ITestEnvironment env
           
protected  IPreferences prefs
           
protected  LightestTestCase testcase
           
 
Constructor Summary
LightestContext()
           
 
Method Summary
 ITestEnvironment getEnv()
          The test environment is accessible from the context, but it should not be settable or modifiable.
 groovy.lang.MetaClass getMetaClass()
           
 String getOutputDir()
           
 IPreferences getPrefs()
          The test run preferences are accessible from the context, but should not be settable or modifiable.
 Object getProperty(String name)
           
 ITaskProvider getTaskProvider()
          Returns the current task provider.
 void inheritContextFromParent(LightestContext parentContext)
          Sets the preferences, environment, and testcase from the specified parent context.
 Object invokeMethod(String name, Object args)
           
protected  ITaskProvider popTaskProvider()
           
 Object push(Object name, Object value)
          Push a variable value onto the context.
protected  void pushTaskProvider(ITaskProvider taskProvider)
           
 void reset()
          Removes all local context values from the context.
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setOutputDir(String value)
           
 void setProperty(String name, Object value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

prefs

protected IPreferences prefs

env

protected ITestEnvironment env

testcase

protected LightestTestCase testcase
Constructor Detail

LightestContext

public LightestContext()
Method Detail

getOutputDir

public String getOutputDir()

setOutputDir

public void setOutputDir(String value)

inheritContextFromParent

public void inheritContextFromParent(LightestContext parentContext)
Sets the preferences, environment, and testcase from the specified parent context.

Parameters:
parentContext - the context to inherit values from

getPrefs

public IPreferences getPrefs()
The test run preferences are accessible from the context, but should not be settable or modifiable.


getEnv

public ITestEnvironment getEnv()
The test environment is accessible from the context, but it should not be settable or modifiable.


getTaskProvider

public ITaskProvider getTaskProvider()
Returns the current task provider. The testcase must be set on this context before this method is called. If the current provider's builder is in the midst of building a TaskNode tree, the builder itself is returned as the provider.


pushTaskProvider

protected void pushTaskProvider(ITaskProvider taskProvider)

popTaskProvider

protected ITaskProvider popTaskProvider()

push

public Object push(Object name,
                   Object value)
Push a variable value onto the context. Normally when values are set on the context, they overwrite previously set values. Use push() to retain the current value; future property accesses will see the new value. The pushed value will remain in effect as long as the current task provider is on the stack; when it is removed, the value is also automatically removed. In other words, this method provides the ability to set task-scoped context values. Calling push() multiple times with the same variable name will not grow a stack.

Parameters:
name - the name of the context variable
value - the new value of the context variable

reset

public void reset()
Removes all local context values from the context. This will not clear context values that are have been added via push().


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.