[jboss-cvs] JBossAS SVN: r62647 - branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/test.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Apr 30 12:42:38 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-04-30 12:42:38 -0400 (Mon, 30 Apr 2007)
New Revision: 62647
Modified:
branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/test/SyncReplStressUnitTestCase.java
Log:
[ASPATCH-208] Add a simple test that uses a delayed response to force the issue
node++ must be ++node or you never get a failover :(
Modified: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/test/SyncReplStressUnitTestCase.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/test/SyncReplStressUnitTestCase.java 2007-04-30 16:41:19 UTC (rev 62646)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/test/SyncReplStressUnitTestCase.java 2007-04-30 16:42:38 UTC (rev 62647)
@@ -47,6 +47,15 @@
super.tearDown();
errors.clear();
}
+
+ public void testLongRunningRequest() throws Exception
+ {
+ for (int i = 0; i < 4; i++)
+ {
+ HttpClient client = new HttpClient();
+ execute(client, 1, 10000);
+ }
+ }
public void testConcurrentLoad() throws Exception {
@@ -54,7 +63,7 @@
for (int i=0; i<THREAD_COUNT; i++)
{
- threads[i] = new Caller();
+ threads[i] = new Caller(LOOP_COUNT, 0);
threads[i].setDaemon(true);
}
@@ -90,7 +99,8 @@
assertEquals("No errors reported", 0, errors.size());
}
- private void execute(HttpClient client) throws Exception
+ private void execute(HttpClient client, int loopCount, int subtractDelay)
+ throws Exception
{
int idx = threadCount++;
int node = idx % 2;
@@ -102,20 +112,24 @@
method.getResponseBody();
method.releaseConnection();
- for (int i=0; i < LOOP_COUNT; i++)
+ for (int i=0; i < loopCount; i++)
{
sleepThread(1000);
- node = node++ %2;
+ node = ++node %2;
setCookieDomainToThisServer(client, servers_[node]);
method = new PostMethod(httpURLs[node] + SERVLET_URL);
method.setParameter(StressTestServlet.CMD, StressTestServlet.SUBTRACT);
method.setParameter(StressTestServlet.BYTES, BYTE_SIZE);
+ if (subtractDelay > 0)
+ {
+ method.setParameter(StressTestServlet.DELAY, String.valueOf(subtractDelay));
+ }
status = client.executeMethod(method);
method.releaseConnection();
assertEquals(200, status);
sleepThread(1000);
- node = node++ %2;
+ node = ++node %2;
setCookieDomainToThisServer(client, servers_[node]);
method = new PostMethod(httpURLs[node] + SERVLET_URL);
method.setParameter(StressTestServlet.CMD, StressTestServlet.ADD);
@@ -130,12 +144,21 @@
private class Caller extends Thread
{
+ private int loopCount;
+ private int subtractDelay;
+
+ Caller(int loopCount, int subtractDelay)
+ {
+ this.loopCount = loopCount;
+ this.subtractDelay = subtractDelay;
+ }
+
public void run()
{
HttpClient client = new HttpClient();
try
{
- execute(client);
+ execute(client, loopCount, subtractDelay);
}
catch (Throwable t)
{
More information about the jboss-cvs-commits
mailing list