deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject [1/2] deltaspike git commit: DELTASPIKE-1131 improved MockHttpSession
Date Fri, 22 Apr 2016 09:59:16 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master a33015198 -> 8f9441fcb


DELTASPIKE-1131 improved MockHttpSession


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/8f9441fc
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/8f9441fc
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/8f9441fc

Branch: refs/heads/master
Commit: 8f9441fcb8211c85e5bcb421d1f644415ef4460c
Parents: 83dd59c
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Apr 22 11:34:22 2016 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Apr 22 11:57:54 2016 +0200

----------------------------------------------------------------------
 .../apache/deltaspike/cdise/owb/MockHttpSession.java   | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/8f9441fc/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
----------------------------------------------------------------------
diff --git a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
index 8ce7dea..33b276d 100644
--- a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
+++ b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
@@ -19,6 +19,8 @@
 package org.apache.deltaspike.cdise.owb;
 
 import java.util.Enumeration;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.servlet.ServletContext;
 import javax.servlet.http.HttpSession;
@@ -31,6 +33,8 @@ public class MockHttpSession implements HttpSession
 {
     private String sessionId;
 
+    private Map<String, Object> sessionMap = new ConcurrentHashMap<String, Object>();
+
     public MockHttpSession(String sessionId)
     {
         this.sessionId = sessionId;
@@ -72,12 +76,12 @@ public class MockHttpSession implements HttpSession
 
     public Object getAttribute(String name)
     {
-        return null;
+        return this.sessionMap.get(name);
     }
 
     public Object getValue(String name)
     {
-        return null;
+        return getAttribute(name);
     }
 
     public Enumeration getAttributeNames()
@@ -92,22 +96,27 @@ public class MockHttpSession implements HttpSession
 
     public void setAttribute(String name, Object value)
     {
+        this.sessionMap.put(name, value);
     }
 
     public void putValue(String name, Object value)
     {
+        setAttribute(name, value);
     }
 
     public void removeAttribute(String name)
     {
+        this.sessionMap.remove(name);
     }
 
     public void removeValue(String name)
     {
+        removeAttribute(name);
     }
 
     public void invalidate()
     {
+        this.sessionMap.clear();
     }
 
     public boolean isNew()


Mime
View raw message