|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.struts.mock.MockHttpSession
public class MockHttpSession
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.
| Field Summary | |
|---|---|
protected HashMap |
attributes
The set of session attributes. |
protected ServletContext |
servletContext
The ServletContext with which we are associated. |
| Constructor Summary | |
|---|---|
MockHttpSession()
|
|
MockHttpSession(ServletContext servletContext)
|
|
| Method Summary | |
|---|---|
Object |
getAttribute(String name)
|
Enumeration |
getAttributeNames()
|
long |
getCreationTime()
|
String |
getId()
|
long |
getLastAccessedTime()
|
int |
getMaxInactiveInterval()
|
ServletContext |
getServletContext()
|
HttpSessionContext |
getSessionContext()
|
Object |
getValue(String name)
|
String[] |
getValueNames()
|
void |
invalidate()
|
boolean |
isNew()
|
void |
putValue(String name,
Object value)
|
void |
removeAttribute(String name)
|
void |
removeValue(String name)
|
void |
setAttribute(String name,
Object value)
|
void |
setMaxInactiveInterval(int interval)
|
void |
setServletContext(ServletContext servletContext)
|
| 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 session attributes.
protected ServletContext servletContext
The ServletContext with which we are associated.
| Constructor Detail |
|---|
public MockHttpSession()
public MockHttpSession(ServletContext servletContext)
| Method Detail |
|---|
public void setServletContext(ServletContext servletContext)
public Object getAttribute(String name)
getAttribute in interface HttpSessionpublic Enumeration getAttributeNames()
getAttributeNames in interface HttpSessionpublic long getCreationTime()
getCreationTime in interface HttpSessionpublic String getId()
getId in interface HttpSessionpublic long getLastAccessedTime()
getLastAccessedTime in interface HttpSessionpublic int getMaxInactiveInterval()
getMaxInactiveInterval in interface HttpSessionpublic ServletContext getServletContext()
getServletContext in interface HttpSessionpublic HttpSessionContext getSessionContext()
getSessionContext in interface HttpSessionpublic Object getValue(String name)
getValue in interface HttpSessionpublic String[] getValueNames()
getValueNames in interface HttpSessionpublic void invalidate()
invalidate in interface HttpSessionpublic boolean isNew()
isNew in interface HttpSession
public void putValue(String name,
Object value)
putValue in interface HttpSessionpublic void removeAttribute(String name)
removeAttribute in interface HttpSessionpublic void removeValue(String name)
removeValue in interface HttpSession
public void setAttribute(String name,
Object value)
setAttribute in interface HttpSessionpublic void setMaxInactiveInterval(int interval)
setMaxInactiveInterval in interface HttpSession
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||