[jboss-cvs] JBoss Messaging SVN: r2490 - in trunk: tests/src/org/jboss/test/messaging/jms/clustering and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Wed Feb 28 01:14:09 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-02-28 01:14:08 -0500 (Wed, 28 Feb 2007)
New Revision: 2490

Modified:
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-898 and http://jira.jboss.org/jira/browse/JBMESSAGING-900

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-28 06:01:56 UTC (rev 2489)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-28 06:14:08 UTC (rev 2490)
@@ -37,6 +37,7 @@
 import org.jboss.jms.server.endpoint.CreateConnectionResult;
 import org.jboss.jms.server.remoting.JMSWireFormat;
 import org.jboss.jms.util.MessagingJMSException;
+import org.jboss.jms.util.MessagingNetworkFailureException;
 import org.jboss.jms.wireformat.ConnectionFactoryCreateConnectionDelegateRequest;
 import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest;
 import org.jboss.jms.wireformat.ResponseSupport;
@@ -285,7 +286,7 @@
       }
       catch (Exception e)
       {
-         throw new MessagingJMSException("Failed to connect client", e);
+         throw new MessagingNetworkFailureException("Failed to connect client", e);
       }
 
       client.setMarshaller(new JMSWireFormat());

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java	2007-02-28 06:01:56 UTC (rev 2489)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/ClusteredConnectionFactoryTest.java	2007-02-28 06:14:08 UTC (rev 2490)
@@ -22,12 +22,10 @@
 
 package org.jboss.test.messaging.jms.clustering;
 
-import java.lang.reflect.Field;
-
 import javax.jms.Connection;
-
-import org.jboss.jms.client.ClientAOPStackLoader;
 import org.jboss.jms.client.JBossConnection;
+import org.jboss.jms.client.JBossConnectionFactory;
+import org.jboss.jms.util.MessagingNetworkFailureException;
 import org.jboss.test.messaging.jms.clustering.base.ClusteringTestBase;
 import org.jboss.test.messaging.tools.ServerManagement;
 import org.jboss.test.messaging.tools.aop.PoisonInterceptor;
@@ -57,76 +55,64 @@
 
    public void testGetAOPBroken() throws Exception
    {
-      Connection conn = null;
-
       try
       {
-
-         resetAOP();
-
-         ServerManagement.killAndWait(2);
-         ServerManagement.killAndWait(1);
          ServerManagement.killAndWait(0);
+         ServerManagement.killAndWait(1);
+         ServerManagement.killAndWait(2);
 
          try
          {
-            conn = cf.createConnection();
+            assertNotNull(((JBossConnectionFactory)cf).getDelegate().getClientAOPStack());
             fail ("This should try an exception as every server is down");
          }
-         catch (RuntimeException e)
+         catch (MessagingNetworkFailureException e)
          {
-            log.error(e.toString(), e);
+            log.trace(e.toString(), e);
          }
       }
       finally
       {
+         // need to re-start 0, it's the RMI server the other servers use
+         ServerManagement.start(0, "all", true);
+      }
+   }
+
+   public void testLoadAOP() throws Exception
+   {
+
+      Connection conn = null;
+
+      try
+      {
+
+         ServerManagement.killAndWait(0);
+         ServerManagement.killAndWait(1);
+
+         assertNotNull(((JBossConnectionFactory)cf).getDelegate().getClientAOPStack());
+
+         conn = cf.createConnection();
+         assertEquals(2, ((JBossConnection)conn).getServerID());
+      }
+      finally
+      {
          if (conn != null)
          {
-            conn.close();
+            try
+            {
+               conn.close();
+            }
+            catch (Exception ignored)
+            {
+            }
          }
 
+         ServerManagement.killAndWait(2);
          // need to re-start 0, it's the RMI server the other servers use
          ServerManagement.start(0, "all", true);
       }
    }
 
-   // TODO: Commented out pending resolution.
-   // See http://jira.jboss.org/jira/browse/JBMESSAGING-900
-//   public void testGetAOPBounce() throws Exception
-//   {
-//      Connection conn = null;
-//      Server poisonedServer = null;
-//
-//      try
-//      {
-//
-//         resetAOP();
-//
-//         ServerManagement.killAndWait(0);
-//         poisonedServer =
-//            ServerManagement.poisonTheServer(1, PoisonInterceptor.CF_GET_CLIENT_AOP_STACK);
-//
-//         conn = cf.createConnection();
-//         assertEquals(2, ((JBossConnection)conn).getServerID());
-//      }
-//      finally
-//      {
-//         if (conn != null)
-//         {
-//            conn.close();
-//         }
-//
-//         // need to re-start 0, it's the RMI server the other servers use
-//         ServerManagement.start(0, "all", true);
-//
-//         // Kill the poisoned server
-//         if (poisonedServer != null)
-//         {
-//            poisonedServer.kill();
-//         }
-//      }
-//   }
-
    public void testCreateConnectionOnBrokenServer() throws Exception
    {
       Connection conn = null;
@@ -251,16 +237,6 @@
 
    // Private --------------------------------------------------------------------------------------
 
-   private void resetAOP() throws NoSuchFieldException, IllegalAccessException
-   {
-
-      // Using reflection to cleanup AOP status and force to load AOP again
-      Field field = ClientAOPStackLoader.class.getDeclaredField("instance");
-      field.setAccessible(true);
-      log.info("Reseting AOP");
-      field.set(null, null);
-   }
-
    // Inner classes --------------------------------------------------------------------------------
 
 }




More information about the jboss-cvs-commits mailing list