org.apache.struts.mock
Class MockActionServlet

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by org.apache.struts.action.ActionServlet
              extended by org.apache.struts.mock.MockActionServlet
All Implemented Interfaces:
Serializable, Servlet, ServletConfig

public class MockActionServlet
extends ActionServlet

Mock ActionServlet object for low-level unit tests of Struts controller components. Coarser grained tests should be implemented in terms of the Cactus framework, instead of the mock object classes.

WARNING - Only getter methods for servletContext and servletConfig are provided, plus additional methods to configure this object as necessary. Methods for unsupported operations will throw UnsupportedOperationException.

WARNING - Because unit tests operate in a single threaded environment, no synchronization is performed.

Version:
$Rev: 471754 $ $Date: 2005-05-14 02:09:06 -0400 (Sat, 14 May 2005) $
See Also:
Serialized Form

Field Summary
protected  ServletConfig servletConfig
           
protected  ServletContext servletContext
           
 
Fields inherited from class org.apache.struts.action.ActionServlet
chainConfig, config, configDigester, convertNull, internal, internalName, log, registrations, servletMapping, servletName
 
Constructor Summary
MockActionServlet()
          Constructor.
MockActionServlet(ServletContext servletContext, ServletConfig servletConfig)
          Constructor.
 
Method Summary
 ServletConfig getServletConfig()
           Get property
 ServletContext getServletContext()
           Get property
 void initInternal()
           Expose as public so that test classes can exercise things which retrieve messages.
 void setServletConfig(ServletConfig servletConfig)
           Set property
 void setServletContext(ServletContext servletContext)
           Set property
 
Methods inherited from class org.apache.struts.action.ActionServlet
addServletMapping, destroy, destroyConfigDigester, destroyInternal, destroyModules, doGet, doPost, getInternal, getModuleConfig, getRequestProcessor, init, initChain, initConfigDigester, initModuleActions, initModuleConfig, initModuleConfigFactory, initModuleExceptionConfigs, initModuleFormBeans, initModuleForwards, initModuleMessageResources, initModulePlugIns, initModulePrefixes, initOther, initServlet, parseModuleConfigFile, parseModuleConfigFile, process, processActionConfigClass, processActionConfigExtension, processExceptionConfigClass, processExceptionExtension, processFormBeanConfigClass, processFormBeanExtension, processForwardConfigClass, processForwardExtension, splitAndResolvePaths
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletContext

protected ServletContext servletContext

servletConfig

protected ServletConfig servletConfig
Constructor Detail

MockActionServlet

public MockActionServlet(ServletContext servletContext,
                         ServletConfig servletConfig)

Constructor.


MockActionServlet

public MockActionServlet()

Constructor.

Method Detail

setServletContext

public void setServletContext(ServletContext servletContext)

Set property

Parameters:
servletContext -

getServletContext

public ServletContext getServletContext()

Get property

Specified by:
getServletContext in interface ServletConfig
Overrides:
getServletContext in class GenericServlet
Returns:

setServletConfig

public void setServletConfig(ServletConfig servletConfig)

Set property

Parameters:
servletConfig -

getServletConfig

public ServletConfig getServletConfig()

Get property

Specified by:
getServletConfig in interface Servlet
Overrides:
getServletConfig in class GenericServlet
Returns:

initInternal

public void initInternal()
                  throws ServletException

Expose as public so that test classes can exercise things which retrieve messages.

Overrides:
initInternal in class ActionServlet
Throws:
ServletException - if we cannot initialize these resources
UnavailableException - if we cannot load resources


Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.