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
Modifier and TypeFieldDescriptionThe set of session attributes.protected ServletContext
The ServletContext with which we are associated. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetAttribute
(String name) long
getId()
long
int
Deprecated.Deprecated.String[]
Deprecated.void
boolean
isNew()
void
Deprecated.void
removeAttribute
(String name) void
removeValue
(String name) Deprecated.void
setAttribute
(String name, Object value) void
setMaxInactiveInterval
(int interval) void
setServletContext
(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:
getAttribute
in interfaceHttpSession
-
getAttributeNames
- Specified by:
getAttributeNames
in interfaceHttpSession
-
getCreationTime
public long getCreationTime()- Specified by:
getCreationTime
in interfaceHttpSession
-
getId
- Specified by:
getId
in interfaceHttpSession
-
getLastAccessedTime
public long getLastAccessedTime()- Specified by:
getLastAccessedTime
in interfaceHttpSession
-
getMaxInactiveInterval
public int getMaxInactiveInterval()- Specified by:
getMaxInactiveInterval
in interfaceHttpSession
-
getServletContext
- Specified by:
getServletContext
in interfaceHttpSession
-
getSessionContext
Deprecated.- Specified by:
getSessionContext
in interfaceHttpSession
-
getValue
Deprecated.- Specified by:
getValue
in interfaceHttpSession
-
getValueNames
Deprecated.- Specified by:
getValueNames
in interfaceHttpSession
-
invalidate
public void invalidate()- Specified by:
invalidate
in interfaceHttpSession
-
isNew
public boolean isNew()- Specified by:
isNew
in interfaceHttpSession
-
putValue
Deprecated.- Specified by:
putValue
in interfaceHttpSession
-
removeAttribute
- Specified by:
removeAttribute
in interfaceHttpSession
-
removeValue
Deprecated.- Specified by:
removeValue
in interfaceHttpSession
-
setAttribute
- Specified by:
setAttribute
in interfaceHttpSession
-
setMaxInactiveInterval
public void setMaxInactiveInterval(int interval) - Specified by:
setMaxInactiveInterval
in interfaceHttpSession
-