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