shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lhazlew...@apache.org
Subject svn commit: r1479208 - /shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java
Date Sat, 04 May 2013 22:39:05 GMT
Author: lhazlewood
Date: Sat May  4 22:39:05 2013
New Revision: 1479208

URL: http://svn.apache.org/r1479208
Log:
SHIRO-388: added test to verify correct functionality.

Modified:
    shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java

Modified: shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java
URL: http://svn.apache.org/viewvc/shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java?rev=1479208&r1=1479207&r2=1479208&view=diff
==============================================================================
--- shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java
(original)
+++ shiro/branches/1.2.x/core/src/test/java/org/apache/shiro/session/mgt/DefaultSessionManagerTest.java
Sat May  4 22:39:05 2013
@@ -96,6 +96,29 @@ public class DefaultSessionManagerTest {
         assertTrue(stopped[0]);
     }
 
+    //asserts fix for SHIRO-388:
+    //Ensures that a session attribute can be accessed in the listener without
+    //causing a stack overflow exception.
+    @Test
+    public void testSessionListenerStopNotificationWithReadAttribute() {
+        final boolean[] stopped = new boolean[1];
+        final String[] value = new String[1];
+        SessionListener listener = new SessionListenerAdapter() {
+            public void onStop(Session session) {
+                stopped[0] = true;
+                value[0] = (String)session.getAttribute("foo");
+            }
+        };
+        sm.getSessionListeners().add(listener);
+        Session session = sm.start(null);
+        session.setAttribute("foo", "bar");
+
+        sm.stop(new DefaultSessionKey(session.getId()));
+
+        assertTrue(stopped[0]);
+        assertEquals("bar", value[0]);
+    }
+
     @Test
     public void testSessionListenerExpiredNotification() {
         final boolean[] expired = new boolean[1];



Mime
View raw message