org.chwf.servlet.mock
Class MockSession

java.lang.Object
  |
  +--org.chwf.servlet.mock.MockSession
All Implemented Interfaces:
javax.servlet.http.HttpSession

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

Mock servlet session.

Author:
Paul Strack

Constructor Summary
MockSession()
           
 
Method Summary
static void clearSession()
          MOCK METHOD: Clear session.
 java.lang.Object getAttribute(java.lang.String name)
          Get attribute
 java.util.Enumeration getAttributeNames()
          Attributes names
 long getCreationTime()
          Unsupported
 java.lang.String getId()
          Unsupported
 long getLastAccessedTime()
          Unsupported
 int getMaxInactiveInterval()
          Unsupported
 javax.servlet.ServletContext getServletContext()
          Unsupported
static MockSession getSession()
          MOCK METHOD: Factory for mock session.
 javax.servlet.http.HttpSessionContext getSessionContext()
          Deprecated.  
 java.lang.Object getValue(java.lang.String name)
          Deprecated.  
 java.lang.String[] getValueNames()
          Deprecated.  
 void invalidate()
          Clears session.
 boolean isNew()
          Unsupported
 void putValue(java.lang.String name, java.lang.Object value)
          Deprecated.  
 void removeAttribute(java.lang.String name)
          Remove attribute
 void removeValue(java.lang.String name)
          Deprecated.  
 void setAttribute(java.lang.String name, java.lang.Object value)
          Set attribute
 void setMaxInactiveInterval(int arg0)
          Unsupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockSession

public MockSession()
Method Detail

getSession

public static MockSession getSession()
MOCK METHOD: Factory for mock session.
Returns:
The MockSession (a singleton)

clearSession

public static void clearSession()
MOCK METHOD: Clear session. Should be used in tearDown method of tests.

getCreationTime

public long getCreationTime()
Unsupported
Specified by:
getCreationTime in interface javax.servlet.http.HttpSession
Returns:
creation time
See Also:
HttpSession.getCreationTime()

getId

public java.lang.String getId()
Unsupported
Specified by:
getId in interface javax.servlet.http.HttpSession
Returns:
id
See Also:
HttpSession.getId()

getLastAccessedTime

public long getLastAccessedTime()
Unsupported
Specified by:
getLastAccessedTime in interface javax.servlet.http.HttpSession
Returns:
access time
See Also:
HttpSession.getLastAccessedTime()

getServletContext

public javax.servlet.ServletContext getServletContext()
Unsupported
Returns:
context
See Also:
HttpSession

setMaxInactiveInterval

public void setMaxInactiveInterval(int arg0)
Unsupported
Specified by:
setMaxInactiveInterval in interface javax.servlet.http.HttpSession
Parameters:
arg0 -  
See Also:
HttpSession.setMaxInactiveInterval(int)

getMaxInactiveInterval

public int getMaxInactiveInterval()
Unsupported
Specified by:
getMaxInactiveInterval in interface javax.servlet.http.HttpSession
Returns:
interval
See Also:
HttpSession.getMaxInactiveInterval()

getSessionContext

public javax.servlet.http.HttpSessionContext getSessionContext()
Deprecated.  

Unsupported
Specified by:
getSessionContext in interface javax.servlet.http.HttpSession
Returns:
context
See Also:
HttpSession.getSessionContext()

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Get attribute
Specified by:
getAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - name
Returns:
value
See Also:
HttpSession.getAttribute(String)

getValue

public java.lang.Object getValue(java.lang.String name)
Deprecated.  

Unsupported
Specified by:
getValue in interface javax.servlet.http.HttpSession
Parameters:
name - name
Returns:
value
See Also:
HttpSession.getValue(String)

getAttributeNames

public java.util.Enumeration getAttributeNames()
Attributes names
Specified by:
getAttributeNames in interface javax.servlet.http.HttpSession
Returns:
names
See Also:
HttpSession.getAttributeNames()

getValueNames

public java.lang.String[] getValueNames()
Deprecated.  

Unsupported
Specified by:
getValueNames in interface javax.servlet.http.HttpSession
Returns:
names
See Also:
HttpSession.getValueNames()

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Set attribute
Specified by:
setAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - name
value - value
See Also:
HttpSession.setAttribute(String, Object)

putValue

public void putValue(java.lang.String name,
                     java.lang.Object value)
Deprecated.  

Unsupported
Specified by:
putValue in interface javax.servlet.http.HttpSession
Parameters:
name - name
value - value
See Also:
HttpSession.putValue(String, Object)

removeAttribute

public void removeAttribute(java.lang.String name)
Remove attribute
Specified by:
removeAttribute in interface javax.servlet.http.HttpSession
Parameters:
name - name
See Also:
HttpSession.removeAttribute(String)

removeValue

public void removeValue(java.lang.String name)
Deprecated.  

Unsupported
Specified by:
removeValue in interface javax.servlet.http.HttpSession
Parameters:
name - name
See Also:
HttpSession.removeValue(String)

invalidate

public void invalidate()
Clears session.
Specified by:
invalidate in interface javax.servlet.http.HttpSession
See Also:
HttpSession.invalidate()

isNew

public boolean isNew()
Unsupported
Specified by:
isNew in interface javax.servlet.http.HttpSession
Returns:
true if new
See Also:
HttpSession.isNew()


Copyright © 2002-2004, Paul Strack. All Rights Reserved.