KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > test > mocks > servlet > MockHttpSession


1 /**
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved.
3  * Please look at license.txt in info directory for more license detail.
4  **/

5
6 package org.exoplatform.test.mocks.servlet;
7 import javax.servlet.http.HttpSession JavaDoc;
8 import javax.servlet.http.HttpSessionContext JavaDoc;
9 import javax.servlet.ServletContext JavaDoc;
10 import java.util.Enumeration JavaDoc;
11 import java.util.Map JavaDoc;
12 import java.util.HashMap JavaDoc;
13 import java.util.Vector JavaDoc;
14
15 /**
16  * Created by The eXo Platform SARL
17  * Author : Mestrallet Benjamin
18  * benjmestrallet@users.sourceforge.net
19  * Date: Jul 27, 2003
20  * Time: 2:13:09 AM
21  */

22 public class MockHttpSession implements HttpSession JavaDoc {
23
24   private Map JavaDoc map = new HashMap JavaDoc();
25
26   public long getCreationTime() {
27     return 0;
28   }
29
30   public String JavaDoc getId() {
31     return "MockSessionId";
32   }
33
34   public long getLastAccessedTime() {
35     return 0;
36   }
37
38   public ServletContext JavaDoc getServletContext() {
39     return null;
40   }
41
42   public void setMaxInactiveInterval(int i) {
43   }
44
45   public int getMaxInactiveInterval() {
46     return 0;
47   }
48
49   public HttpSessionContext JavaDoc getSessionContext() { return null; }
50
51   public Object JavaDoc getAttribute(String JavaDoc s) {
52     return map.get(s);
53   }
54
55   public Object JavaDoc getValue(String JavaDoc s) {
56     return null;
57   }
58
59   public Enumeration JavaDoc getAttributeNames() {
60     return new Vector JavaDoc(map.keySet()).elements();
61   }
62
63   public String JavaDoc[] getValueNames() {
64     return new String JavaDoc[0];
65   }
66
67   public void setAttribute(String JavaDoc s, Object JavaDoc o) {
68     map.put(s, o);
69   }
70
71   public void putValue(String JavaDoc s, Object JavaDoc o) {
72   }
73
74   public void removeAttribute(String JavaDoc s) {
75     map.remove(s);
76   }
77
78   public void removeValue(String JavaDoc s) {
79   }
80
81   public void invalidate() {
82   }
83
84   public boolean isNew() {
85     return false;
86   }
87
88 }
89
Popular Tags