[jboss-cvs] JBossAS SVN: r65546 - in trunk/testsuite/src: resources/cluster/http and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Sep 21 22:55:38 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-09-21 22:55:38 -0400 (Fri, 21 Sep 2007)
New Revision: 65546
Added:
trunk/testsuite/src/resources/cluster/http/version.jsp
Modified:
trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SimpleTestCase.java
Log:
[JBAS-4428] Add test of correct maxInactiveInterval treatment
Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SimpleTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SimpleTestCase.java 2007-09-22 01:59:29 UTC (rev 65545)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/SimpleTestCase.java 2007-09-22 02:55:38 UTC (rev 65546)
@@ -21,6 +21,8 @@
*/
package org.jboss.test.cluster.defaultcfg.web.test;
+import java.io.IOException;
+
import javax.management.MBeanServerConnection;
import junit.framework.Test;
@@ -166,7 +168,7 @@
getLog().debug("Exit testSessionTimeout");
}
- public void testMaxUnreplicatedInterval()
+ public void testMaxUnreplicatedInterval1()
throws Exception
{
getLog().debug("Enter testMaxUnreplicatedInterval");
@@ -200,5 +202,44 @@
assertEquals("Session still present", attr, attr1);
}
+
+ public void testMaxUnreplicatedInterval2() throws IOException
+ {
+ getLog().debug("Enter testMaxUnreplicatedInterval2");
+ String setURLName = "/http-sr/testsessionreplication.jsp";
+ String getURLName = "/http-sr/getattribute.jsp";
+ String versionURLName = "/http-sr/version.jsp";
+
+ // Create an instance of HttpClient.
+ HttpClient client = new HttpClient();
+
+ // Set the session attribute first
+ makeGet(client, baseURL0_ +setURLName);
+ // Get the Attribute set by testsessionreplication.jsp
+ String attr = makeGetWithState(client, baseURL0_ +getURLName);
+
+ // Sleep 50% of the maxInactiveInterval -- long enough
+ sleepThread(10000);
+
+ // Access the session without touching any attribute
+ String ver = makeGetWithState(client, baseURL0_ +versionURLName);
+
+ // Sleep some more, long enough for the session to replicate
+ // if the last request incorrectly caused replication
+ sleepThread(2000);
+
+ // Switch servers
+ setCookieDomainToThisServer(client, servers_[1]);
+
+ String ver1 = makeGetWithState(client, baseURL1_ +versionURLName);
+
+ assertEquals("Session version count unchanged", ver, ver1);
+
+ // Get the Attribute set by testsessionreplication.jsp
+ String attr1 = makeGetWithState(client, baseURL1_ +getURLName);
+
+ assertEquals("Session still present", attr, attr1);
+ }
+
}
Added: trunk/testsuite/src/resources/cluster/http/version.jsp
===================================================================
--- trunk/testsuite/src/resources/cluster/http/version.jsp (rev 0)
+++ trunk/testsuite/src/resources/cluster/http/version.jsp 2007-09-22 02:55:38 UTC (rev 65546)
@@ -0,0 +1,14 @@
+<%@page contentType="text/html"
+ import="org.jboss.mx.util.*"
+ import="javax.management.*"
+ import="org.jboss.cache.*"
+ import="org.jboss.cache.pojo.PojoCache"
+%>
+<%
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ ObjectName on = new ObjectName("jboss.cache:service=TomcatClusteringCache");
+ PojoCache cache = (PojoCache) server.getAttribute(on, "PojoCache");
+ Fqn fqn = Fqn.fromString("/JSESSION/localhost" + request.getContextPath() + "/" + session.getId());
+ Object version = cache.getCache().get(fqn, "VERSION" );
+%>
+<%= version %>
Property changes on: trunk/testsuite/src/resources/cluster/http/version.jsp
___________________________________________________________________
Name: svn:executable
+ *
More information about the jboss-cvs-commits
mailing list