net.sf.jameleon.function
Class FunctionTag

java.lang.Object
  extended by org.apache.commons.jelly.TagSupport
      extended by net.sf.jameleon.LocationAwareTagSupport
          extended by net.sf.jameleon.JameleonTagSupport
              extended by net.sf.jameleon.function.FunctionTag
All Implemented Interfaces:
BreakPoint, Attributable, Storable, DynaTag, LocationAware, Tag
Direct Known Subclasses:
AbstractSqlTag, FunctionDocTag, JUnitFunctionTag, WaitTag

public abstract class FunctionTag
extends JameleonTagSupport
implements Storable, BreakPoint

Represents an abstract function point that does a lot behind the scenes for the function point developer. The following instance variables are described:

The steps to creating an abstract function tag for a plugin are as follows:

  1. Implement the optional store(java.lang.String,int) method
  2. Override the default behavior of setupEnvironment(), being sure to call super first. The new behavior should be to get the corresponding SessionTag for the plug-in if a handle on the application is kept there. Use the Jelly-provided findAncestorWithClass(class) method to get a handle on the parent SessionTag. The abstract FunctionTag implementation should set the handle on the application being tested to a local instance variable for easy manipulation for FunctionTag extenders. If use of the plug-in FunctionTag requires a handle on the application, then it is good practice to throw a JameleonScriptException if the an ancestor of the plug-in SessionTag isn't found.
  3. Write your wrapper methods to make life easier for implementers of the plug-in.

Actually, to implement a FunctionTag for a plug-in is as simple as extending this base class and nothing more. The above list is provided as recommendation only.

To implement a FunctionTag from an existing plugin, the following methods must be implemented:

The following methods help define the behaviour of the function point and should be implemented not at the plugin level, but at the customization layer the user will do:


Field Summary
protected  AbstractDataDrivableTag addt
           
protected  boolean breakPoint
          Tells the GUI to stop at this functional point
protected  boolean expectException
          Specifies an exception is expected.
protected  boolean expectFailure
          Specifies a failure is expected.
protected  FunctionResult fResults
          The Results for this function
protected  long functionDelay
          The delay time to use at the end of each functional point
protected  String functionId
          The id of this function.
protected  File lastFileWritten
          Deprecated. use getFunctionResults().setErrorFile() instead.
protected static org.apache.log4j.Logger log
           
protected static long NO_DELAY
           
protected  ArrayList params
          A list of parameters passed to this functional point via the <param> tag.
protected  boolean postcondition
          Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.
protected  boolean precondition
          Specifies this is a precondition
protected  SessionTag st
          The parent session tag of this functional point
protected  StateStorer state
          Stores the state of the application.
protected  TestCaseTag tct
          The parent test case of this functional point
protected  ParamTypeValidatable vpt
           
 
Fields inherited from class net.sf.jameleon.JameleonTagSupport
attributes, broker, contextVars, fp, unsupportedAttributes
 
Fields inherited from class net.sf.jameleon.LocationAwareTagSupport
columnNumber, elementTagName, lineNumber, scriptFileName
 
Fields inherited from class org.apache.commons.jelly.TagSupport
body, context, hasTrimmed, parent, shouldTrim
 
Constructor Summary
FunctionTag()
           
 
Method Summary
 void addParam(Object param)
          Adds a ParamTag to the list of parameters
 void addRequiredAttribute(String attribute)
          Adds a required attribute to the macro tag defined for this function point.
 void assertEquals(boolean expected, boolean actual)
          Asserts that two booleans are equal.
 void assertEquals(boolean expected, boolean actual, int assertLevel)
          Asserts that two booleans are equal.
 void assertEquals(byte expected, byte actual)
          Asserts that two bytes are equal.
 void assertEquals(byte expected, byte actual, int assertLevel)
          Asserts that two bytes are equal.
 void assertEquals(char expected, char actual)
          Asserts that two chars are equal.
 void assertEquals(char expected, char actual, int assertLevel)
          Asserts that two chars are equal.
 void assertEquals(double expected, double actual, double delta)
          Asserts that two doubles are equal concerning a delta.
 void assertEquals(double expected, double actual, double delta, int assertLevel)
          Asserts that two doubles are equal concerning a delta.
 void assertEquals(float expected, float actual, float delta)
          Asserts that two floats are equal concerning a delta.
 void assertEquals(float expected, float actual, float delta, int assertLevel)
          Asserts that two floats are equal concerning a delta.
 void assertEquals(int expected, int actual)
          Asserts that two ints are equal.
 void assertEquals(int expected, int actual, int assertLevel)
          Asserts that two ints are equal.
 void assertEquals(long expected, long actual)
          Asserts that two longs are equal.
 void assertEquals(long expected, long actual, int assertLevel)
          Asserts that two longs are equal.
 void assertEquals(Object expected, Object actual)
          Asserts that two objects are equal.
 void assertEquals(Object expected, Object actual, int assertLevel)
          Asserts that two objects are equal.
 void assertEquals(short expected, short actual)
          Asserts that two shorts are equal.
 void assertEquals(short expected, short actual, int assertLevel)
          Asserts that two shorts are equal.
 void assertEquals(String message, boolean expected, boolean actual)
          Asserts that two booleans are equal.
 void assertEquals(String message, boolean expected, boolean actual, int assertLevel)
          Asserts that two booleans are equal.
 void assertEquals(String message, byte expected, byte actual)
          Asserts that two bytes are equal.
 void assertEquals(String message, byte expected, byte actual, int assertLevel)
          Asserts that two bytes are equal.
 void assertEquals(String message, char expected, char actual)
          Asserts that two chars are equal.
 void assertEquals(String message, char expected, char actual, int assertLevel)
          Asserts that two chars are equal.
 void assertEquals(String message, double expected, double actual, double delta)
          Asserts that two doubles are equal concerning a delta.
 void assertEquals(String message, double expected, double actual, double delta, int assertLevel)
          Asserts that two doubles are equal concerning a delta.
 void assertEquals(String message, float expected, float actual, float delta)
          Asserts that two floats are equal concerning a delta.
 void assertEquals(String message, float expected, float actual, float delta, int assertLevel)
          Asserts that two floats are equal concerning a delta.
 void assertEquals(String message, int expected, int actual)
          Asserts that two ints are equal.
 void assertEquals(String message, int expected, int actual, int assertLevel)
          Asserts that two ints are equal.
 void assertEquals(String message, long expected, long actual)
          Asserts that two longs are equal.
 void assertEquals(String message, long expected, long actual, int assertLevel)
          Asserts that two longs are equal.
 void assertEquals(String message, Object expected, Object actual)
          Asserts that two objects are equal.
 void assertEquals(String message, Object expected, Object actual, int assertLevel)
          Asserts that two objects are equal.
 void assertEquals(String message, short expected, short actual)
          Asserts that two shorts are equal.
 void assertEquals(String message, short expected, short actual, int assertLevel)
          Asserts that two shorts are equal.
 void assertEquals(String expected, String actual)
          Asserts that two Strings are equal.
 void assertEquals(String expected, String actual, int assertLevel)
          Asserts that two Strings are equal.
 void assertEquals(String message, String expected, String actual)
          Asserts that two Strings are equal.
 void assertEquals(String message, String expected, String actual, int assertLevel)
          Asserts that two Strings are equal.
 void assertFalse(boolean condition)
          Asserts that a condition is false.
 void assertFalse(boolean condition, int assertLevel)
          Asserts that a condition is false.
 void assertFalse(String message, boolean condition)
          Asserts that a condition is false.
 void assertFalse(String message, boolean condition, int assertLevel)
          Asserts that a condition is false.
protected  void assertMethod(Runnable r)
          Deprecated. This method will be removed in the next major release.
protected  void assertMethodWithLevel(Runnable r, int assertLevel)
          Runs the run method of a Runnable and records the results appropriately.
 void assertNotNull(Object object)
          Asserts that an object isn't null.
 void assertNotNull(Object object, int assertLevel)
          Asserts that an object isn't null.
 void assertNotNull(String message, Object object)
          Asserts that an object isn't null.
 void assertNotNull(String message, Object object, int assertLevel)
          Asserts that an object isn't null.
 void assertNotSame(Object expected, Object actual)
          Asserts that two objects refer to the same object.
 void assertNotSame(Object expected, Object actual, int assertLevel)
          Asserts that two objects refer to the same object.
 void assertNotSame(String message, Object expected, Object actual)
          Asserts that two objects refer to the same object.
 void assertNotSame(String message, Object expected, Object actual, int assertLevel)
          Asserts that two objects refer to the same object.
 void assertNull(Object object)
          Asserts that an object is null.
 void assertNull(Object object, int assertLevel)
          Asserts that an object is null.
 void assertNull(String message, Object object)
          Asserts that an object is null.
 void assertNull(String message, Object object, int assertLevel)
          Asserts that an object is null.
 void assertRegexMatches(String text, String regex)
          Asserts that given regex matches the provided text
 void assertRegexMatches(String text, String regex, int assertLevel)
          Asserts that given regex matches the provided text
 void assertRegexMatches(String message, String text, String regex)
          Asserts that given regex matches the provided text
 void assertRegexMatches(String message, String text, String regex, int assertLevel)
          Asserts that given regex matches the provided text
 void assertSame(Object expected, Object actual)
          Asserts that two objects refer to the same object.
 void assertSame(Object expected, Object actual, int assertLevel)
          Asserts that two objects refer to the same object.
 void assertSame(String message, Object expected, Object actual)
          Asserts that two objects refer to the same object.
 void assertSame(String message, Object expected, Object actual, int assertLevel)
          Asserts that two objects refer to the same object.
 void assertTextContains(String text, String textContained)
          Asserts that two objects are equal.
 void assertTextContains(String text, String textContained, int assertLevel)
          Asserts that two objects are equal.
 void assertTextContains(String message, String text, String textContained)
          Asserts that two objects are equal.
 void assertTextContains(String message, String text, String textContained, int assertLevel)
          Asserts text is contained into some given text.
 void assertTextEndsWith(String text, String endingText)
          Asserts that the given endingText is at the end of the given text..
 void assertTextEndsWith(String text, String endingText, int assertLevel)
          Asserts that the given endingText is at the end of the given text..
 void assertTextEndsWith(String message, String text, String endingText)
          Asserts that the given endingText is at the end of the given text..
 void assertTextEndsWith(String message, String text, String endingText, int assertLevel)
          Asserts text is contained into some given text.
 void assertTextStartsWith(String text, String startingText)
          Asserts that the given startingText begins the given text..
 void assertTextStartsWith(String text, String startingText, int assertLevel)
          Asserts that the given startingText begins the given text..
 void assertTextStartsWith(String message, String text, String startingText)
          Asserts that the given startingText begins the given text..
 void assertTextStartsWith(String message, String text, String startingText, int assertLevel)
          Asserts that the given startingText begins the given text..
 void assertTrue(boolean condition)
          Asserts that a condition is true.
 void assertTrue(boolean condition, int assertLevel)
          Asserts that a condition is true.
 void assertTrue(String message, boolean condition)
          Asserts that a condition is true.
 void assertTrue(String message, boolean condition, int assertLevel)
          Asserts that a condition is true.
protected  void checkParamTypes()
           
protected  void cleanUp()
          If this method is overridden, it is highly suggested that the super method be called as well.
protected  void cleanUpEnvironment()
           
 void delay()
           
 void delay(long delayTime)
           
 void doTag(XMLOutput out)
          Simply calls setupEnvironment(), validate(), setup() and testBlock(XMLOutput out).
 void fail()
          Fails by throwing an AssertionFailedError.
 void fail(int assertLevel)
          Fails by throwing an AssertionFailedError with a message
 void fail(String message)
          Fails by throwing an AssertionFailedError with a message
 void fail(String message, int assertLevel)
          Fails by throwing an AssertionFailedError with a message
 String getFunctionId()
          Gets the id of the function being tested.
 FunctionResult getFunctionResults()
           
 String getMatchingRegexText(String text, String regex, int matchingGroup)
          Gets the matching text found in the given string.
 Object getParam(int index)
          Gets the nth ParamTag.
 int getParamLength()
          Gets the number of ParamTags under this tag.
 List getParams()
          Gets the list of ParamTags under this tag.
protected  void getParentTags()
           
 SessionTag getSessionTag()
           
 String getStoreToFileName(int event)
          Gets the filename to store the state of the application to.
 String getStringOrDefault(String value, String defaultValue)
          Gets a String by its default value if an actual value isn't found.
 TestCaseTag getTestCaseTag()
          Gets the parent test case tag
 Object getVariable(String key)
          Gets the variable, key from the test case context.
protected  boolean getVariableAsBoolean(String key)
           
protected  List getVariableAsList(String key)
          Gets a variable from context and casts it to a list.
protected  String getVariableAsString(String key)
           
 boolean isBreakPoint()
          Checks whether this tag is a break point.
protected  boolean isContextVariableNull(String key)
          Checks to see if the variable, key, is null or hasn't been set.
 void pluginTearDown()
          Called when the function is done being executed.
protected  void recordFunctionResult(long startTime)
          Adds the result for this test step into the session's results and logs this information to the logger.
 boolean regexMatches(String text, String regex)
          Validates that the provided regex matches the provided text
protected  void removeFunctionResult()
           
 void removeVariable(String key)
          Removes the variable, key from the test case context.
 void setDefaultVariableValue(String attributeName, Object attributeValue)
          Sets the variable to a default value in the context.
 void setDefaultVariableValue(String attributeName, String attributeValue)
          Sets the variable to a default value in the context.
 void setExpectException(boolean expectException)
          Sets the value for expectException.
 void setExpectFailure(boolean expectFailure)
          Sets the value for expectFailure.
 void setFunctionDelay(long functionDelay)
          Sets the delay time to occur at the end of this functional point.
 void setFunctionId(String functionId)
          Sets the id of the function being tested.
 void setup()
          Does setup for plugin-required intialization.
protected  void setupEnvironment()
          This method is called before anything else is called.
protected  void setUpFunctionResults()
           
 void setVariable(String key, Object value)
          Sets the variable, key to the value, value This is simply a wrapper class for Jelly's own context.setVariable();
 void store(String filename, int event)
           Stores the current state of the object to a given File.
 void tearDown()
          Called when the function is done being executed.
 void testBlock()
          Contains the actual testing of the function point.
protected  void traceMsg(String msg)
           
protected  void validate()
          This method is called before the testBlock method is called.
 
Methods inherited from class net.sf.jameleon.JameleonTagSupport
cleanVariablesInContext, createAttributes, describeAttributes, getAttributeBroker, getAttributes, getAttributeType, getClassAttributes, getFunctionalPoint, getUnsupportedAttributes, loadFunctionalPoint, resetFunctionalPoint, setAttribute, setVariableInContext, testForUnsupportedAttributesCaught
 
Methods inherited from class net.sf.jameleon.LocationAwareTagSupport
getColumnNumber, getElementName, getFileName, getLineNumber, setColumnNumber, setElementName, setFileName, setLineNumber
 
Methods inherited from class org.apache.commons.jelly.TagSupport
findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.commons.jelly.Tag
getBody, getContext, getParent, invokeBody, setBody, setContext, setParent
 

Field Detail

fResults

protected FunctionResult fResults
The Results for this function


functionId

protected String functionId
The id of this function. This is used in the macro as a short description of the function

This attribute is recognized by Jameleon
Required: true

breakPoint

protected boolean breakPoint
Tells the GUI to stop at this functional point

This attribute is recognized by Jameleon
Required: false

precondition

protected boolean precondition
Specifies this is a precondition

This attribute is recognized by Jameleon
Required: false

postcondition

protected boolean postcondition
Specifies this is a postcondition and will therefore get executed even if a previous functional point or session tag failed.

This attribute is recognized by Jameleon
Required: false

expectFailure

protected boolean expectFailure
Specifies a failure is expected.

This attribute is recognized by Jameleon
Required: false

expectException

protected boolean expectException
Specifies an exception is expected.

This attribute is recognized by Jameleon
Required: false

lastFileWritten

protected File lastFileWritten
Deprecated. use getFunctionResults().setErrorFile() instead.
A list of required attributes for this function point.


params

protected ArrayList params
A list of parameters passed to this functional point via the <param> tag.


st

protected SessionTag st
The parent session tag of this functional point


tct

protected TestCaseTag tct
The parent test case of this functional point


state

protected StateStorer state
Stores the state of the application.


log

protected static org.apache.log4j.Logger log

vpt

protected ParamTypeValidatable vpt

NO_DELAY

protected static final long NO_DELAY
See Also:
Constant Field Values

functionDelay

protected long functionDelay
The delay time to use at the end of each functional point

This attribute is recognized by Jameleon
Default Value: -1

addt

protected AbstractDataDrivableTag addt
Constructor Detail

FunctionTag

public FunctionTag()
Method Detail

getFunctionId

public String getFunctionId()
Gets the id of the function being tested. This is usally a short description of how the function point.is used in the test case.

Returns:
functionId - The name of the function

setFunctionId

public void setFunctionId(String functionId)
Sets the id of the function being tested.

Parameters:
functionId - - the id of the function being tested

setExpectFailure

public void setExpectFailure(boolean expectFailure)
Sets the value for expectFailure. This attrubute defaults to false, so only set it if true is set.

Parameters:
expectFailure - - set to true to expect a failure. To invoke this functionality must be 'yes' or 'true'.

setExpectException

public void setExpectException(boolean expectException)
Sets the value for expectException. This attrubute defaults to false.

Parameters:
expectException - - a value of "yes" or "true" indicates the function tag should only pass if there is an exception.

isBreakPoint

public boolean isBreakPoint()
Checks whether this tag is a break point. Used mostly for the GUI.

Specified by:
isBreakPoint in interface BreakPoint
Returns:
true if this tag is a break point.

setFunctionDelay

public void setFunctionDelay(long functionDelay)
Sets the delay time to occur at the end of this functional point.

Parameters:
functionDelay - - the time in millis.

setup

public void setup()
Does setup for plugin-required intialization. Functional points that implement the plugin should call the super of method before implementing their own code.


tearDown

public void tearDown()
Called when the function is done being executed. Use to clean up resources created in the setup method.


pluginTearDown

public void pluginTearDown()
Called when the function is done being executed. Use to clean up resources created in the setup method.


testBlock

public void testBlock()
               throws Exception
Contains the actual testing of the function point. Implement this method with any code that would make the FunctionTag unique. The default implementation does nothing. Implement this method to make your function tag useful.

Throws:
Exception - when something goes wrong

doTag

public void doTag(XMLOutput out)
           throws MissingAttributeException
Simply calls setupEnvironment(), validate(), setup() and testBlock(XMLOutput out). If this method is overridden, you will need to call super.doTag() or else none of the logging or error reporting will work!

Specified by:
doTag in interface Tag
Throws:
MissingAttributeException

cleanUp

protected void cleanUp()
If this method is overridden, it is highly suggested that the super method be called as well.


cleanUpEnvironment

protected void cleanUpEnvironment()

traceMsg

protected void traceMsg(String msg)

addRequiredAttribute

public void addRequiredAttribute(String attribute)
Adds a required attribute to the macro tag defined for this function point. This is used to enforce a certain attribute be set in the tag of the function point. The javadoc method should be used instead if possible.

Parameters:
attribute - - The name of the attribute to add to the required list.

setDefaultVariableValue

public void setDefaultVariableValue(String attributeName,
                                    String attributeValue)
Sets the variable to a default value in the context. It is recommended that all variables be set in the context to take advantage of all features provided by Jamaleon. This can be used when you want the function point to work with both a CSV file and setting the attributes in the macro. The rule is if the variable is already set ( via testEnvironment-Applications.properties or the corresponding CSV dile or another funcational point attribute ), then this won't be set. If you want to set variable in the context, without regard as to the CSV file, then simply call context.setVariable(String key, String value) ( through the Jelly API ).

For the order context variables are set in Jameleon, please see the class description of TestCaseTag.

Parameters:
attributeName - - the name attribute to set
attributeValue - - the value of the attribute to set.
See Also:
net.sf.jameleon.TestCaseTag

setDefaultVariableValue

public void setDefaultVariableValue(String attributeName,
                                    Object attributeValue)
Sets the variable to a default value in the context. It is recommended that all variables be set in the context to take advantage of all features provided by Jamaleon. This can be used when you want the function point to work with both a CSV file and setting the attributes in the macro. The rule is if the variable is already set ( via testEnvironment-Applications.properties or the corresponding CSV dile or another funcationl point in the same test case), then this won't be set. If you want to set variable in the context, without regard as to the CSV file, then simply call context.setVariable(String key, String value) ( through the Jelly API ).

For the order context variables are set in Jameleon, please see the class description of TestCaseTag.

Parameters:
attributeName - - the name attribute to set
attributeValue - - the value of the attribute to set.
See Also:
net.sf.jameleon.TestCaseTag

setVariable

public void setVariable(String key,
                        Object value)
Sets the variable, key to the value, value This is simply a wrapper class for Jelly's own context.setVariable();

Parameters:
key - - the name attribute to set
value - - the value of the attribute to set.

getVariable

public Object getVariable(String key)
Gets the variable, key from the test case context. This is simply a wrapper class for Jelly's own context.getVariable();

Parameters:
key - - the name attribute to set
Returns:
the value of key

removeVariable

public void removeVariable(String key)
Removes the variable, key from the test case context. This is simply a wrapper class for Jelly's own context.removeVariable();

Parameters:
key - - the name attribute to set

getVariableAsString

protected String getVariableAsString(String key)
Parameters:
key - The variable name
Returns:
a variable with name key from the context as a String

getVariableAsBoolean

protected boolean getVariableAsBoolean(String key)
Parameters:
key - The variable name
Returns:
a variable with name key from the context as a (primitive) boolean

getVariableAsList

protected List getVariableAsList(String key)
Gets a variable from context and casts it to a list. If the value isn't a List, then it creates a ArrayList and adds the value to it.

Parameters:
key - The variable name
Returns:
a variable with name key from the context as a List even if the value is null.

isContextVariableNull

protected boolean isContextVariableNull(String key)
Checks to see if the variable, key, is null or hasn't been set.

Parameters:
key - - The name of the variable to be checked for a null value. This variable must be a String.
Returns:
true If the variable is set to null or "" then.

validate

protected void validate()
                 throws MissingAttributeException
This method is called before the testBlock method is called. If you want to override this method, call super first, followed by the custom validations that need to occur in your TestStep.

Throws:
MissingAttributeException - - When a required attribute is not set.

checkParamTypes

protected void checkParamTypes()

setupEnvironment

protected void setupEnvironment()
This method is called before anything else is called.


getParentTags

protected void getParentTags()

setUpFunctionResults

protected void setUpFunctionResults()

removeFunctionResult

protected void removeFunctionResult()

recordFunctionResult

protected void recordFunctionResult(long startTime)
Adds the result for this test step into the session's results and logs this information to the logger.

Parameters:
startTime - - The time this test step started execution.

getFunctionResults

public FunctionResult getFunctionResults()
Returns:
The test results of this test step

getMatchingRegexText

public String getMatchingRegexText(String text,
                                   String regex,
                                   int matchingGroup)
Gets the matching text found in the given string.

Parameters:
text - - The text to match against
regex - - The regex pattern to match. This regex pattern must have a single grouping representing the desired text.
matchingGroup - - The group position to match against.
Returns:
The matching text in the searchString

regexMatches

public boolean regexMatches(String text,
                            String regex)
Validates that the provided regex matches the provided text

Parameters:
text - - The text to match against
regex - - The regex pattern to match
Returns:
True if the regex matches or false if it doesn't

getStringOrDefault

public String getStringOrDefault(String value,
                                 String defaultValue)
Gets a String by its default value if an actual value isn't found.

Parameters:
value - - the value to return
defaultValue - - the value to return if the value parameter is null
Returns:
a String by its default value if an actual value isn't found..

getTestCaseTag

public TestCaseTag getTestCaseTag()
Gets the parent test case tag

Returns:
the parent test case tag of this tag.

store

public void store(String filename,
                  int event)
           throws IOException

Stores the current state of the object to a given File. The default implementation of this method does nothing. Override this method to implement plug-in specific behavior. Some examples might be:

  • Saving the HTML from an HTTP plug-in during a state change or error
  • Taking a screen shot for a GUI application during a state change event

A listener is already registered for each function tag. All that is required is implementing this method.

Specified by:
store in interface Storable
Parameters:
filename - the name of the if the file to store the contents to.
event - The event that occured (error, state change ...).
Throws:
IOException - If the state of the object could not be stored in File f.

getSessionTag

public SessionTag getSessionTag()

getStoreToFileName

public String getStoreToFileName(int event)
Gets the filename to store the state of the application to. The default implementation is to simply use timestamps. If this is not the desired behavior, override this method.

Specified by:
getStoreToFileName in interface Storable
Parameters:
event - - the StateStorer Event
Returns:
the appropriate filename which starts with ERROR- if the StateStorer Event was an Error

assertMethod

protected void assertMethod(Runnable r)
Deprecated. This method will be removed in the next major release.

Runs the run method of a Runnable and records the results appropriately.

Parameters:
r - - The block of code you want executed ( defined in the run() method ).

assertMethodWithLevel

protected void assertMethodWithLevel(Runnable r,
                                     int assertLevel)
Runs the run method of a Runnable and records the results appropriately.

Parameters:
r - - The block of code you want executed ( defined in the run() method ).
assertLevel - - The assert level of when to run the method

fail

public void fail()
Fails by throwing an AssertionFailedError.


fail

public void fail(String message)
Fails by throwing an AssertionFailedError with a message

Parameters:
message - - The message to display on failure.

fail

public void fail(int assertLevel)
Fails by throwing an AssertionFailedError with a message

Parameters:
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

fail

public void fail(String message,
                 int assertLevel)
Fails by throwing an AssertionFailedError with a message

Parameters:
message - - The message to display on failure.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTrue

public void assertTrue(boolean condition)
Asserts that a condition is true.

Parameters:
condition - - The boolean condition to test.

assertTrue

public void assertTrue(String message,
                       boolean condition)
Asserts that a condition is true.

Parameters:
message - - The message to print out if the assert fails
condition - - The boolean condition to test.

assertTrue

public void assertTrue(boolean condition,
                       int assertLevel)
Asserts that a condition is true.

Parameters:
condition - - The boolean condition to test.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTrue

public void assertTrue(String message,
                       boolean condition,
                       int assertLevel)
Asserts that a condition is true.

Parameters:
message - - The message to print out if the assert fails
condition - - The boolean condition to test.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertFalse

public void assertFalse(boolean condition)
Asserts that a condition is false.

Parameters:
condition - - The boolean condition to test.

assertFalse

public void assertFalse(String message,
                        boolean condition)
Asserts that a condition is false.

Parameters:
message - - The message to print out if the assert fails
condition - - The boolean condition to test.

assertFalse

public void assertFalse(boolean condition,
                        int assertLevel)
Asserts that a condition is false.

Parameters:
condition - - The boolean condition to test.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertFalse

public void assertFalse(String message,
                        boolean condition,
                        int assertLevel)
Asserts that a condition is false.

Parameters:
message - - The message to print out if the assert fails
condition - - The boolean condition to test.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextContains

public void assertTextContains(String text,
                               String textContained)
Asserts that two objects are equal.

Parameters:
text - - The text to be compared
textContained - - the text to be contained

assertTextContains

public void assertTextContains(String message,
                               String text,
                               String textContained)
Asserts that two objects are equal.

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
textContained - - the text to be contained

assertTextContains

public void assertTextContains(String text,
                               String textContained,
                               int assertLevel)
Asserts that two objects are equal.

Parameters:
text - - The text to be compared
textContained - - the text to be contained
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextContains

public void assertTextContains(String message,
                               String text,
                               String textContained,
                               int assertLevel)
Asserts text is contained into some given text.

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
textContained - - the text to be contained
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextStartsWith

public void assertTextStartsWith(String text,
                                 String startingText)
Asserts that the given startingText begins the given text..

Parameters:
text - - The text to be compared
startingText - - the text that must be at the beginning.

assertTextStartsWith

public void assertTextStartsWith(String message,
                                 String text,
                                 String startingText)
Asserts that the given startingText begins the given text..

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
startingText - - the text that must be at the beginning.

assertTextStartsWith

public void assertTextStartsWith(String text,
                                 String startingText,
                                 int assertLevel)
Asserts that the given startingText begins the given text..

Parameters:
text - - The text to be compared
startingText - - the text that must be at the beginning.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextStartsWith

public void assertTextStartsWith(String message,
                                 String text,
                                 String startingText,
                                 int assertLevel)
Asserts that the given startingText begins the given text..

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
startingText - - the text that must be at the beginning.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextEndsWith

public void assertTextEndsWith(String text,
                               String endingText)
Asserts that the given endingText is at the end of the given text..

Parameters:
text - - The text to be compared
endingText - - the text that must be at the end.

assertTextEndsWith

public void assertTextEndsWith(String message,
                               String text,
                               String endingText)
Asserts that the given endingText is at the end of the given text..

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
endingText - - the text that must be at the end.

assertTextEndsWith

public void assertTextEndsWith(String text,
                               String endingText,
                               int assertLevel)
Asserts that the given endingText is at the end of the given text..

Parameters:
text - - The text to be compared
endingText - - the text that must be at the end.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertTextEndsWith

public void assertTextEndsWith(String message,
                               String text,
                               String endingText,
                               int assertLevel)
Asserts text is contained into some given text.

Parameters:
message - - The message to print out if the assert fails
text - - The text to be compared
endingText - - the text that must be at the end.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(Object expected,
                         Object actual)
Asserts that two objects are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         Object expected,
                         Object actual)
Asserts that two objects are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(Object expected,
                         Object actual,
                         int assertLevel)
Asserts that two objects are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         Object expected,
                         Object actual,
                         int assertLevel)
Asserts that two objects are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String expected,
                         String actual)
Asserts that two Strings are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         String expected,
                         String actual)
Asserts that two Strings are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String expected,
                         String actual,
                         int assertLevel)
Asserts that two Strings are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         String expected,
                         String actual,
                         int assertLevel)
Asserts that two Strings are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(double expected,
                         double actual,
                         double delta)
Asserts that two doubles are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.

assertEquals

public void assertEquals(String message,
                         double expected,
                         double actual,
                         double delta)
Asserts that two doubles are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.

assertEquals

public void assertEquals(double expected,
                         double actual,
                         double delta,
                         int assertLevel)
Asserts that two doubles are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         double expected,
                         double actual,
                         double delta,
                         int assertLevel)
Asserts that two doubles are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(float expected,
                         float actual,
                         float delta)
Asserts that two floats are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.

assertEquals

public void assertEquals(String message,
                         float expected,
                         float actual,
                         float delta)
Asserts that two floats are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.

assertEquals

public void assertEquals(float expected,
                         float actual,
                         float delta,
                         int assertLevel)
Asserts that two floats are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         float expected,
                         float actual,
                         float delta,
                         int assertLevel)
Asserts that two floats are equal concerning a delta. If the expected value is infinity then the delta value is ignored.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
delta - - The amount the expected and actual can be different from each other.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(long expected,
                         long actual)
Asserts that two longs are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         long expected,
                         long actual)
Asserts that two longs are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(long expected,
                         long actual,
                         int assertLevel)
Asserts that two longs are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         long expected,
                         long actual,
                         int assertLevel)
Asserts that two longs are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(boolean expected,
                         boolean actual)
Asserts that two booleans are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         boolean expected,
                         boolean actual)
Asserts that two booleans are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(boolean expected,
                         boolean actual,
                         int assertLevel)
Asserts that two booleans are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         boolean expected,
                         boolean actual,
                         int assertLevel)
Asserts that two booleans are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(byte expected,
                         byte actual)
Asserts that two bytes are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         byte expected,
                         byte actual)
Asserts that two bytes are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(byte expected,
                         byte actual,
                         int assertLevel)
Asserts that two bytes are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         byte expected,
                         byte actual,
                         int assertLevel)
Asserts that two bytes are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(char expected,
                         char actual)
Asserts that two chars are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         char expected,
                         char actual)
Asserts that two chars are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(char expected,
                         char actual,
                         int assertLevel)
Asserts that two chars are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         char expected,
                         char actual,
                         int assertLevel)
Asserts that two chars are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(short expected,
                         short actual)
Asserts that two shorts are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         short expected,
                         short actual)
Asserts that two shorts are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(short expected,
                         short actual,
                         int assertLevel)
Asserts that two shorts are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         short expected,
                         short actual,
                         int assertLevel)
Asserts that two shorts are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(int expected,
                         int actual)
Asserts that two ints are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(String message,
                         int expected,
                         int actual)
Asserts that two ints are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertEquals

public void assertEquals(int expected,
                         int actual,
                         int assertLevel)
Asserts that two ints are equal.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertEquals

public void assertEquals(String message,
                         int expected,
                         int actual,
                         int assertLevel)
Asserts that two ints are equal.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNotNull

public void assertNotNull(Object object)
Asserts that an object isn't null.

Parameters:
object - - The object to test for null

assertNotNull

public void assertNotNull(String message,
                          Object object)
Asserts that an object isn't null.

Parameters:
message - - The message to print out if the assert fails
object - - The object to test for null

assertNotNull

public void assertNotNull(Object object,
                          int assertLevel)
Asserts that an object isn't null.

Parameters:
object - - The object to test for null
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNotNull

public void assertNotNull(String message,
                          Object object,
                          int assertLevel)
Asserts that an object isn't null.

Parameters:
message - - The message to print out if the assert fails
object - - The object to test for null
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNull

public void assertNull(Object object)
Asserts that an object is null.

Parameters:
object - - The object to test for null

assertNull

public void assertNull(String message,
                       Object object)
Asserts that an object is null.

Parameters:
message - - The message to print out if the assert fails
object - - The object to test for null

assertNull

public void assertNull(Object object,
                       int assertLevel)
Asserts that an object is null.

Parameters:
object - - The object to test for null
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNull

public void assertNull(String message,
                       Object object,
                       int assertLevel)
Asserts that an object is null.

Parameters:
message - - The message to print out if the assert fails
object - - The object to test for null
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertRegexMatches

public void assertRegexMatches(String text,
                               String regex)
Asserts that given regex matches the provided text

Parameters:
text - - The text to match the regex against
regex - - The regex to match.

assertRegexMatches

public void assertRegexMatches(String message,
                               String text,
                               String regex)
Asserts that given regex matches the provided text

Parameters:
message - - The message to print out if the assert fails
text - - The text to match the regex against
regex - - The regex to match.

assertRegexMatches

public void assertRegexMatches(String text,
                               String regex,
                               int assertLevel)
Asserts that given regex matches the provided text

Parameters:
text - - The text to match the regex against
regex - - The regex to match.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertRegexMatches

public void assertRegexMatches(String message,
                               String text,
                               String regex,
                               int assertLevel)
Asserts that given regex matches the provided text

Parameters:
message - - The message to print out if the assert fails
text - - The text to match the regex against
regex - - The regex to match.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertSame

public void assertSame(Object expected,
                       Object actual)
Asserts that two objects refer to the same object.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertSame

public void assertSame(String message,
                       Object expected,
                       Object actual)
Asserts that two objects refer to the same object.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertSame

public void assertSame(Object expected,
                       Object actual,
                       int assertLevel)
Asserts that two objects refer to the same object.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertSame

public void assertSame(String message,
                       Object expected,
                       Object actual,
                       int assertLevel)
Asserts that two objects refer to the same object.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNotSame

public void assertNotSame(Object expected,
                          Object actual)
Asserts that two objects refer to the same object.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertNotSame

public void assertNotSame(String message,
                          Object expected,
                          Object actual)
Asserts that two objects refer to the same object.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.

assertNotSame

public void assertNotSame(Object expected,
                          Object actual,
                          int assertLevel)
Asserts that two objects refer to the same object.

Parameters:
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

assertNotSame

public void assertNotSame(String message,
                          Object expected,
                          Object actual,
                          int assertLevel)
Asserts that two objects refer to the same object.

Parameters:
message - - The message to print out if the assert fails
expected - - The expected value.
actual - - The value to compare against the expected or the actual value.
assertLevel - - Only run this test under the assertLevel as described in AssertLevel

addParam

public void addParam(Object param)
Adds a ParamTag to the list of parameters

Parameters:
param - - the ParamTag to add

getParam

public Object getParam(int index)
Gets the nth ParamTag.

Parameters:
index - - the index location of the desired ParamTag.
Returns:
the ParamTag located at index

getParams

public List getParams()
Gets the list of ParamTags under this tag.

Returns:
the list of ParamTags under this tag.

getParamLength

public int getParamLength()
Gets the number of ParamTags under this tag.

Returns:
the number of ParamTags under this tag.

delay

public void delay()

delay

public void delay(long delayTime)


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.