com.googlecode.lightest.core
Class LightestUtils

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

public class LightestUtils
extends Object
implements groovy.lang.GroovyObject


Constructor Summary
LightestUtils()
           
 
Method Summary
static void addClassPaths(List paths, URLClassLoader classLoader)
          Adds all members of a list of class paths as URL's to the given class loader.
static String backslash(String s)
          Returns the string with all occurrences of backslashes, backslash-escaped.
static File createSuiteFile(List testClasses, int threadCount)
          Creates a Lightest suite file for a given set of test classes in a temporary location, and returns the file.
static String createSuiteXML(List testClassNames, int threadCount)
          Returns as a String the TestNG suite XML representing the List of String class names.
 groovy.lang.MetaClass getMetaClass()
           
 Object getProperty(String name)
           
static String getSanitizedStackTrace(Throwable t)
          Return the String representation of a stack trace with extraneous Groovy MOP entries removed.
static Collection getSettableProperties(Class clazz)
          Returns the names of all settable properties for a given class, as defined by having "setX()" methods available for property "x".
static StackTraceElement getTestCaseStackElement()
          Returns the entry in the stack trace of the current thread that represents the most recent method call in a subclass of LightestTestCase.
 Object invokeMethod(String name, Object args)
           
static void setBuilderAsDelegate(Object args, groovy.util.BuilderSupport builder)
          Sets this specified node builder instance as the delegate for any Closures in the argument list.
 void setMetaClass(groovy.lang.MetaClass metaClass)
           
 void setProperty(String name, Object value)
           
static void writeSuiteXML(List testClassNames, int threadCount, Writer writer)
          Writes an XML representation of a Lightest suite file for a given set of test classes, using the specified Writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightestUtils

public LightestUtils()
Method Detail

getSanitizedStackTrace

public static String getSanitizedStackTrace(Throwable t)
Return the String representation of a stack trace with extraneous Groovy MOP entries removed.

Parameters:
t -

getTestCaseStackElement

public static StackTraceElement getTestCaseStackElement()
Returns the entry in the stack trace of the current thread that represents the most recent method call in a subclass of LightestTestCase. If none is found, returns null.


setBuilderAsDelegate

public static void setBuilderAsDelegate(Object args,
                                        groovy.util.BuilderSupport builder)
Sets this specified node builder instance as the delegate for any Closures in the argument list.

Parameters:
args - a list of arguments as would be passed into methodMissing() or invokeMethod().
builder - the builder to delegate to

createSuiteFile

public static File createSuiteFile(List testClasses,
                                   int threadCount)
Creates a Lightest suite file for a given set of test classes in a temporary location, and returns the file.

Parameters:
testClasses - the LightestTestCase classes
threadCount - the number of parallel threads to use when executing the test methods. If less than 2, the test methods will not be specified to be run in parallel.

createSuiteXML

public static String createSuiteXML(List testClassNames,
                                    int threadCount)
Returns as a String the TestNG suite XML representing the List of String class names.


writeSuiteXML

public static void writeSuiteXML(List testClassNames,
                                 int threadCount,
                                 Writer writer)
Writes an XML representation of a Lightest suite file for a given set of test classes, using the specified Writer.

Parameters:
testClassNames - the names of LightestTestCase classes
threadCount - the number of parallel threads to use when executing the test methods. If less than 2, the test methods will not be specified to be run in parallel.
writer - the writer to use when writing the XML

getSettableProperties

public static Collection getSettableProperties(Class clazz)
Returns the names of all settable properties for a given class, as defined by having "setX()" methods available for property "x". Certain Groovy properties are excluded, such as "property" and "metaClass".

Parameters:
clazz -

addClassPaths

public static void addClassPaths(List paths,
                                 URLClassLoader classLoader)
Adds all members of a list of class paths as URL's to the given class loader. New URL's are added only if they do not already exist for the class loader.

Parameters:
paths - the paths to add
classLoader - the class loader to add to

backslash

public static String backslash(String s)
Returns the string with all occurrences of backslashes, backslash-escaped.


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.