Package org.apache.struts.mock
Class MockHttpSession
java.lang.Object
org.apache.struts.mock.MockHttpSession
- All Implemented Interfaces:
HttpSession
Mock HttpSession 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.
- Version:
- $Rev$ $Date: 2005-05-07 12:11:38 -0400 (Sat, 07 May 2005) $
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe set of session attributes.protected ServletContextThe ServletContext with which we are associated. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetAttribute(String name) longgetId()longintDeprecated.Deprecated.String[]Deprecated.voidbooleanisNew()voidDeprecated.voidremoveAttribute(String name) voidremoveValue(String name) Deprecated.voidsetAttribute(String name, Object value) voidsetMaxInactiveInterval(int interval) voidsetServletContext(ServletContext servletContext)
-
Field Details
-
attributes
The set of session attributes.
-
servletContext
The ServletContext with which we are associated.
-
-
Constructor Details
-
MockHttpSession
public MockHttpSession() -
MockHttpSession
-
-
Method Details
-
setServletContext
-
getAttribute
- Specified by:
getAttributein interfaceHttpSession
-
getAttributeNames
- Specified by:
getAttributeNamesin interfaceHttpSession
-
getCreationTime
public long getCreationTime()- Specified by:
getCreationTimein interfaceHttpSession
-
getId
- Specified by:
getIdin interfaceHttpSession
-
getLastAccessedTime
public long getLastAccessedTime()- Specified by:
getLastAccessedTimein interfaceHttpSession
-
getMaxInactiveInterval
public int getMaxInactiveInterval()- Specified by:
getMaxInactiveIntervalin interfaceHttpSession
-
getServletContext
- Specified by:
getServletContextin interfaceHttpSession
-
getSessionContext
Deprecated.- Specified by:
getSessionContextin interfaceHttpSession
-
getValue
Deprecated.- Specified by:
getValuein interfaceHttpSession
-
getValueNames
Deprecated.- Specified by:
getValueNamesin interfaceHttpSession
-
invalidate
public void invalidate()- Specified by:
invalidatein interfaceHttpSession
-
isNew
public boolean isNew()- Specified by:
isNewin interfaceHttpSession
-
putValue
Deprecated.- Specified by:
putValuein interfaceHttpSession
-
removeAttribute
- Specified by:
removeAttributein interfaceHttpSession
-
removeValue
Deprecated.- Specified by:
removeValuein interfaceHttpSession
-
setAttribute
- Specified by:
setAttributein interfaceHttpSession
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval) - Specified by:
setMaxInactiveIntervalin interfaceHttpSession
-