[jboss-cvs] JBossAS SVN: r108959 - trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Oct 27 23:36:19 EDT 2010


Author: pferraro
Date: 2010-10-27 23:36:18 -0400 (Wed, 27 Oct 2010)
New Revision: 108959

Modified:
   trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/CleanShutdownTestCase.java
Log:
[JBAS-7844] Fix NPE on relinquishing of session ownership mid-shutdown causing occasional failure of clean shutdown test.

Modified: trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/CleanShutdownTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/CleanShutdownTestCase.java	2010-10-28 03:23:42 UTC (rev 108958)
+++ trunk/testsuite/src/main/org/jboss/test/cluster/defaultcfg/web/test/CleanShutdownTestCase.java	2010-10-28 03:36:18 UTC (rev 108959)
@@ -122,6 +122,12 @@
       // Make sure a normal request will succeed
       Assert.assertEquals(200, new RequestTask(0, 0).call().intValue());
       
+      System.out.println("After initial request");
+      for (Cookie cookie: this.client.getState().getCookies())
+      {
+         System.out.println(cookie.getDomain() + "\t" + cookie.getName() + "\t" + cookie.getPath() + "\t" + cookie.getValue());
+      }
+      
       Assert.assertNull(this.findCookie(0, COOKIE_NAME));
       
       // Send a long request - in parallel
@@ -135,6 +141,7 @@
 
       // Get result of long request
       // This request should succeed since it initiated before server shutdown
+      ExecutionException exception = null;
       try
       {
          Assert.assertEquals(200, future.get().intValue());
@@ -142,10 +149,17 @@
       catch (ExecutionException e)
       {
          e.printStackTrace(System.err);
-         
-         Assert.fail(e.getCause().getMessage());
+         exception = e;
       }
+
+      Assert.assertNull(exception);
       
+      System.out.println("After request initiated prior to shutdown");
+      for (Cookie cookie: this.client.getState().getCookies())
+      {
+         System.out.println(cookie.getDomain() + "\t" + cookie.getName() + "\t" + cookie.getPath() + "\t" + cookie.getValue());
+      }
+      
       Cookie cookie = this.findCookie(0, COOKIE_NAME);
       Assert.assertNotNull(cookie);
       Assert.assertEquals("0", cookie.getValue());
@@ -153,6 +167,12 @@
       // Subsequent request should return 404
       Assert.assertEquals(404, new RequestTask(0, 0).call().intValue());
       
+      System.out.println("After request to shutdown server");
+      for (Cookie c: this.client.getState().getCookies())
+      {
+         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
+      }
+      
       // Copy cookies from server[0] to server[1]
       for (Cookie c: this.client.getState().getCookies())
       {
@@ -161,8 +181,20 @@
             this.client.getState().addCookie(new Cookie(this.getServers()[1], c.getName(), c.getValue(), c.getPath(), c.getExpiryDate(), c.getSecure()));
          }
       }
+
+      System.out.println("After cookie copy to failover server");
+      for (Cookie c: this.client.getState().getCookies())
+      {
+         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
+      }
       
       Assert.assertEquals(200, new RequestTask(1, 0).call().intValue());
+
+      System.out.println("After request on new server");
+      for (Cookie c: this.client.getState().getCookies())
+      {
+         System.out.println(c.getDomain() + "\t" + c.getName() + "\t" + c.getPath() + "\t" + c.getValue());
+      }
       
       // If old session had replicated successfully, cookie value should equal old sleep duration
       cookie = this.findCookie(1, COOKIE_NAME);
@@ -202,12 +234,7 @@
          
          try
          {
-            int response = CleanShutdownTestCase.this.client.executeMethod(method);
-            for (Cookie cookie: CleanShutdownTestCase.this.client.getState().getCookies())
-            {
-               System.out.println(cookie.getDomain() + "\t" + cookie.getName() + "\t" + cookie.getPath() + "\t" + cookie.getValue());
-            }
-            return response;
+            return Integer.valueOf(CleanShutdownTestCase.this.client.executeMethod(method));
          }
          finally
          {



More information about the jboss-cvs-commits mailing list