[jboss-cvs] JBossAS SVN: r60286 - in branches/Branch_4_2/testsuite/src: resources/cluster/http/http-field/base and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Feb 5 00:14:15 EST 2007
Author: bstansberry at jboss.com
Date: 2007-02-05 00:14:15 -0500 (Mon, 05 Feb 2007)
New Revision: 60286
Added:
branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/base/modifyCollection.jsp
branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/deprec/modifyCollection.jsp
Modified:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/FieldBasedTestCase.java
Log:
Test if modification of non-pojo collections updates the version
Modified: branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/FieldBasedTestCase.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/FieldBasedTestCase.java 2007-02-04 23:09:12 UTC (rev 60285)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/cluster/test/FieldBasedTestCase.java 2007-02-05 05:14:15 UTC (rev 60286)
@@ -41,12 +41,15 @@
protected String modifySubjectUrl;
protected String modifySubjectUrlBase_;
+ protected String modifyCollectionUrl;
+ protected String modifyCollectionUrlBase_;
public FieldBasedTestCase(String name)
{
super(name);
warName_ = "/http-field/";
modifySubjectUrlBase_ = "modifySubject.jsp";
+ modifyCollectionUrlBase_ = "modifyCollection.jsp";
concatenate();
}
@@ -60,7 +63,8 @@
protected void concatenate()
{
super.concatenate();
- modifySubjectUrl = warName_ +modifySubjectUrlBase_;
+ modifySubjectUrl = warName_ + modifySubjectUrlBase_;
+ modifyCollectionUrl = warName_ + modifyCollectionUrlBase_;
}
public void testSubjectObserver() throws Exception
{
@@ -82,7 +86,7 @@
RMIAdaptor[] adaptors = getAdaptors();
- // Get the session from the cache
+ // Get the session version from the cache
Object origVersion = SessionTestUtil.getSessionVersion(adaptors[0], sessionFqn);
// Modify the POJO stored in the session, but don't touch the
@@ -199,5 +203,59 @@
replVersion, newReplVersion);
}
+
+ public void testCollectionModification() throws Exception
+ {
+ getLog().debug("Enter testCollectionModification");
+ getLog().debug(setUrl + ":::::::" + modifyCollectionUrl);
+
+ // Create an instance of HttpClient.
+ HttpClient client = new HttpClient();
+
+ // Set the session attribute first
+ makeGet(client, baseURL0_ +setUrl);
+
+ // Find out the session id and use it to build an FQN
+ String sessionID = getSessionID(client, servers_[0]);
+ // Strip off the jvmRoute, if there is one
+ sessionID = stripJvmRoute(sessionID);
+ String sessionFqn = "/JSESSION/localhost" + warName_ + sessionID;
+
+ // Modify the data, as that's the JSP that adds the language collection
+ makeGet(client, baseURL0_ + modifyUrl);
+
+ RMIAdaptor[] adaptors = getAdaptors();
+
+ // Get the session version from the cache
+ Object origVersion = SessionTestUtil.getSessionVersion(adaptors[0], sessionFqn);
+
+ // Modify the languages collection
+ makeGet(client, baseURL0_ +modifyCollectionUrl);
+
+ // Get the session from the cache
+ Object newVersion = SessionTestUtil.getSessionVersion(adaptors[0], sessionFqn);
+
+ // The version should have been updated because the data was
+ assertFalse("Session body has been updated",
+ origVersion.equals(newVersion));
+
+ this.sleepThread(DEFAULT_SLEEP);
+
+ // Get the session from the server1 cache
+ Object replVersion = SessionTestUtil.getSessionVersion(adaptors[1], sessionFqn);
+
+ if (replVersion == null)
+ {
+ // Since we haven't accessed the session on server 1,
+ // see if it is in a buddy subtree
+ replVersion = SessionTestUtil.getBuddySessionVersion(adaptors[1], sessionFqn);
+ }
+
+ // Should match the one on server0
+ assertTrue("Session body was replicated",
+ newVersion.equals(replVersion));
+
+ }
+
}
Added: branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/base/modifyCollection.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/base/modifyCollection.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/base/modifyCollection.jsp 2007-02-05 05:14:15 UTC (rev 60286)
@@ -0,0 +1,13 @@
+<%@page contentType="text/html"
+ import="java.util.*,
+ javax.servlet.ServletContext,
+ org.jboss.test.cluster.web.aop.*"
+%>
+
+<%
+ // Note: The name are hard-coded in the test case as well!!!
+ // POJO modify no need to do setAttribute again!
+ Student ben = (Student)session.getAttribute("TEST_PERSON");
+ List languages = ben.getLanguages();
+ languages.add("JAPANESE");
+%>
Added: branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/deprec/modifyCollection.jsp
===================================================================
--- branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/deprec/modifyCollection.jsp (rev 0)
+++ branches/Branch_4_2/testsuite/src/resources/cluster/http/http-field/deprec/modifyCollection.jsp 2007-02-05 05:14:15 UTC (rev 60286)
@@ -0,0 +1,13 @@
+<%@page contentType="text/html"
+ import="java.util.*,
+ javax.servlet.ServletContext,
+ org.jboss.test.cluster.web.aop.deprec.*"
+%>
+
+<%
+ // Note: The name are hard-coded in the test case as well!!!
+ // POJO modify no need to do setAttribute again!
+ Student ben = (Student)session.getAttribute("TEST_PERSON");
+ List languages = ben.getLanguages();
+ languages.add("JAPANESE");
+%>
More information about the jboss-cvs-commits
mailing list