net.sf.jameleon.plugin.httpunit
Class HttpUnitSessionTag

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.SessionTag
                  extended by net.sf.jameleon.plugin.httpunit.HttpUnitSessionTag
All Implemented Interfaces:
Attributable, DataDrivableResultRecordable, FunctionResultRecordable, Storable, DynaTag, LocationAware, Tag

public class HttpUnitSessionTag
extends SessionTag

This is a HttpUnit implementation of the @see SessionTag. It basically starts the application in the state provided by the baseUrl and beginAt variables and creates a new session for the function points to share. There is an extra property for this session to enable proxy support

Both of these fields must be supplied before proxy support will be enabled.

Tag Name: <hu-session>
Tag Name: <httpunit-session>

Field Summary
protected  boolean acceptCookies
           
protected  boolean acceptGzip
           
protected  String applicationCodeName
           
protected  String applicationName
           
protected  String applicationVersion
           
protected  boolean autoRedirect
           
protected  boolean autoRefresh
           
protected  int availableScreenWidth
           
protected  int availHeight
           
protected  boolean cookieDomainMatchingStrict
           
protected  boolean enableHttpUnitProxy
          Enables proxy support.
protected  boolean enableScripting
           
protected  boolean exceptionsThrownOnScriptError
           
protected  WebConversation httpSession
          The session of the function points being tested.
protected  boolean iframeSupported
           
protected  String platform
           
protected  StateStorer state
           
protected  String userAgent
           
 
Fields inherited from class net.sf.jameleon.SessionTag
addt, application, beginSession, log, organization, postcondition, props, sessionDelay, sessionResults, 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
HttpUnitSessionTag()
           
 
Method Summary
protected  void enableProxyServer()
          enables proxy support if the parameters have been filled
 boolean getExceptionsThrownOnScriptError()
          Tells whether scripting exceptions are thrown on errors.
 WebConversation getHttpSession()
           
 boolean isEnableHttpUnitProxy()
          Query whether proxy support is enabled.
 boolean isEnableSslCertCheck()
          Query whether SSL cert validity checking is enabled.
 boolean isScriptingEnabled()
          Tells whether scripting is enabled or disabled
 void setAcceptCookies(boolean acceptCookies)
          Sets the attribute to accept cookies or not..
 void setAcceptGzip(boolean acceptGzip)
          Enables or disables gzip
 void setApplicationCodeName(String applicationCodeName)
          Sets the application code name.
 void setApplicationName(String applicationName)
          Sets the application name.
 void setApplicationVersion(String applicationVersion)
          Sets the application version.
 void setAutoRedirect(boolean autoRedirect)
          Enables or disables auto-redirect.
 void setAutoRefresh(boolean autoRefresh)
          Enables or disables autorefresh.
 void setAvailableScreenWidth(int availableScreenWidth)
          Sets the available screen width.
 void setAvailHeight(int availHeight)
          Sets the available height.
 void setBaseUrl(String baseUrl)
          Sets the base url to where the application begins.
 void setBeginAt(String beginAt)
          Sets the ending path of the url to start at.
protected  void setClientProperties()
           
 void setCookieDomainMatchingStrict(boolean cookieDomainMatchingStrict)
          Sets cookie domain matching strict option to true or false
 void setEnableHttpUnitProxy(boolean enable)
          this field can enable and dissable proxy support.
 void setEnableScripting(boolean enableScripting)
          Enables or disables scripting support for HttpUnit.
 void setEnableSslCertCheck(boolean enable)
          Enable or disable validity checking of SSL certificates.
 void setExceptionsThrownOnScriptError(boolean exceptionsThrownOnScriptError)
          Enables or disables scripting exceptions on errors.
 void setHttpUnitBasicPassword(String httpUnitBasicPassword)
          Sets the password required for basic authentication
 void setHttpUnitBasicUsername(String httpUnitBasicUsername)
          Sets the username required for basic authentication
 void setHttpUnitProxyHost(String httpUnitProxyHost)
          Sets the host name of the proxy used to intercept requests and responses.
 void setHttpUnitProxyPassword(String httpUnitProxyPassword)
          Sets the password of the proxy used to intercept requests and responses.
 void setHttpUnitProxyPort(String httpUnitProxyPort)
          Sets the port of the proxy used to intercept requests and responses.
 void setHttpUnitProxyUser(String httpUnitProxyUser)
          Sets the user of the proxy used to intercept requests and responses.
 void setIframeSupported(boolean iframeSupported)
          Enables or disables iframe support.
 void setPlatform(String platform)
          Sets the platform.
 void setUpSession()
           
 void setUserAgent(String userAgent)
          Sets the user agent.
 void startApplication()
          Used for the plug-in to implement if something special is required during the session setup.
 void store(String fName, int event)
           
 void tearDownSession()
           
 
Methods inherited from class net.sf.jameleon.SessionTag
delaySession, doTag, findParentTestCase, getApplication, getOrganization, getSessionResult, getStoreToFileName, init, recordDataDrivableResult, recordFunctionResult, recordResult, removeChildlessResult, setOrganization, setSessionDelay, tearDown, trace, traceMsg
 
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

httpSession

protected WebConversation httpSession
The session of the function points being tested. This gives full access to the HttpUnit API.


enableHttpUnitProxy

protected boolean enableHttpUnitProxy
Enables proxy support.


state

protected StateStorer state

enableScripting

protected boolean enableScripting

acceptCookies

protected boolean acceptCookies

autoRefresh

protected boolean autoRefresh

exceptionsThrownOnScriptError

protected boolean exceptionsThrownOnScriptError

acceptGzip

protected boolean acceptGzip

applicationCodeName

protected String applicationCodeName

applicationName

protected String applicationName

applicationVersion

protected String applicationVersion

autoRedirect

protected boolean autoRedirect

cookieDomainMatchingStrict

protected boolean cookieDomainMatchingStrict

availableScreenWidth

protected int availableScreenWidth

availHeight

protected int availHeight

iframeSupported

protected boolean iframeSupported

platform

protected String platform

userAgent

protected String userAgent
Constructor Detail

HttpUnitSessionTag

public HttpUnitSessionTag()
Method Detail

getHttpSession

public WebConversation getHttpSession()
Returns:
the session which is shared among all HttpUnitFunctionTags encapsulated inside this testcase

setUpSession

public void setUpSession()
Overrides:
setUpSession in class SessionTag

setClientProperties

protected void setClientProperties()

tearDownSession

public void tearDownSession()
Overrides:
tearDownSession in class SessionTag

startApplication

public void startApplication()
Used for the plug-in to implement if something special is required during the session setup.

Overrides:
startApplication in class SessionTag

store

public void store(String fName,
                  int event)
           throws IOException
Specified by:
store in interface Storable
Overrides:
store in class SessionTag
Throws:
IOException

setAcceptCookies

public void setAcceptCookies(boolean acceptCookies)
Sets the attribute to accept cookies or not..

Parameters:
acceptCookies - - Set to false to ignore all cookies.This attribute is recognized by Jameleon
Default Value: true

setAutoRefresh

public void setAutoRefresh(boolean autoRefresh)
Enables or disables autorefresh. Default is to disable it (false).

Parameters:
autoRefresh - - set to "true" or "yes" to enable autorefresh.This attribute is recognized by Jameleon
Default Value: false

setAcceptGzip

public void setAcceptGzip(boolean acceptGzip)
Enables or disables gzip

Parameters:
acceptGzip - - set to "false"to disable gzip.This attribute is recognized by Jameleon
Default Value: true

setApplicationCodeName

public void setApplicationCodeName(String applicationCodeName)
Sets the application code name. Please see the HttpUnit API docs for what this means.

Parameters:
applicationCodeName - - the application code name.This attribute is recognized by Jameleon

setApplicationName

public void setApplicationName(String applicationName)
Sets the application name. Please see the HttpUnit API docs for what this means.

Parameters:
applicationName - - the application name.This attribute is recognized by Jameleon

setApplicationVersion

public void setApplicationVersion(String applicationVersion)
Sets the application version. Please see the HttpUnit API docs for what this means.

Parameters:
applicationVersion - - the application version.This attribute is recognized by Jameleon

setAutoRedirect

public void setAutoRedirect(boolean autoRedirect)
Enables or disables auto-redirect.

Parameters:
autoRedirect - - set to "false" to disable auto-redirect.This attribute is recognized by Jameleon
Default Value: true

setAvailableScreenWidth

public void setAvailableScreenWidth(int availableScreenWidth)
Sets the available screen width.

Parameters:
availableScreenWidth - - The available screen width of the browser.This attribute is recognized by Jameleon

setAvailHeight

public void setAvailHeight(int availHeight)
Sets the available height.

Parameters:
availHeight - - The available height of the browser,This attribute is recognized by Jameleon

setCookieDomainMatchingStrict

public void setCookieDomainMatchingStrict(boolean cookieDomainMatchingStrict)
Sets cookie domain matching strict option to true or false

Parameters:
cookieDomainMatchingStrict - - set to false to disable cookie domain matching,This attribute is recognized by Jameleon
Default Value: true

setIframeSupported

public void setIframeSupported(boolean iframeSupported)
Enables or disables iframe support.

Parameters:
iframeSupported - - set to "false" to disable iframe support.This attribute is recognized by Jameleon
Default Value: true

setPlatform

public void setPlatform(String platform)
Sets the platform. Please see the HttpUnit API docs for what this means.

Parameters:
platform - - the platform,This attribute is recognized by Jameleon

setUserAgent

public void setUserAgent(String userAgent)
Sets the user agent. Please see the HttpUnit API docs for what this means.

Parameters:
userAgent - - the user agent.,This attribute is recognized by Jameleon

setBeginAt

public void setBeginAt(String beginAt)
Sets the ending path of the url to start at.

Parameters:
beginAt - - the ending path of the url to start at. For example, if the URL to start at is http://sf.net/projects/jameleon, then the baseUrl would be http://sf.net/ and the beginAt would be /projects/jameleon. This variable is optional This value is set and used from the context. In other words, this value can be set via an Applications.properties file or a CSV file.This attribute is recognized by Jameleon

setBaseUrl

public void setBaseUrl(String baseUrl)
Sets the base url to where the application begins.

Parameters:
baseUrl - - protocol, and hostname of the URL. For example, if the URL to start at is http://sf.net/projects/jameleon, then the baseUrl would be http://sf.net/ and the beginAt would be /projects/jameleon. This value is set and used from the context. In other words, this value can be set via an Applications.properties file or a CSV file.This attribute is recognized by Jameleon

setHttpUnitProxyHost

public void setHttpUnitProxyHost(String httpUnitProxyHost)
Sets the host name of the proxy used to intercept requests and responses.

Parameters:
httpUnitProxyHost - - the host name of the proxy used to intercept requests and responses.This attribute is recognized by Jameleon

setHttpUnitProxyPort

public void setHttpUnitProxyPort(String httpUnitProxyPort)
Sets the port of the proxy used to intercept requests and responses.

Parameters:
httpUnitProxyPort - - the port of the proxy used to intercept requests and responses.This attribute is recognized by Jameleon

setHttpUnitBasicUsername

public void setHttpUnitBasicUsername(String httpUnitBasicUsername)
Sets the username required for basic authentication

Parameters:
httpUnitBasicUsername - - the username required for basic authenticationThis attribute is recognized by Jameleon

setHttpUnitBasicPassword

public void setHttpUnitBasicPassword(String httpUnitBasicPassword)
Sets the password required for basic authentication

Parameters:
httpUnitBasicPassword - - the password required for basic authenticationThis attribute is recognized by Jameleon

setHttpUnitProxyUser

public void setHttpUnitProxyUser(String httpUnitProxyUser)
Sets the user of the proxy used to intercept requests and responses.

Parameters:
httpUnitProxyUser - - the user of the proxy used to intercept requests and responses.This attribute is recognized by Jameleon

setHttpUnitProxyPassword

public void setHttpUnitProxyPassword(String httpUnitProxyPassword)
Sets the password of the proxy used to intercept requests and responses.

Parameters:
httpUnitProxyPassword - - the user of the proxy used to intercept requests and responses.This attribute is recognized by Jameleon

setEnableHttpUnitProxy

public void setEnableHttpUnitProxy(boolean enable)
this field can enable and dissable proxy support.

Parameters:
enable - - set to "true" or "yes" to enable proxy support, set to "yes" or "no" to disable proxy. Defaults to "false"This attribute is recognized by Jameleon

setEnableScripting

public void setEnableScripting(boolean enableScripting)
Enables or disables scripting support for HttpUnit.

Parameters:
enableScripting - - set to "true" or "yes" to enable scripting support, set to "false" or "no" to disable scripting. Defaults to "true"This attribute is recognized by Jameleon

setExceptionsThrownOnScriptError

public void setExceptionsThrownOnScriptError(boolean exceptionsThrownOnScriptError)
Enables or disables scripting exceptions on errors.

Parameters:
exceptionsThrownOnScriptError - - set to "true" or "yes" to enable exceptions on script errors. Set to "false" or "no" to disable exceptions on script errors. Defaults to "true".This attribute is recognized by Jameleon

getExceptionsThrownOnScriptError

public boolean getExceptionsThrownOnScriptError()
Tells whether scripting exceptions are thrown on errors.

Returns:
true if exceptions are thrown on script errrors or false if exceptions are not to be thrown on script errors.

isScriptingEnabled

public boolean isScriptingEnabled()
Tells whether scripting is enabled or disabled

Returns:
true is scripting is enabled, false if scripting is disabled.

isEnableHttpUnitProxy

public boolean isEnableHttpUnitProxy()
Query whether proxy support is enabled.

Returns:
a string "true" or "false"

isEnableSslCertCheck

public boolean isEnableSslCertCheck()
Query whether SSL cert validity checking is enabled.

Returns:
- If true, an exception will be thrown when an invalid SSL cert is encountered. If false, invalid SSL certs will be accepted.

setEnableSslCertCheck

public void setEnableSslCertCheck(boolean enable)
Enable or disable validity checking of SSL certificates.

Parameters:
enable - - If "true", an exception will be thrown when an invalid SSL cert is encountered. If "false", invalid SSL certs will be accepted. If not set, the default is "true".This attribute is recognized by Jameleon

enableProxyServer

protected void enableProxyServer()
enables proxy support if the parameters have been filled



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