|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.struts.mock.MockServletContext
public class MockServletContext
Mock ServletContext 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 the minimal set of methods needed to
create unit tests is 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.
| Field Summary | |
|---|---|
protected HashMap |
attributes
The set of servlet context attributes. |
protected org.apache.commons.logging.Log |
log
Default destination for LOG() output. |
protected HashMap |
parameters
The set of context initialization parameters. |
| Constructor Summary | |
|---|---|
MockServletContext()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HashMap attributes
The set of servlet context attributes.
protected org.apache.commons.logging.Log log
Default destination for LOG() output.
protected HashMap parameters
The set of context initialization parameters.
| Constructor Detail |
|---|
public MockServletContext()
| Method Detail |
|---|
public void addInitParameter(String name,
String value)
public void setLog(org.apache.commons.logging.Log log)
public Object getAttribute(String name)
getAttribute in interface javax.servlet.ServletContextpublic Enumeration getAttributeNames()
getAttributeNames in interface javax.servlet.ServletContextpublic javax.servlet.ServletContext getContext(String uripath)
getContext in interface javax.servlet.ServletContextpublic String getContextPath()
public String getInitParameter(String name)
getInitParameter in interface javax.servlet.ServletContextpublic Enumeration getInitParameterNames()
getInitParameterNames in interface javax.servlet.ServletContextpublic int getMajorVersion()
getMajorVersion in interface javax.servlet.ServletContextpublic String getMimeType(String file)
getMimeType in interface javax.servlet.ServletContextpublic int getMinorVersion()
getMinorVersion in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getNamedDispatcher(String name)
getNamedDispatcher in interface javax.servlet.ServletContextpublic String getRealPath(String path)
getRealPath in interface javax.servlet.ServletContextpublic javax.servlet.RequestDispatcher getRequestDispatcher(String path)
getRequestDispatcher in interface javax.servlet.ServletContextpublic URL getResource(String path)
getResource in interface javax.servlet.ServletContextpublic InputStream getResourceAsStream(String path)
getResourceAsStream in interface javax.servlet.ServletContextpublic Set getResourcePaths(String path)
getResourcePaths in interface javax.servlet.ServletContextpublic String getServerInfo()
getServerInfo in interface javax.servlet.ServletContextpublic javax.servlet.Servlet getServlet(String name)
getServlet in interface javax.servlet.ServletContextpublic String getServletContextName()
getServletContextName in interface javax.servlet.ServletContextpublic Enumeration getServletNames()
getServletNames in interface javax.servlet.ServletContextpublic Enumeration getServlets()
getServlets in interface javax.servlet.ServletContext
public void log(Exception exception,
String message)
log in interface javax.servlet.ServletContextpublic void log(String message)
log in interface javax.servlet.ServletContext
public void log(String message,
Throwable throwable)
log in interface javax.servlet.ServletContextpublic void removeAttribute(String name)
removeAttribute in interface javax.servlet.ServletContext
public void setAttribute(String name,
Object value)
setAttribute in interface javax.servlet.ServletContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||