com.mockrunner.mock.web
Class MockHttpSession

java.lang.Object
  extended by com.mockrunner.mock.web.MockHttpSession
All Implemented Interfaces:
javax.servlet.http.HttpSession

public class MockHttpSession
extends java.lang.Object
implements javax.servlet.http.HttpSession

Mock implementation of HttpSession.


Constructor Summary
MockHttpSession()
           
 
Method Summary
 void addAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)
           
 void clearAttributes()
           
 java.lang.Object getAttribute(java.lang.String key)
           
 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 key)
           
 java.lang.String[] getValueNames()
           
 void invalidate()
           
 boolean isNew()
           
 boolean isValid()
           
 void putValue(java.lang.String key, java.lang.Object value)
           
 void removeAttribute(java.lang.String key)
           
 void removeValue(java.lang.String key)
           
 void resetAll()
          Resets the state of this object to the default values
 void setAttribute(java.lang.String key, java.lang.Object value)
           
 void setMaxInactiveInterval(int maxInactiveInterval)
           
 void setUpIsNew(boolean isNew)
           
 void setupServletContext(javax.servlet.ServletContext servletContext)
          Set the ServletContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockHttpSession

public MockHttpSession()
Method Detail

resetAll

public void resetAll()
Resets the state of this object to the default values


addAttributeListener

public void addAttributeListener(javax.servlet.http.HttpSessionAttributeListener listener)

setupServletContext

public void setupServletContext(javax.servlet.ServletContext servletContext)
Set the ServletContext.

Parameters:
servletContext - the ServletContext

getServletContext

public javax.servlet.ServletContext getServletContext()
Specified by:
getServletContext in interface javax.servlet.http.HttpSession

isValid

public boolean isValid()

isNew

public boolean isNew()
Specified by:
isNew in interface javax.servlet.http.HttpSession

setUpIsNew

public void setUpIsNew(boolean isNew)

getCreationTime

public long getCreationTime()
Specified by:
getCreationTime in interface javax.servlet.http.HttpSession

invalidate

public void invalidate()
Specified by:
invalidate in interface javax.servlet.http.HttpSession

getId

public java.lang.String getId()
Specified by:
getId in interface javax.servlet.http.HttpSession

getValue

public java.lang.Object getValue(java.lang.String key)
Specified by:
getValue in interface javax.servlet.http.HttpSession

getValueNames

public java.lang.String[] getValueNames()
Specified by:
getValueNames in interface javax.servlet.http.HttpSession

putValue

public void putValue(java.lang.String key,
                     java.lang.Object value)
Specified by:
putValue in interface javax.servlet.http.HttpSession

removeValue

public void removeValue(java.lang.String key)
Specified by:
removeValue in interface javax.servlet.http.HttpSession

clearAttributes

public void clearAttributes()

getAttribute

public java.lang.Object getAttribute(java.lang.String key)
Specified by:
getAttribute in interface javax.servlet.http.HttpSession

getAttributeNames

public java.util.Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession

removeAttribute

public void removeAttribute(java.lang.String key)
Specified by:
removeAttribute in interface javax.servlet.http.HttpSession

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object value)
Specified by:
setAttribute in interface javax.servlet.http.HttpSession

getLastAccessedTime

public long getLastAccessedTime()
Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession

setMaxInactiveInterval

public void setMaxInactiveInterval(int maxInactiveInterval)
Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession

getMaxInactiveInterval

public int getMaxInactiveInterval()
Specified by:
getMaxInactiveInterval in interface javax.servlet.http.HttpSession

getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Specified by:
getSessionContext in interface javax.servlet.http.HttpSession