[jboss-cvs] JBossAS SVN: r62646 - in branches/JBoss_4_0_3_SP1_CP/testsuite: src/main/org/jboss/test/cluster/web/stress/web and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Apr 30 12:41:20 EDT 2007


Author: bstansberry at jboss.com
Date: 2007-04-30 12:41:19 -0400 (Mon, 30 Apr 2007)
New Revision: 62646

Modified:
   branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml
   branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/web/StressTestServlet.java
Log:
[ASPATCH-208] Add a simple test that uses a delayed response to force the issue

Modified: branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml	2007-04-30 16:36:04 UTC (rev 62645)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/imports/test-jars.xml	2007-04-30 16:41:19 UTC (rev 62646)
@@ -995,7 +995,11 @@
     <!-- build http-sync-stress.jar -->
     <war warfile="${build.lib}/http-sync-stress.war"
        webxml="${build.resources}/cluster/http/http-sync-stress/WEB-INF/web.xml">
-        <fileset dir="${build.classes}">
+    	<webinf dir="${build.resources}/cluster/http/http-sync-stress/WEB-INF">
+    	   <include name="jboss-web.xml"/>
+    	   <include name="context.xml"/>	
+    	</webinf>
+    	<fileset dir="${build.classes}">
           <include name="org/jboss/test/cluster/web/stress/web/*"/>
         </fileset>
     </war>

Modified: branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/web/StressTestServlet.java
===================================================================
--- branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/web/StressTestServlet.java	2007-04-30 16:36:04 UTC (rev 62645)
+++ branches/JBoss_4_0_3_SP1_CP/testsuite/src/main/org/jboss/test/cluster/web/stress/web/StressTestServlet.java	2007-04-30 16:41:19 UTC (rev 62646)
@@ -17,6 +17,7 @@
    public static final String ADD = "ADD";
    public static final String SUBTRACT = "SUBTRACT";
    public static final String BYTES = "bytes";
+   public static final String DELAY = "delay";
    
    protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    {
@@ -46,6 +47,8 @@
          throw new RuntimeException("Session already exists");
       
       addBytes(req);
+      
+      sleepIfRequested(req.getParameter(DELAY));
    }
    
    private void handleAdd(HttpServletRequest req)
@@ -58,6 +61,8 @@
          throw new RuntimeException("bytes already stored");
       
       addBytes(req);
+      
+      sleepIfRequested(req.getParameter(DELAY));
    }
    
    private void handleSubtract(HttpServletRequest req)
@@ -75,7 +80,9 @@
          throw new RuntimeException("bytes are incorrect length; should be " + size + 
                " but is " + bytes.length);
       
-      sess.removeAttribute(BYTES);      
+      sess.removeAttribute(BYTES);  
+      
+      sleepIfRequested(req.getParameter(DELAY));    
    }
    
    private void addBytes(HttpServletRequest req)
@@ -84,5 +91,24 @@
       int size = Integer.parseInt(req.getParameter(BYTES));
       sess.setAttribute(BYTES, new byte[size]);
    }
+   
+   private void sleepIfRequested(String delay)
+   {
+      if (delay != null)
+      {
+         try
+         {
+            Thread.sleep(Long.parseLong(delay));
+         }
+         catch (NumberFormatException e)
+         {
+            e.printStackTrace();
+         }
+         catch (InterruptedException e)
+         {
+            e.printStackTrace();
+         }
+      }
+   }
 
 }




More information about the jboss-cvs-commits mailing list