org.jboss.jsfunit.jsfsession
Class JSFSession

java.lang.Object
  extended by org.jboss.jsfunit.jsfsession.JSFSession

public class JSFSession
extends Object

This class starts and manages the JSF Session on both the client and server side.

Since:
1.0
Author:
Stan Silvert

Constructor Summary
JSFSession(String initialPage)
          Creates a new session for testing the JSF application.
JSFSession(WebClientSpec wcSpec)
          Creates a new session for testing the JSF application.
 
Method Summary
 JSFClientSession getJSFClientSession()
          Get the JSFClientSession instance used to access client-side JSF artifacts send requests to the server.
 JSFServerSession getJSFServerSession()
          Get the JSFServerSession instance used to access server-side JSF artifacts.
 Map getRedirectorRequestParams()
          Get an immutable Map of all request params sent to the ServletRedirector or ServletTestRunner.
 com.gargoylesoftware.htmlunit.WebClient getWebClient()
          Get the WebClient instance used to control client side requests.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSFSession

public JSFSession(String initialPage)
           throws IOException
Creates a new session for testing the JSF application. This constructor will also clear the HttpSession. Note that the initialPage param should be something that maps into the FacesServlet. In the case where the FacesServlet is extension mapped in web.xml, this param will be something like "/index.jsf" or "/index.faces". If the FacesServlet is path-mapped then the initialPage param will be something like "/faces/index.jsp".

Parameters:
initialPage - The page used to start a client session with JSF. Example: "/index.jsf"
Throws:
IOException - If there is an error calling the JSF app

JSFSession

public JSFSession(WebClientSpec wcSpec)
           throws IOException
Creates a new session for testing the JSF application. This constructor will also clear the HttpSession. Note that the initialPage param should be something that maps into the FacesServlet. In the case where the FacesServlet is extension mapped in web.xml, this param will be something like "/index.jsf" or "/index.faces". If the FacesServlet is path-mapped then the initialPage param will be something like "/faces/index.jsp".

Parameters:
webClient - An HtmlUnit WebClient containing custom attributes. Note that this WebClient instance should be created with the JSFUnit WebConversationFactory instead of the WebClient constructor.
initialPage - The page used to start a client session with JSF. Example: "/index.jsf"
Throws:
IOException - If there is an error calling the JSF app
Method Detail

getRedirectorRequestParams

public Map getRedirectorRequestParams()
Get an immutable Map of all request params sent to the ServletRedirector or ServletTestRunner. Note that the Map returned is the same one returned from ServletRequest.getParameterMap(). This Map is defined with a key of type String and a value of type String array - not plain String.

Returns:
The Map of params.
Since:
1.1

getWebClient

public com.gargoylesoftware.htmlunit.WebClient getWebClient()
Get the WebClient instance used to control client side requests.

Returns:
The WebClient instance used to control client side requests.

getJSFServerSession

public JSFServerSession getJSFServerSession()
Get the JSFServerSession instance used to access server-side JSF artifacts.

Returns:
The JSFServerSession

getJSFClientSession

public JSFClientSession getJSFClientSession()
Get the JSFClientSession instance used to access client-side JSF artifacts send requests to the server.

Parameters:
The - JSFClientSession


Copyright © 2007-2010 JBoss, a division of Red Hat, Inc.. All Rights Reserved.