[jboss-remoting-commits] JBoss Remoting SVN: r5652 - remoting2/branches/2.2/src/tests/org/jboss/test/remoting/invoker.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Fri Jan 8 17:46:07 EST 2010


Author: ron.sigal at jboss.com
Date: 2010-01-08 17:46:06 -0500 (Fri, 08 Jan 2010)
New Revision: 5652

Modified:
   remoting2/branches/2.2/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
Log:
JBREM-1176: Updated testStaticTimer() to account for the destruction and recreation of the Timer.

Modified: remoting2/branches/2.2/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java
===================================================================
--- remoting2/branches/2.2/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java	2010-01-08 22:14:34 UTC (rev 5651)
+++ remoting2/branches/2.2/src/tests/org/jboss/test/remoting/invoker/ClientInvokerDelayedDestructionTestCase.java	2010-01-08 22:46:06 UTC (rev 5652)
@@ -51,6 +51,7 @@
 
 /**
  * Unit tests from JBREM-877.
+ * Adjusted for JBREM-1176.
  * 
  * @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
  * @version $Revision: 1.1 $
@@ -271,10 +272,11 @@
       setupServer();
       
       
-      // Get static Timer.
+      // Verify Timer hasn't been created.
       Field field = Client.class.getDeclaredField("invokerDestructionTimer");
       field.setAccessible(true);
       Timer invokerDestructionTimer = (Timer) field.get(null);
+      assertNull(invokerDestructionTimer);
       
       // Create client.
       InvokerLocator clientLocator = new InvokerLocator(locatorURI);
@@ -292,6 +294,10 @@
          clients[i].disconnect();
       }
       
+      // Verify Timer has been created.
+      invokerDestructionTimer = (Timer) field.get(null);
+      assertNotNull(invokerDestructionTimer);
+      
       // Verify all Clients are using the same Timer.
       for (int i = 0; i < 50; i++)
       {
@@ -300,7 +306,37 @@
       
       Thread.sleep(10000);
       assertEquals(0, InvokerRegistry.getClientInvokers().length);
+      
+      // Verify Timer has been destroyed.
+      invokerDestructionTimer = (Timer) field.get(null);
+      assertNull(invokerDestructionTimer);
+      
+      // Recreate Clients to verify that a new Timer is created.
+      for (int i = 0; i < 50; i++)
+      {
+         clients[i] = new Client(clientLocator, clientConfig);
+         clients[i].connect();
+         assertEquals("abc", clients[i].invoke("abc"));
+         clients[i].disconnect();
+      }
+      
+      // Verify Timer has been created.
+      invokerDestructionTimer = (Timer) field.get(null);
+      assertNotNull(invokerDestructionTimer);
+      
+      // Verify all Clients are using the same Timer.
+      for (int i = 0; i < 50; i++)
+      {
+         assertEquals("Should be the same Timer", invokerDestructionTimer, field.get(clients[i]));
+      }
 
+      Thread.sleep(10000);
+      assertEquals(0, InvokerRegistry.getClientInvokers().length);
+      
+      // Verify Timer has been destroyed.
+      invokerDestructionTimer = (Timer) field.get(null);
+      assertNull(invokerDestructionTimer);
+      
       shutdownServer();
       log.info(getName() + " PASSES");
    }



More information about the jboss-remoting-commits mailing list