[jboss-cvs] JBossAS SVN: r57327 - in branches/Branch_4_0/testsuite/src: main/org/jboss/test/web/test resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar resources/web/sso/war
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Sun Oct 1 11:33:26 EDT 2006
Author: bstansberry at jboss.com
Date: 2006-10-01 11:33:24 -0400 (Sun, 01 Oct 2006)
New Revision: 57327
Added:
branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/context.xml
branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/context.xml
branches/Branch_4_0/testsuite/src/resources/web/sso/war/isValid.jsp
Modified:
branches/Branch_4_0/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/server.xml
branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/server.xml
Log:
[JBAS-3096] Test maxEmptyLife concept
Modified: branches/Branch_4_0/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java
===================================================================
--- branches/Branch_4_0/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/main/org/jboss/test/web/test/ClusteredSingleSignOnUnitTestCase.java 2006-10-01 15:33:24 UTC (rev 57327)
@@ -21,10 +21,16 @@
*/
package org.jboss.test.web.test;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
import junit.framework.Test;
+import junit.framework.TestSuite;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpState;
+import org.jboss.cache.Fqn;
import org.jboss.jmx.adaptor.rmi.RMIAdaptor;
import org.jboss.test.JBossClusteredTestCase;
@@ -53,9 +59,13 @@
*/
public static Test suite() throws Exception
{
- Test t1 = JBossClusteredTestCase.getDeploySetup(ClusteredSingleSignOnUnitTestCase.class,
- "web-sso-clustered.ear");
- return t1;
+ // Have to build the suite in detail, as testSessionExpiration must come first
+ TestSuite suite = new TestSuite();
+ suite.addTest(new ClusteredSingleSignOnUnitTestCase("testSessionExpiration"));
+ suite.addTest(new ClusteredSingleSignOnUnitTestCase("testFormAuthSingleSignOn"));
+ suite.addTest(new ClusteredSingleSignOnUnitTestCase("testWebappUndeploy"));
+
+ return JBossClusteredTestCase.getDeploySetup(suite, "web-sso-clustered.ear");
}
protected void setUp() throws Exception
@@ -187,37 +197,74 @@
String[] httpURLs = super.getHttpURLs();
String serverA = httpURLs[0];
+ String serverB = httpURLs[1];
log.info(System.getProperties());
log.info("serverA: "+serverA);
+ log.info("serverB: "+serverB);
String warA3 = serverA + "/war3/";
+ String warB3 = serverB + "/war3/";
- // Start by accessing the secured index.html of war1
+ // First create an SSO that we won't use again -- we later test that it
+ // gets cleaned up from the cache
+ HttpClient httpConn1 = new HttpClient();
+ SSOBaseCase.checkAccessDenied(httpConn1, warA3 + "index.jsp");
+ SSOBaseCase.executeFormLogin(httpConn1, warA3);
+
+ // Now the standard SSO tests
HttpClient httpConn = new HttpClient();
SSOBaseCase.checkAccessDenied(httpConn, warA3 + "index.jsp");
-
- HttpState state = httpConn.getState();
-
+ HttpState state = httpConn.getState();
String sessionID = SSOBaseCase.getSessionIdFromState(state);
log.debug("Saw JSESSIONID="+sessionID);
-
- // Submit the login form
SSOBaseCase.executeFormLogin(httpConn, warA3);
+ String ssoID = SSOBaseCase.processSSOCookie(state, serverA, serverB);
+ log.debug("Saw JSESSIONIDSSO="+ssoID);
- // Wait more than 65 secs to let session time out
- // 5 secs for the session timeout, 2 * 30 secs for the processor thread
- // TODO for some reason it takes 1 min for processExpires to run ???
- // (not an sso issue -- a tomcat issue)
+ // Wait more than 15 secs to let session time out
+ // It's life is 5 secs and the processor runs every 10
try {
- Thread.sleep(65500);
+ Thread.sleep(15500);
}
catch (InterruptedException ie)
{
log.debug("Interrupted while waiting for session expiration");
}
- // Try accessing war1 again
+ // Try accessing war3 again on both nodes -- should succeed
+ SSOBaseCase.checkAccessAllowed(httpConn, warA3 + "index.jsp");
+ SSOBaseCase.checkAccessAllowed(httpConn, warB3 + "index.jsp");
+
+ // Wait more than 30 secs to let SSO time out -- 15 for the sessions
+ // (as above) and 15 for the SSOs maxEmptyLife
+ try {
+ Thread.sleep(30500);
+ }
+ catch (InterruptedException ie)
+ {
+ log.debug("Interrupted while waiting for SSO expiration");
+ }
+
+ // Try accessing war3 again on both nodes -- should fail
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());
}
+
+ private Set getSSOIds(RMIAdaptor adaptor) throws Exception
+ {
+ Fqn ssoRoot = new Fqn(new Object[] {"SSO"});
+ ObjectName oname = new ObjectName("jboss.cache:service=TomcatClusteringCache");
+ return (Set) adaptor.invoke(oname, "getChildrenNames",
+ new Object[]{ ssoRoot },
+ new String[]{ Fqn.class.getName() });
+ }
}
Added: branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/context.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/context.xml 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/context.xml 2006-10-01 15:33:24 UTC (rev 57327)
@@ -0,0 +1,13 @@
+<!-- The contents of this file will be loaded for each web application -->
+<Context cookies="true" crossContext="true">
+
+ <!-- We want a low processExpiresFrequency so we can have
+ fast turnaround of expiration tests -->
+ <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>
Modified: branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/server.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/server.xml 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso/deploy/jbossweb-tomcat55.sar/server.xml 2006-10-01 15:33:24 UTC (rev 57327)
@@ -34,7 +34,7 @@
keystorePass="rmi+ssl" sslProtocol = "TLS" />
-->
- <Engine name="jboss.web" defaultHost="localhost">
+ <Engine name="jboss.web" defaultHost="localhost" backgroundProcessorDelay="2">
<!-- The JAAS based authentication and authorization realm implementation
that is compatible with the jboss 3.2.x realm implementation.
Added: branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/context.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/context.xml 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/context.xml 2006-10-01 15:33:24 UTC (rev 57327)
@@ -0,0 +1,13 @@
+<!-- The contents of this file will be loaded for each web application -->
+<Context cookies="true" crossContext="true">
+
+ <!-- We want a low processExpiresFrequency so we can have
+ fast turnaround of expiration tests -->
+ <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>
Modified: branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/server.xml
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/server.xml 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/resources/test-configs/tomcat-sso-cluster/deploy/jbossweb-tomcat55.sar/server.xml 2006-10-01 15:33:24 UTC (rev 57327)
@@ -34,7 +34,7 @@
keystorePass="rmi+ssl" sslProtocol = "TLS" />
-->
- <Engine name="jboss.web" defaultHost="localhost">
+ <Engine name="jboss.web" defaultHost="localhost" backgroundProcessorDelay="10">
<!-- The JAAS based authentication and authorization realm implementation
that is compatible with the jboss 3.2.x realm implementation.
@@ -145,7 +145,8 @@
to support session replication.
-->
<!-- -->
- <Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn"/>
+ <Valve className="org.jboss.web.tomcat.tc5.sso.ClusteredSingleSignOn"
+ maxEmptyLife="15" processExpiresInterval="10"/>
<!-- -->
@@ -153,11 +154,11 @@
in servlets/jsps.
Important: You need to uncomment the dependency on the CachedConnectionManager
in META-INF/jboss-service.xml
+ -->
<Valve className="org.jboss.web.tomcat.tc5.jca.CachedConnectionValve"
cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager"
transactionManagerObjectName="jboss:service=TransactionManager" />
- -->
-
+
</Host>
</Engine>
Added: branches/Branch_4_0/testsuite/src/resources/web/sso/war/isValid.jsp
===================================================================
--- branches/Branch_4_0/testsuite/src/resources/web/sso/war/isValid.jsp 2006-10-01 15:30:51 UTC (rev 57326)
+++ branches/Branch_4_0/testsuite/src/resources/web/sso/war/isValid.jsp 2006-10-01 15:33:24 UTC (rev 57327)
@@ -0,0 +1 @@
+<% response.setHeader("X-SessionValid", session.isValid()); %>
\ No newline at end of file
More information about the jboss-cvs-commits
mailing list