浏览代码

Added in a default constructor to use the original sessionid and a constructor for specifying the sessionId

Ray Krueger 20 年之前
父节点
当前提交
4125db5650
共有 1 个文件被更改,包括 19 次插入5 次删除
  1. 19 5
      core/src/test/java/org/acegisecurity/MockHttpSession.java

+ 19 - 5
core/src/test/java/org/acegisecurity/MockHttpSession.java

@@ -15,13 +15,12 @@
 
 package net.sf.acegisecurity;
 
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Map;
-
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
 import javax.servlet.http.HttpSessionContext;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
 
 
 /**
@@ -35,6 +34,21 @@ public class MockHttpSession implements HttpSession {
     //~ Instance fields ========================================================
 
     private Map map = new HashMap();
+    private String sessionId = "3984594856968";
+
+    /**
+     * Default constructor using default sessionId
+     */
+    public MockHttpSession() {
+    }
+
+    /**
+     * Constructor for using a specified sessionId
+     * @param sessionId
+     */
+    public MockHttpSession(String sessionId) {
+        this.sessionId = sessionId;
+    }
 
     //~ Methods ================================================================
 
@@ -55,7 +69,7 @@ public class MockHttpSession implements HttpSession {
     }
 
     public String getId() {
-        return "3984594856968";
+        return sessionId;
     }
 
     public long getLastAccessedTime() {