servletunit.struts
Class Common

java.lang.Object
  extended byservletunit.struts.Common

public class Common
extends java.lang.Object

Contains code common to both MockStrutsTestCase and CactusStrutsTestCase. It's always good to get rid of redundancy!


Field Summary
protected static java.lang.String INCLUDE_SERVLET_PATH
           
protected static Log logger
           
 
Constructor Summary
Common()
           
 
Method Summary
protected static ForwardConfig findForward(java.lang.String mappingName, java.lang.String forwardName, HttpServletRequest request, ServletContext context)
          Returns a ForwardConfig for the given forward name.
protected static ActionConfig getActionConfig(java.lang.String mappingName, HttpServletRequest request, ServletContext context)
          Returns the configuration for the given action mapping.
protected static ActionForm getActionForm(java.lang.String actionPath, HttpServletRequest request, ServletContext context)
          Returns any ActionForm instance stored in the request or session, if available.
protected static ModuleConfig getModuleConfig(HttpServletRequest request, ServletContext context)
          Returns the configuration for the current module.
protected static ComponentDefinition getTilesForward(java.lang.String forwardPath, HttpServletRequest request, ServletContext context, ServletConfig config)
          Retrieves a forward uri for tile - this is required for applications using the tiles framework, since the actual forward URI must be fetched from the tile definition.
protected static void setActionForm(ActionForm form, HttpServletRequest request, java.lang.String actionPath, ServletContext context)
          Sets an ActionForm instance in the request.
protected static java.lang.String stripActionPath(java.lang.String path)
          Strips off *.do from action paths specified as such.
protected static java.lang.String stripJSessionID(java.lang.String path)
          Strip ;jsessionid= from path.
protected static void verifyActionMessages(HttpServletRequest request, java.lang.String[] messageNames, java.lang.String key, java.lang.String messageLabel)
          Common method to verify action errors and action messages.
protected static void verifyForwardPath(java.lang.String actionPath, java.lang.String forwardName, java.lang.String actualForwardPath, boolean isInputPath, HttpServletRequest request, ServletContext context, ServletConfig config)
          Verifies that ActionServlet used this logical forward or input mapping.
protected static void verifyNoActionMessages(HttpServletRequest request, java.lang.String key, java.lang.String messageLabel)
          Common method to verify action errors and action messages.
protected static void verifyTilesForward(java.lang.String actionPath, java.lang.String forwardName, java.lang.String expectedDefinition, boolean isInputPath, HttpServletRequest request, ServletContext context, ServletConfig config)
          Verifies that ActionServlet used this logical forward or input mapping with this tile definition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INCLUDE_SERVLET_PATH

protected static final java.lang.String INCLUDE_SERVLET_PATH

logger

protected static Log logger
Constructor Detail

Common

public Common()
Method Detail

verifyNoActionMessages

protected static void verifyNoActionMessages(HttpServletRequest request,
                                             java.lang.String key,
                                             java.lang.String messageLabel)
Common method to verify action errors and action messages.


verifyActionMessages

protected static void verifyActionMessages(HttpServletRequest request,
                                           java.lang.String[] messageNames,
                                           java.lang.String key,
                                           java.lang.String messageLabel)
Common method to verify action errors and action messages.


getTilesForward

protected static ComponentDefinition getTilesForward(java.lang.String forwardPath,
                                                     HttpServletRequest request,
                                                     ServletContext context,
                                                     ServletConfig config)
Retrieves a forward uri for tile - this is required for applications using the tiles framework, since the actual forward URI must be fetched from the tile definition.


verifyTilesForward

protected static void verifyTilesForward(java.lang.String actionPath,
                                         java.lang.String forwardName,
                                         java.lang.String expectedDefinition,
                                         boolean isInputPath,
                                         HttpServletRequest request,
                                         ServletContext context,
                                         ServletConfig config)
Verifies that ActionServlet used this logical forward or input mapping with this tile definition.

Throws:
junit.framework.AssertionFailedError - if the expected and actual tiles definitions do not match.

verifyForwardPath

protected static void verifyForwardPath(java.lang.String actionPath,
                                        java.lang.String forwardName,
                                        java.lang.String actualForwardPath,
                                        boolean isInputPath,
                                        HttpServletRequest request,
                                        ServletContext context,
                                        ServletConfig config)
Verifies that ActionServlet used this logical forward or input mapping.

Throws:
junit.framework.AssertionFailedError - if expected and actual paths do not match.

stripActionPath

protected static java.lang.String stripActionPath(java.lang.String path)
Strips off *.do from action paths specified as such.


stripJSessionID

protected static java.lang.String stripJSessionID(java.lang.String path)
Strip ;jsessionid= from path.

Returns:
stripped path

getActionForm

protected static ActionForm getActionForm(java.lang.String actionPath,
                                          HttpServletRequest request,
                                          ServletContext context)
Returns any ActionForm instance stored in the request or session, if available.


findForward

protected static ForwardConfig findForward(java.lang.String mappingName,
                                           java.lang.String forwardName,
                                           HttpServletRequest request,
                                           ServletContext context)
Returns a ForwardConfig for the given forward name. This method first searches for the forward in the supplied action mapping. If it is not defined there, or if the mapping is not provided, it searches for it globally.


getActionConfig

protected static ActionConfig getActionConfig(java.lang.String mappingName,
                                              HttpServletRequest request,
                                              ServletContext context)
Returns the configuration for the given action mapping.


getModuleConfig

protected static ModuleConfig getModuleConfig(HttpServletRequest request,
                                              ServletContext context)
Returns the configuration for the current module.


setActionForm

protected static void setActionForm(ActionForm form,
                                    HttpServletRequest request,
                                    java.lang.String actionPath,
                                    ServletContext context)
Sets an ActionForm instance in the request.



Copyright © Deryl Seale All Rights Reserved.