[jboss-cvs] JBossAS SVN: r65116 - in trunk/testsuite/src: main/org/jboss/test/web/test and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Sep 5 15:41:34 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-09-05 15:41:34 -0400 (Wed, 05 Sep 2007)
New Revision: 65116

Added:
   trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/context.xml
Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java
   trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java
   trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
   trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/server.xml
Log:
[JBAS-4057] Clustered SSO entries not properly cleaned up if a server crashes

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java	2007-09-05 19:40:30 UTC (rev 65115)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelper.java	2007-09-05 19:41:34 UTC (rev 65116)
@@ -169,6 +169,29 @@
       return result;
    }
    
+   public boolean getCacheHasSSO(String ssoId) throws Exception
+   {
+      Fqn fqn = Fqn.fromString("/SSO/" + ssoId);
+      Node main = getCache().getRoot().getChild(fqn);
+      if (main != null)
+         return true;
+      
+      // Check in the buddy backup tree
+      
+      Set buddies = getBuddyBackupRoots();
+      for (Iterator iter = buddies.iterator(); iter.hasNext();)
+      {
+         Node buddy = (Node) iter.next();
+         Node ssoRoot = buddy.getChild(fqn);
+         if (ssoRoot != null)
+         {
+            return true;
+         }
+      }
+      
+      return false;
+   }
+   
    public boolean getLeaveInstalledAfterShutdown()
    {
       return leaveInstalledAfterShutdown;

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java	2007-09-05 19:40:30 UTC (rev 65115)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/web/CacheHelperMBean.java	2007-09-05 19:41:34 UTC (rev 65116)
@@ -16,6 +16,8 @@
    
    Set getSSOIds() throws Exception;
    
+   boolean getCacheHasSSO(String ssoId) throws Exception;
+   
    void setLeaveInstalledAfterShutdown();
    
    void uninstall();

Modified: trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java	2007-09-05 19:40:30 UTC (rev 65115)
+++ trunk/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java	2007-09-05 19:41:34 UTC (rev 65116)
@@ -223,11 +223,13 @@
       HttpClient httpConn1 = new HttpClient();
       SSOBaseCase.checkAccessDenied(httpConn1, warA3 + "index.jsp");
       SSOBaseCase.executeFormLogin(httpConn1, warA3);
+      HttpState state = httpConn1.getState();      
+      String sessionID1 = SSOBaseCase.getSessionIdFromState(state);
       
       // Now the standard SSO tests
       HttpClient httpConn = new HttpClient();
       SSOBaseCase.checkAccessDenied(httpConn, warA3 + "index.jsp");
-      HttpState state = httpConn.getState();      
+      state = httpConn.getState();      
       String sessionID = SSOBaseCase.getSessionIdFromState(state);
       log.debug("Saw JSESSIONID="+sessionID);
       SSOBaseCase.executeFormLogin(httpConn, warA3);
@@ -262,19 +264,19 @@
       SSOBaseCase.checkAccessDenied(httpConn, warA3 + "index.jsp");
       SSOBaseCase.checkAccessDenied(httpConn, warB3 + "index.jsp");
       
-      // Confirm that the SSO we created at the start was removed from
-      // the cache
-      Set ssoIds = getSSOIds(adaptors[0]);
-      log.info("node0 sso ids are " + ssoIds);
-      assertEquals("node0 cache has no SSOs", 0, ssoIds.size());
-      ssoIds = getSSOIds(adaptors[1]);
-      log.info("node1 sso ids are " + ssoIds);
-      assertEquals("node1 cache has no SSOs", 0, ssoIds.size());
+      // Confirm that the SSO we created at the start was removed from the cache
+      assertFalse("node0 cache does not have SSO " + sessionID1,
+                  getCacheHasSSO(adaptors[0], sessionID1));
+      assertFalse("node1 cache does not have SSO " + sessionID1,
+            getCacheHasSSO(adaptors[1], sessionID1));
    }
    
-   private Set getSSOIds(MBeanServerConnection adaptor) throws Exception
+   private boolean getCacheHasSSO(MBeanServerConnection adaptor ,String ssoId)
+         throws Exception
    {
-      return (Set) adaptor.invoke(CacheHelper.OBJECT_NAME, "getChildrenNames", 
-                                  new Object[0], new String[0]);
+      Boolean b = (Boolean) adaptor.invoke(CacheHelper.OBJECT_NAME, "getCacheHasSSO", 
+                            new Object[] { ssoId}, 
+                            new String[] { String.class.getName() });
+      return b.booleanValue();
    }
 }

Added: trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/context.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/context.xml	                        (rev 0)
+++ trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/context.xml	2007-09-05 19:41:34 UTC (rev 65116)
@@ -0,0 +1,17 @@
+<!-- The contents of this file will be loaded for each web application -->
+<Context cookies="true" crossContext="true">
+   <!-- Session persistence is disable by default. To enable for all web
+   apps set the pathname to a non-empty value:
+   <Manager pathname="SESSIONS.ser" />
+
+   To enable session persistence for a single web app, add a
+   WEB-INF/context.xml 
+   -->
+   <Manager pathname="" processExpiresFrequency="1" />
+
+   <!-- Install an InstanceListener to handle the establishment of the run-as
+   role for servlet init/destroy events.
+   -->
+   <InstanceListener>org.jboss.web.tomcat.security.RunAsListener</InstanceListener>
+   
+</Context>


Property changes on: trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/context.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native

Modified: trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/server.xml
===================================================================
--- trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/server.xml	2007-09-05 19:40:30 UTC (rev 65115)
+++ trunk/testsuite/src/resources/test-configs/tomcat-sso-cluster/deployers/jbossweb.deployer/server.xml	2007-09-05 19:41:34 UTC (rev 65116)
@@ -134,7 +134,8 @@
                               standard ObjectName of the JBossCache MBean used 
                               to support session replication.
             -->
-          <Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn" />
+          <Valve className="org.jboss.web.tomcat.service.sso.ClusteredSingleSignOn"
+                   maxEmptyLife="11" processExpiresInterval="5" />
  
          </Host>
 




More information about the jboss-cvs-commits mailing list