1 5 6 package org.exoplatform.test.mocks.servlet; 7 import javax.servlet.http.HttpSession ; 8 import javax.servlet.http.HttpSessionContext ; 9 import javax.servlet.ServletContext ; 10 import java.util.Enumeration ; 11 import java.util.Map ; 12 import java.util.HashMap ; 13 import java.util.Vector ; 14 15 22 public class MockHttpSession implements HttpSession { 23 24 private Map map = new HashMap (); 25 26 public long getCreationTime() { 27 return 0; 28 } 29 30 public String getId() { 31 return "MockSessionId"; 32 } 33 34 public long getLastAccessedTime() { 35 return 0; 36 } 37 38 public ServletContext 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 getSessionContext() { return null; } 50 51 public Object getAttribute(String s) { 52 return map.get(s); 53 } 54 55 public Object getValue(String s) { 56 return null; 57 } 58 59 public Enumeration getAttributeNames() { 60 return new Vector (map.keySet()).elements(); 61 } 62 63 public String [] getValueNames() { 64 return new String [0]; 65 } 66 67 public void setAttribute(String s, Object o) { 68 map.put(s, o); 69 } 70 71 public void putValue(String s, Object o) { 72 } 73 74 public void removeAttribute(String s) { 75 map.remove(s); 76 } 77 78 public void removeValue(String s) { 79 } 80 81 public void invalidate() { 82 } 83 84 public boolean isNew() { 85 return false; 86 } 87 88 } 89 | Popular Tags |