[jboss-cvs] JBossAS SVN: r58089 - branches/JBoss_4_0_3_SP1_JBAS-3814/testsuite/src/main/org/jboss/test/cluster/test

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 3 15:10:22 EST 2006


Author: bstansberry at jboss.com
Date: 2006-11-03 15:10:21 -0500 (Fri, 03 Nov 2006)
New Revision: 58089

Modified:
   branches/JBoss_4_0_3_SP1_JBAS-3814/testsuite/src/main/org/jboss/test/cluster/test/SimpleTestCase.java
Log:
[JBAS-3814] Port of fix for "JBAS-2403 JBossCacheManager session expiration algorithm ignores replication events"

Modified: branches/JBoss_4_0_3_SP1_JBAS-3814/testsuite/src/main/org/jboss/test/cluster/test/SimpleTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_JBAS-3814/testsuite/src/main/org/jboss/test/cluster/test/SimpleTestCase.java	2006-11-03 20:09:44 UTC (rev 58088)
+++ branches/JBoss_4_0_3_SP1_JBAS-3814/testsuite/src/main/org/jboss/test/cluster/test/SimpleTestCase.java	2006-11-03 20:10:21 UTC (rev 58089)
@@ -96,4 +96,50 @@
       assertNull("Http session get", attr);
    }
 
+   /**
+    * Test for JBAS-2403, ensuring that session activity on one node in
+    * the cluster prevents timeout of the session on another node.
+    * 
+    * @throws Exception
+    */
+   public void testReplicationPreventsTimeout()
+      throws Exception
+   {
+      String attr  = "";
+      String attr2 = "";
+      getLog().debug("Enter testReplicationPreventsTimeout");
+
+      String setURLName = "/http-sr/testsessionreplication.jsp";
+      String getURLName = "/http-sr/getattribute.jsp";
+
+      getLog().debug(setURLName + ":::::::" + getURLName);
+
+      // Create an instance of HttpClient.
+      HttpClient client = new HttpClient();
+
+      // Set the session attribute first
+      makeGet(client, baseURL0_ +setURLName);
+      
+      sleepThread(30000);
+      // Set it again to ensure replication occurs
+      attr = makeGetWithState(client, baseURL0_ +setURLName);
+      // Get the Attribute set by testsessionreplication.jsp
+      attr = makeGetWithState(client, baseURL0_ +getURLName);
+      assertNotNull("Http session get", attr);
+      
+      // Sleep 35 secs.  This plus the previous 30 secs is enough to
+      // expire the session on the other node
+      sleepThread(35000);
+      
+      // Switch to the other server and check the attribute
+      setCookieDomainToThisServer(client, servers_[1]);
+      attr2 = makeGetWithState(client, baseURL1_ +getURLName);
+      
+      // Check the result
+      assertEquals("Http session replication attribtues retrieved from both servers ", attr, attr2);
+      
+      getLog().debug("Replication has kept the session alive");
+      getLog().debug("Exit testReplicationPreventsTimeout");
+   }
+
 }




More information about the jboss-cvs-commits mailing list