net.sf.jameleon.plugin.htmlunit
Class HtmlUnitSessionTag

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.htmlunit.HtmlUnitSessionTag
All Implemented Interfaces:
Attributable, HtmlUnitDelegate, DataDrivableResultRecordable, FunctionResultRecordable, Storable, DynaTag, LocationAware, Tag

public class HtmlUnitSessionTag
extends SessionTag
implements HtmlUnitDelegate

A Session tag for the HtmlUnit plug-in. An example of its use might:


 <testcase xmlns="jelly:jameleon">
     <htmlunit-session baseUrl="http://www.google.com" beginSession="true">
       <htmlunit-validate
           functionId="Check that title is Google."
           title="Google"/>
     </htmlunit-session>
 </testcase>
 

Tag Name: <htmlunit-session>

Field Summary
static String BASE_URL
           
protected  String baseUrl
          The url to use when starting the browser.
static String BEGIN_AT
           
protected  String beginAt
          If set, this would be the path after the protocol and/or domain.
protected  Boolean enableSslCertCheck
          Enable or disable validity checking of SSL certificates.
protected  Integer enableSslCertCheckPort
          The port to use to connect to https.
protected  HtmlUnitHelper htmlHelper
           
protected  WebClient session
           
 
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
HtmlUnitSessionTag()
           
 
Method Summary
protected  void deregisterStorable()
          Deregister this tag as a storable
 WebWindow getCurrentWebWindow()
          Gets a handle on the current web window.
 int getEnableSslCertCheckPort()
          Return the port on which to register the enableSslCertCheck on.
protected  String getRequestUrl()
          Gets the url to request
 WebClient getSession()
          Gets the current WebClient or the handle on the session
 WebClient getWebClient()
          Gets a handle on the WebClient instance used in this session
 HtmlForm getWorkingForm()
          Gets a handle on the WebClient instance used in this session
 boolean isEnableSslCertCheck()
          Query whether SSL cert validity checking is enabled.
protected  void registerStorable()
          Register this tag as a storable
 void setUpSession()
           
 void startApplication()
          Loads the URL given by beginAt and baseUrl.
 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

BASE_URL

public static final String BASE_URL
See Also:
Constant Field Values

BEGIN_AT

public static final String BEGIN_AT
See Also:
Constant Field Values

session

protected WebClient session

htmlHelper

protected HtmlUnitHelper htmlHelper

enableSslCertCheck

protected Boolean enableSslCertCheck
Enable or disable validity checking of SSL certificates. If "false", invalid SSL certs will be accepted. If not set, the default is "true".

This attribute is recognized by Jameleon
Context Name: htmlUnitEnableSslCertCheck

baseUrl

protected String baseUrl
The url to use when starting the browser. This can be the entire URL including the path or not, but it must start with the protocol (e.g. http://some.domain.com)

This attribute is recognized by Jameleon
Context Name: baseUrl

beginAt

protected String beginAt
If set, this would be the path after the protocol and/or domain. (e.g. /some/path/to/a/file.html)

This attribute is recognized by Jameleon
Context Name: beginAt

enableSslCertCheckPort

protected Integer enableSslCertCheckPort
The port to use to connect to https. Usually leaving it as the default should do.

This attribute is recognized by Jameleon
Default Value: 443
Context Name: htmlUnitEnableSslCertCheckPort
Constructor Detail

HtmlUnitSessionTag

public HtmlUnitSessionTag()
Method Detail

setUpSession

public void setUpSession()
Overrides:
setUpSession in class SessionTag

tearDownSession

public void tearDownSession()
Overrides:
tearDownSession in class SessionTag

deregisterStorable

protected void deregisterStorable()
Deregister this tag as a storable


getRequestUrl

protected String getRequestUrl()
Gets the url to request

Returns:
The URL to use in startApplication.

getSession

public WebClient getSession()
Gets the current WebClient or the handle on the session

Returns:
the current browser.

getEnableSslCertCheckPort

public int getEnableSslCertCheckPort()
Return the port on which to register the enableSslCertCheck on.


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.

registerStorable

protected void registerStorable()
Register this tag as a storable


startApplication

public void startApplication()
Loads the URL given by beginAt and baseUrl.

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

getCurrentWebWindow

public WebWindow getCurrentWebWindow()
Gets a handle on the current web window.

Specified by:
getCurrentWebWindow in interface HtmlUnitDelegate
Returns:
WebWindow

getWebClient

public WebClient getWebClient()
Gets a handle on the WebClient instance used in this session

Specified by:
getWebClient in interface HtmlUnitDelegate
Returns:
WebClient

getWorkingForm

public HtmlForm getWorkingForm()
Gets a handle on the WebClient instance used in this session

Specified by:
getWorkingForm in interface HtmlUnitDelegate
Returns:
WebClient


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