|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.jelly.TagSupport net.sf.jameleon.LocationAwareTagSupport net.sf.jameleon.JameleonTagSupport net.sf.jameleon.SessionTag
public abstract class SessionTag
A Session is the state of an application from one functional point to the next. In order to allow for independent functional points, a handle on the application's state must be kept between functional points. This handle is implemented differently for each application interface technology. Some examples of interfaces might be a GUI application implemented in Swing or .NET, an HTTP application or even a SQL inteface to the database.
A SessionTag is required for every interface, even those that don't require a handle on the application to be shared across the many functional points. There should still be a generic way to start and stop the application. A SessionTag is also a means to use only variables defined in Applications.properties that are pertinent to a particular application and it helps separate the autogenerated docs when accessing several applications in a test.
Implementing an interface-specific SessionTag includes implementing the following methods:
setUpSession()
- This method is called after @see #init() and should be used to create
all plug-in related resources and configure any plug-in/session specific
settings.
tearDownSession()
- This method is called right after all children tags have been executed
and should clean up any resources created by the session tagstartApplication()
- This method is used to start the application and is called only when
beginSession
is set to true
. If this method
doesn't make sense for the particular plug-in, then simply don't
implement it.If the application type being tested supplies some kind of handle, then the SessionTag is the appropriate place to keep it. Create an instance variable representing the application's handle and provide a public get and set method for it. The abstract function tag will then get an instance of this SessionTag and get the handle off the application.
This base class is interface agnostic and implements all Jameleon-specific behavior. The following is a list of supported attributes supported by this class:
SessionResult
.application
attribute in the appropriate session tag.organization
can also be set with the organization
attribute in either the test case or in the
appropriate session tag. This would only need to be set in the session if the organization is set in the the test case
the application being tested in this session is different from that in the test case.
Field Summary | |
---|---|
protected AbstractDataDrivableTag |
addt
|
protected String |
application
The name of the application being run according to the *-TestCaseTag.properties file |
protected boolean |
beginSession
Starts the applicattion and gets it to the state defined in the $testEnviroment-Applications.properties. |
protected static org.apache.log4j.Logger |
log
|
protected String |
organization
The organization (affiliate or company name) this application will be tested against. |
protected boolean |
postcondition
|
protected Properties |
props
|
protected long |
sessionDelay
Sets the tag to delay x milliseconds before anything else is executed. |
protected SessionResult |
sessionResults
|
protected TestCaseTag |
tc
|
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 | |
---|---|
SessionTag()
Default constructor. |
Method Summary | |
---|---|
protected void |
delaySession()
|
void |
doTag(XMLOutput out)
A TagSupport specific method. |
protected void |
findParentTestCase()
|
String |
getApplication()
The name of the application being run according to the *-TestCaseTag.properties file |
String |
getOrganization()
|
SessionResult |
getSessionResult()
|
String |
getStoreToFileName(int event)
Gets the filename to store the state of the application to. |
protected void |
init()
Grabs information about the application and the organization from the test case. |
void |
recordDataDrivableResult(DataDrivableResultContainer result)
Records a DataDrivableResultContainer to the tag's results |
void |
recordFunctionResult(FunctionResult result)
Records a FunctionResult to the tag's results and sets the FunctionResult's parent result to itself |
protected void |
recordResult(JameleonTestResult result)
|
protected void |
removeChildlessResult()
Removes the current result from its parent if it has no children, meaning the tags weren't actually run |
void |
setOrganization(String organization)
|
void |
setSessionDelay(long sessionDelay)
|
void |
setUpSession()
Is called before anything else specific to the interface is called. |
void |
startApplication()
Used for the plug-in to implement if something special is required during the session setup. |
void |
store(String filename,
int event)
Stores the current state of the object to a given File . |
protected void |
tearDown()
|
protected void |
tearDownSession()
Called when the session tag is closed. |
protected void |
trace(String msg)
Deprecated. - use traceMsg instead. |
protected void |
traceMsg(String msg)
Used for the trace functionality. |
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 |
---|
protected SessionResult sessionResults
protected String application
protected String organization
protected boolean postcondition
protected long sessionDelay
protected static org.apache.log4j.Logger log
protected Properties props
protected TestCaseTag tc
protected AbstractDataDrivableTag addt
protected boolean beginSession
false
Constructor Detail |
---|
public SessionTag()
Method Detail |
---|
public String getOrganization()
public void setOrganization(String organization)
public String getApplication()
public void setSessionDelay(long sessionDelay)
public void doTag(XMLOutput out) throws MissingAttributeException, JellyTagException
doTag
in interface Tag
MissingAttributeException
JellyTagException
protected void tearDown()
protected void trace(String msg)
protected void traceMsg(String msg)
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:
A listener is already registered for each function tag. All that is required is implementing this method.
store
in interface Storable
filename
- the name of the if the file to store the contents to.event
- The event
that occured (error, state change ...).
IOException
- If the state of the object could not be stored in File f
.public String getStoreToFileName(int event)
getStoreToFileName
in interface Storable
event
- - the StateStorer Event
protected void tearDownSession()
protected void findParentTestCase()
protected void init() throws MissingAttributeException
MissingAttributeException
public SessionResult getSessionResult()
public void setUpSession()
public void startApplication()
protected void delaySession()
protected void removeChildlessResult()
protected void recordResult(JameleonTestResult result)
public void recordFunctionResult(FunctionResult result)
recordFunctionResult
in interface FunctionResultRecordable
result
- public void recordDataDrivableResult(DataDrivableResultContainer result)
recordDataDrivableResult
in interface DataDrivableResultRecordable
result
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |