[jboss-cvs] JBoss Messaging SVN: r2130 - in trunk: src/main/org/jboss/jms/destination and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Feb 1 17:18:42 EST 2007


Author: ovidiu.feodorov at jboss.com
Date: 2007-02-01 17:18:41 -0500 (Thu, 01 Feb 2007)
New Revision: 2130

Modified:
   trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
   trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
   trunk/src/main/org/jboss/jms/destination/JBossDestination.java
   trunk/src/main/org/jboss/jms/message/JBossMessage.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
   trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
   trunk/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
   trunk/src/main/org/jboss/jms/wireformat/RequestSupport.java
   trunk/tests/etc/log4j.xml
   trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java
   trunk/tests/src/org/jboss/test/messaging/graveyard/GraveyardTest.java
   trunk/tests/src/org/jboss/test/messaging/graveyard/MultipleServerInvocationHandlersTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/JCAWrapperTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
Log:
minor refactoring

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConnectionFactoryDelegate.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -41,7 +41,6 @@
 import org.jboss.jms.wireformat.ConnectionFactoryGetClientAOPStackRequest;
 import org.jboss.jms.wireformat.ConnectionFactoryGetIDBlockRequest;
 import org.jboss.jms.wireformat.ResponseSupport;
-import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.remoting.Client;
 import org.jboss.remoting.InvokerLocator;
@@ -64,8 +63,6 @@
 
    private static final long serialVersionUID = 2512460695662741413L;
 
-   private static final Logger log = Logger.getLogger(ClientConnectionFactoryDelegate.class);
-
    // Attributes -----------------------------------------------------------------------------------
 
    //This data is needed in order to create a connection
@@ -77,8 +74,6 @@
    
    private boolean clientPing;
    
-   private transient boolean trace = log.isTraceEnabled();
-
    // Static ---------------------------------------------------------------------------------------
    
    /*
@@ -116,8 +111,7 @@
       this.serverLocatorURI = serverLocatorURI;
       this.serverVersion = serverVersion;
       this.clientPing = clientPing;
-      trace = log.isTraceEnabled();
-   }   
+   }
    
    public ClientConnectionFactoryDelegate()
    {      

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientConsumerDelegate.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -37,7 +37,6 @@
 import org.jboss.jms.wireformat.ConsumerCancelInflightMessagesRequest;
 import org.jboss.jms.wireformat.ConsumerChangeRateRequest;
 import org.jboss.jms.wireformat.RequestSupport;
-import org.jboss.remoting.Client;
 
 /**
  * The client-side Consumer delegate class.

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientProducerDelegate.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -27,7 +27,6 @@
 import org.jboss.jms.delegate.ProducerDelegate;
 import org.jboss.jms.destination.JBossDestination;
 import org.jboss.jms.message.JBossMessage;
-import org.jboss.remoting.Client;
 
 /**
  * The client-side Producer delegate class.

Modified: trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/client/delegate/ClientSessionDelegate.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -63,7 +63,6 @@
 import org.jboss.jms.wireformat.SessionRecoverDeliveriesRequest;
 import org.jboss.jms.wireformat.SessionSendRequest;
 import org.jboss.jms.wireformat.SessionUnsubscribeRequest;
-import org.jboss.logging.Logger;
 
 /**
  * The client-side Session delegate class.
@@ -82,8 +81,6 @@
 
    private static final long serialVersionUID = -8096852898620279131L;
 
-   private static final Logger log = Logger.getLogger(ClientSessionDelegate.class);
-
    // Attributes -----------------------------------------------------------------------------------
 
    // Static ---------------------------------------------------------------------------------------

Modified: trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/client/delegate/DelegateSupport.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -169,11 +169,19 @@
          
          if (oneWay)
          {
+            if (trace) { log.trace(this + " invoking " + req + " asynchronously on server"); }
+
             client.invokeOneway(req);
+
+            if (trace) { log.trace(this + " asynchronously invoked " + req + " on server, no response expected"); }
          }
          else
          {
+            if (trace) { log.trace(this + " invoking " + req + " synchronously on server"); }
+
             resp = client.invoke(req);
+
+            if (trace) { log.trace(this + " got server response for " + req + ": " + resp); }
          }
            
          Object res = null;

Modified: trunk/src/main/org/jboss/jms/destination/JBossDestination.java
===================================================================
--- trunk/src/main/org/jboss/jms/destination/JBossDestination.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/destination/JBossDestination.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -203,7 +203,8 @@
          {
             code = name.hashCode();
          }
-         return code + (isTopic() ? 37 : 71);
+         hash = code + (isTopic() ? 37 : 71);
+         return hash;
       }           
    }
    

Modified: trunk/src/main/org/jboss/jms/message/JBossMessage.java
===================================================================
--- trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/message/JBossMessage.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -23,7 +23,6 @@
 
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
-import java.io.IOException;
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.Enumeration;
@@ -45,10 +44,6 @@
 import javax.jms.TextMessage;
 
 import org.jboss.jms.destination.JBossDestination;
-import org.jboss.jms.destination.JBossQueue;
-import org.jboss.jms.destination.JBossTemporaryQueue;
-import org.jboss.jms.destination.JBossTemporaryTopic;
-import org.jboss.jms.destination.JBossTopic;
 import org.jboss.jms.util.MessagingJMSException;
 import org.jboss.messaging.core.message.MessageSupport;
 import org.jboss.messaging.util.StreamUtils;

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -173,6 +173,7 @@
       this.remotingClientSessionID = remotingSessionID;
       
       this.jmsClientVMID = clientVMID;
+      this.usingVersion = versionToUse; 
       
       this.serverPeer.getConnectionManager().
          registerConnection(jmsClientVMID, remotingClientSessionID, this);

Modified: trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/server/endpoint/ServerConnectionFactoryEndpoint.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -119,7 +119,8 @@
    public CreateConnectionResult createConnectionDelegate(String username,
                                                           String password,
                                                           int failedNodeID,
-                                                          String remotingSessionID, String clientVMID,
+                                                          String remotingSessionID,
+                                                          String clientVMID,
                                                           byte versionToUse,
                                                           ServerInvokerCallbackHandler callbackHandler)
       throws JMSException      

Modified: trunk/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java
===================================================================
--- trunk/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/server/remoting/JMSServerInvocationHandler.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -30,7 +30,6 @@
 
 import org.jboss.jms.wireformat.ConnectionFactoryCreateConnectionDelegateRequest;
 import org.jboss.jms.wireformat.RequestSupport;
-import org.jboss.jms.wireformat.ResponseSupport;
 import org.jboss.logging.Logger;
 import org.jboss.messaging.util.Util;
 import org.jboss.remoting.InvocationRequest;
@@ -123,14 +122,12 @@
          }
       }
       
-      ResponseSupport response = request.serverInvoke();
-                  
-      return response;
+      return request.serverInvoke();
    }
 
    public void addListener(InvokerCallbackHandler callbackHandler)
    {                 
-      if (log.isTraceEnabled()) { log.trace("adding callback handler " + callbackHandler); }
+      log.debug("adding callback handler " + callbackHandler);
       
       if (callbackHandler instanceof ServerInvokerCallbackHandler)
       {
@@ -156,7 +153,7 @@
 
    public void removeListener(InvokerCallbackHandler callbackHandler)
    {
-      if (log.isTraceEnabled()) { log.trace("removing callback handler " + callbackHandler); }
+      log.debug("removing callback handler " + callbackHandler);
       
       synchronized(callbackHandlers)
       {

Modified: trunk/src/main/org/jboss/jms/wireformat/RequestSupport.java
===================================================================
--- trunk/src/main/org/jboss/jms/wireformat/RequestSupport.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/src/main/org/jboss/jms/wireformat/RequestSupport.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -28,9 +28,6 @@
 import org.jboss.remoting.InvocationRequest;
 
 /**
- * 
- * A PacketSupport
- *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @version <tt>$Revision: 1.1 $</tt>
  *

Modified: trunk/tests/etc/log4j.xml
===================================================================
--- trunk/tests/etc/log4j.xml	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/etc/log4j.xml	2007-02-01 22:18:41 UTC (rev 2130)
@@ -47,8 +47,8 @@
    </category>
 
    <category name="org.jboss.remoting">
-      <priority value="TRACE" class="org.jboss.logging.XLevel"/>
-      <!-- <priority value="DEBUG"/> -->
+      <!-- <priority value="TRACE" class="org.jboss.logging.XLevel"/> -->
+      <priority value="DEBUG"/>
    </category>
 
    <category name="org.jboss">
@@ -82,8 +82,7 @@
    </category>
 
    <category name="org.jboss.jms.server.remoting.JMSWireFormat">
-      <priority value="TRACE" class="org.jboss.logging.XLevel"/>
-      <!-- <priority value="DEBUG"/> -->
+      <priority value="DEBUG"/>
    </category>
 
    <root>

Modified: trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/core/paging/base/PagingStateTestBase.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -123,7 +123,8 @@
    
    protected Transaction createXATx() throws Exception
    {
-      MessagingXid xid = new MessagingXid(new GUID().toString().getBytes(), 345, new GUID().toString().getBytes());
+      MessagingXid xid =
+         new MessagingXid(new GUID().toString().getBytes(), 345, new GUID().toString().getBytes());
       
       return tr.createTransaction(xid);
    }
@@ -158,8 +159,8 @@
       
       SimpleDelivery[] dels;
       
-      ConsumingReceiver(int numToConsume, MessageReference[] refs, int consumeCount, boolean tx, boolean xa)
-         throws Exception
+      ConsumingReceiver(int numToConsume, MessageReference[] refs,
+                        int consumeCount, boolean tx, boolean xa) throws Exception
       {
          this.numToConsume = numToConsume;
          
@@ -174,7 +175,8 @@
          this.dels = new SimpleDelivery[numToConsume];
       }
 
-      public synchronized Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx)
+      public synchronized Delivery handle(DeliveryObserver observer,
+                                          MessageReference ref, Transaction tx)
       {  
          if (count >= numToConsume)
          {
@@ -267,7 +269,8 @@
          
       }
 
-      public synchronized Delivery handle(DeliveryObserver observer, MessageReference ref, Transaction tx)
+      public synchronized Delivery handle(DeliveryObserver observer,
+                                          MessageReference ref, Transaction tx)
       {
          if (count == numToCancel)
          {
@@ -425,7 +428,8 @@
       
       List msgIds = new ArrayList();
 
-      String sql = "SELECT MESSAGEID, ORD, PAGE_ORD FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? ORDER BY ORD";
+      String sql =
+         "SELECT MESSAGEID, ORD, PAGE_ORD FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? ORDER BY ORD";
       PreparedStatement ps = conn.prepareStatement(sql);
       ps.setLong(1, channelId);
    
@@ -467,7 +471,8 @@
       
       List msgIds = new ArrayList();
  
-      String sql = "SELECT MESSAGEID, ORD, PAGE_ORD FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? ORDER BY PAGE_ORD";
+      String sql =
+         "SELECT MESSAGEID, ORD, PAGE_ORD FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? ORDER BY PAGE_ORD";
       PreparedStatement ps = conn.prepareStatement(sql);
       ps.setLong(1, channelId);
    
@@ -506,7 +511,10 @@
       mgr.begin();
 
       Connection conn = ds.getConnection();
-      String sql = "SELECT MESSAGEID FROM JMS_MESSAGE_REFERENCE WHERE CHANNELID=? AND PAGE_ORD IS NOT NULL ORDER BY PAGE_ORD";
+      String sql =
+         "SELECT MESSAGEID FROM JMS_MESSAGE_REFERENCE WHERE " +
+         "CHANNELID=? AND PAGE_ORD IS NOT NULL ORDER BY PAGE_ORD";
+
       PreparedStatement ps = conn.prepareStatement(sql);
       ps.setLong(1, channelId);
    
@@ -569,5 +577,4 @@
       
       return msgIds;
    }
-   
 }

Modified: trunk/tests/src/org/jboss/test/messaging/graveyard/GraveyardTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/graveyard/GraveyardTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/graveyard/GraveyardTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -51,9 +51,8 @@
 import org.jboss.tm.TransactionManagerLocator;
 
 /**
- * 
- * This is where we put individual tests that are no longer valid.
- * 
+ * This is where we put individual tests that are no longer valid. They are kept here for historical
+ * reasons, but they are not run as part of the testsuite, because most likely will fail.
  *
  * @author <a href="mailto:tim.fox at jboss.com">Tim Fox</a>
  * @version <tt>$Revision: 1.1 $</tt>
@@ -63,55 +62,33 @@
  */
 public class GraveyardTest extends MessagingTestCase
 {
+   // Constants ------------------------------------------------------------------------------------
+
    private static final Logger log = Logger.getLogger(GraveyardTest.class);
 
-   
-   public GraveyardTest(String name)
-   {
-      super(name);
-   }
-   
-   protected InitialContext initialContext;
+   // Static ---------------------------------------------------------------------------------------
 
-   protected ConnectionFactory cf;
-   
-   protected Destination topic;
-   
-   protected Destination queue;
+   // Attributes -----------------------------------------------------------------------------------
 
+   private InitialContext initialContext;
+   private ConnectionFactory cf;
+   private Destination topic;
+   private Destination queue;
 
-   protected void setUp() throws Exception
-   {
-      super.setUp();
-      
-      ServerManagement.start("all");      
-      
-      initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
-      
-      cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
-      
-      ServerManagement.undeployTopic("Topic");
-      
-      ServerManagement.deployTopic("Topic");
-      
-      topic = (Destination)initialContext.lookup("/topic/Topic");
-   }
+   // Constructors ---------------------------------------------------------------------------------
 
-   protected void tearDown() throws Exception
+   public GraveyardTest(String name)
    {
-      ServerManagement.undeployTopic("Topic");
-      
-      super.tearDown();      
+      super(name);
    }
 
-   
-   /*
-    * This test was excluded on 31/01/07 since we do not pass a session id in every invocation therefore
-    * it's not possible to guarantee the "correct" one is used.
-    * This is ok, since our remoting connector is exclusively ours, no one else will use it
-    */
-   
+   // Public ---------------------------------------------------------------------------------------
+
    /**
+    * This test was excluded on 31/01/07 since we do not pass a remoting session ID in every
+    * invocation therefore it's not possible to guarantee the "correct" one is used. This is ok,
+    * since our remoting connector is exclusively ours, no one else will use it.
+    *
     * Test create connection when there is another Remoting invocation handler registered with the
     * Connector. I uncovered this bug while trying to run TCK/integration tests. In real life
     * Messaging has to co-exist with other invocation handlers registered with the Unified invoker's
@@ -155,42 +132,18 @@
          ServerManagement.removeServerInvocationHandler("DEFAULT_INVOCATION_HANDLER");
       }
    }
-   
-   private static class SimpleServerInvocationHandler
-   implements ServerInvocationHandler, Serializable
-   {
-      private static final long serialVersionUID = 23847329753297523L;
-      
-      public void setMBeanServer(MBeanServer server)
-      {
-      }
-      
-      public void setInvoker(ServerInvoker invoker)
-      {
-      }
-      
-      public Object invoke(InvocationRequest invocation) throws Throwable
-      {
-         log.error("received invocation " + invocation + ", " + invocation.getParameter());
-         fail("This ServerInvocationHandler is not supposed to handle invocations");
-         return null;
-      }
-      
-      public void addListener(InvokerCallbackHandler callbackHandler)
-      {
-         fail("This ServerInvocationHandler is not supposed to add listeners");
-      }
-      
-      public void removeListener(InvokerCallbackHandler callbackHandler)
-      {
-         fail("This ServerInvocationHandler is not supposed to remove listeners");
-      }
-   }
-   
-   
-   
-   
+
    /**
+    * Test excluded on 02/01/2007.
+    *
+    * The Messaging-layer level changes required to fix
+    * http://jira.jboss.org/jira/browse/JBMESSAGING-721 will modify again the behavior checked
+    * here. The changes will be made public in 1.0.1.SP4 and 1.2.0.CR1. The way an XASession behaves
+    * in absence of a JTA transaction is incompletely specified, so it is inevitable that different
+    * implemenation would work differently. Ultimately, it's up to the JCA layer, not the JMS layer,
+    * to enforce a certain behavior. For more discussions on the subject, please also read
+    * http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577.
+    *
     * Test case for http://jira.jboss.org/jira/browse/JBMESSAGING-410.
     */
    public void testSendNoGlobalTransaction() throws Exception
@@ -209,7 +162,8 @@
 
          Queue queue = (Queue)initialContext.lookup("queue/MyQueue");
 
-         ConnectionFactory mcf = (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
+         ConnectionFactory mcf =
+            (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
 
          Connection conn = mcf.createConnection();
 
@@ -248,6 +202,16 @@
    }
 
    /**
+    * Test excluded on 02/01/2007.
+    *
+    * The Messaging-layer level changes required to fix
+    * http://jira.jboss.org/jira/browse/JBMESSAGING-721 will modify again the behavior checked
+    * here. The changes will be made public in 1.0.1.SP4 and 1.2.0.CR1. The way an XASession behaves
+    * in absence of a JTA transaction is incompletely specified, so it is inevitable that different
+    * implemenation would work differently. Ultimately, it's up to the JCA layer, not the JMS layer,
+    * to enforce a certain behavior. For more discussions on the subject, please also read
+    * http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577.
+    *
     * Test case for http://jira.jboss.org/jira/browse/JBMESSAGING-410. Use a cached connection that
     * was initally enroled in a global transaction.
     */
@@ -259,7 +223,8 @@
       try
       {
 
-         ConnectionFactory mcf = (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
+         ConnectionFactory mcf =
+            (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
          Connection conn = mcf.createConnection();
          conn.start();
 
@@ -329,6 +294,16 @@
    }
 
    /**
+    * Test excluded on 02/01/2007.
+    *
+    * The Messaging-layer level changes required to fix
+    * http://jira.jboss.org/jira/browse/JBMESSAGING-721 will modify again the behavior checked
+    * here. The changes will be made public in 1.0.1.SP4 and 1.2.0.CR1. The way an XASession behaves
+    * in absence of a JTA transaction is incompletely specified, so it is inevitable that different
+    * implemenation would work differently. Ultimately, it's up to the JCA layer, not the JMS layer,
+    * to enforce a certain behavior. For more discussions on the subject, please also read
+    * http://www.jboss.com/index.html?module=bb&op=viewtopic&t=98577.
+    *
     * Test case for http://jira.jboss.org/jira/browse/JBMESSAGING-520.
     */
    public void testReceiveNoGlobalTransaction() throws Exception
@@ -357,7 +332,8 @@
          {
             // using a JCA wrapper
 
-            ConnectionFactory mcf = (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
+            ConnectionFactory mcf =
+               (ConnectionFactory)initialContext.lookup("java:/JCAConnectionFactory");
             conn = mcf.createConnection();
             conn.start();
 
@@ -392,4 +368,67 @@
          ServerManagement.undeployQueue("MyQueue2");
       }
    }
+
+   // Package protected ----------------------------------------------------------------------------
+
+   // Protected ------------------------------------------------------------------------------------
+
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      ServerManagement.start("all");
+
+      initialContext = new InitialContext(ServerManagement.getJNDIEnvironment());
+
+      cf = (ConnectionFactory)initialContext.lookup("/ConnectionFactory");
+
+      ServerManagement.undeployTopic("Topic");
+
+      ServerManagement.deployTopic("Topic");
+
+      topic = (Destination)initialContext.lookup("/topic/Topic");
+   }
+
+   protected void tearDown() throws Exception
+   {
+      ServerManagement.undeployTopic("Topic");
+
+      super.tearDown();
+   }
+
+   // Private --------------------------------------------------------------------------------------
+
+   // Inner classes --------------------------------------------------------------------------------
+
+   private static class SimpleServerInvocationHandler
+      implements ServerInvocationHandler, Serializable
+   {
+      private static final long serialVersionUID = 23847329753297523L;
+
+      public void setMBeanServer(MBeanServer server)
+      {
+      }
+
+      public void setInvoker(ServerInvoker invoker)
+      {
+      }
+
+      public Object invoke(InvocationRequest invocation) throws Throwable
+      {
+         log.error("received invocation " + invocation + ", " + invocation.getParameter());
+         fail("This ServerInvocationHandler is not supposed to handle invocations");
+         return null;
+      }
+
+      public void addListener(InvokerCallbackHandler callbackHandler)
+      {
+         fail("This ServerInvocationHandler is not supposed to add listeners");
+      }
+
+      public void removeListener(InvokerCallbackHandler callbackHandler)
+      {
+         fail("This ServerInvocationHandler is not supposed to remove listeners");
+      }
+   }
 }

Modified: trunk/tests/src/org/jboss/test/messaging/graveyard/MultipleServerInvocationHandlersTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/graveyard/MultipleServerInvocationHandlersTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/graveyard/MultipleServerInvocationHandlersTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -44,11 +44,10 @@
 import java.io.Serializable;
 
 /**
+ * This test was excluded on 31/01/07 since we do not pass a remoting session ID in every invocation
+ * therefore it's not possible to guarantee the "correct" one is used. This is ok, since our
+ * remoting connector is exclusively ours, no one else will use it
  * 
- * This test was excluded on 31/01/07 since we do not pass a session id in every invocation therefore
- * it's not possible to guarantee the "correct" one is used.
- * This is ok, since our remoting connector is exclusively ours, no one else will use it
- * 
  * Tests the situation when there is more than one ServerInvokerHandler registered with the
  * Remoting connector. Goes through a combination of most common use cases.
  *
@@ -59,22 +58,22 @@
  */
 public class MultipleServerInvocationHandlersTest extends MessagingTestCase
 {
-   // Constants -----------------------------------------------------
+   // Constants ------------------------------------------------------------------------------------
 
-   // Static --------------------------------------------------------
+   // Static ---------------------------------------------------------------------------------------
 
-   // Attributes ----------------------------------------------------
+   // Attributes -----------------------------------------------------------------------------------
 
    InitialContext ic;
 
-   // Constructors --------------------------------------------------
+   // Constructors ---------------------------------------------------------------------------------
 
    public MultipleServerInvocationHandlersTest(String name)
    {
       super(name);
    }
 
-   // Public --------------------------------------------------------
+   // Public ---------------------------------------------------------------------------------------
 
    public void testMessageRoundTrip() throws Exception
    {
@@ -114,9 +113,9 @@
       conn.close();
    }
 
-   // Package protected ---------------------------------------------
+   // Package protected ----------------------------------------------------------------------------
 
-   // Protected -----------------------------------------------------
+   // Protected ------------------------------------------------------------------------------------
 
    protected void setUp() throws Exception
    {
@@ -158,9 +157,9 @@
       super.tearDown();
    }
 
-   // Private -------------------------------------------------------
+   // Private --------------------------------------------------------------------------------------
 
-   // Inner classes -------------------------------------------------
+   // Inner classes --------------------------------------------------------------------------------
 
    private static class SimpleServerInvocationHandler
       implements ServerInvocationHandler, Serializable

Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionClosedTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -456,10 +456,8 @@
 
       // Browser
 
-
    }
 
-
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------

Modified: trunk/tests/src/org/jboss/test/messaging/jms/JCAWrapperTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/JCAWrapperTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/jms/JCAWrapperTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -28,12 +28,9 @@
 import javax.jms.Queue;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import javax.jms.DeliveryMode;
-import javax.jms.MessageConsumer;
 import javax.naming.InitialContext;
 import javax.transaction.Transaction;
 import javax.transaction.UserTransaction;
-import javax.management.ObjectName;
 
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
@@ -160,8 +157,6 @@
       }
    }
 
-   
-
    // Package protected ---------------------------------------------
    
    // Protected -----------------------------------------------------

Modified: trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/jms/WireFormatTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -93,7 +93,6 @@
 import org.jboss.jms.wireformat.SessionRecoverDeliveriesRequest;
 import org.jboss.jms.wireformat.SessionSendRequest;
 import org.jboss.jms.wireformat.SessionUnsubscribeRequest;
-import org.jboss.logging.Logger;
 import org.jboss.messaging.core.plugin.IDBlock;
 import org.jboss.messaging.core.tx.MessagingXid;
 import org.jboss.remoting.InvocationRequest;
@@ -101,9 +100,6 @@
 import org.jboss.test.messaging.tools.ServerManagement;
 
 /**
- * 
- * A WireFormatTest.
- * 
  * @author <a href="tim.fox at jboss.com">Tim Fox</a>
  * @version <tt>$Revision$</tt>
  *
@@ -113,8 +109,6 @@
 {
    // Constants -----------------------------------------------------
       
-   private static final Logger log = Logger.getLogger(WireFormatTest.class);
-
    // Static --------------------------------------------------------
       
    // Attributes ----------------------------------------------------

Modified: trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/jms/XARecoveryTest.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -1167,7 +1167,6 @@
       }
    }
    
-   
    /* Not really necessary - but it does no harm */
    public void testComplexTransactional() throws Exception
    {
@@ -3325,8 +3324,6 @@
             }
          }    
       }
-
    }
-
 }
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java	2007-02-01 20:09:49 UTC (rev 2129)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/base/ClusteringTestBase.java	2007-02-01 22:18:41 UTC (rev 2130)
@@ -46,11 +46,11 @@
  */
 public class ClusteringTestBase extends MessagingTestCase
 {
-   // Constants -----------------------------------------------------
+   // Constants ------------------------------------------------------------------------------------
 
-   // Static --------------------------------------------------------
+   // Static ---------------------------------------------------------------------------------------
 
-   // Attributes ----------------------------------------------------
+   // Attributes -----------------------------------------------------------------------------------
 
    protected int nodeCount;
 
@@ -63,18 +63,18 @@
 
    protected ConnectionFactory cf;
 
-   // Constructors --------------------------------------------------
+   // Constructors ---------------------------------------------------------------------------------
 
    public ClusteringTestBase(String name)
    {
       super(name);
    }
 
-   // Public --------------------------------------------------------
+   // Public ---------------------------------------------------------------------------------------
 
-   // Package protected ---------------------------------------------
+   // Package protected ----------------------------------------------------------------------------
 
-   // Protected -----------------------------------------------------
+   // Protected ------------------------------------------------------------------------------------
 
    protected void setUp() throws Exception
    {
@@ -177,7 +177,8 @@
    }
 
    // lookup for the connection with the right serverID
-   // I'm using this method to find the proper serverId so I won't relay on loadBalancing policies on testcases
+   // I'm using this method to find the proper serverId so I won't relay on loadBalancing policies
+   // on testcases.
    protected Connection getConnection(Connection[] conn, int serverId) throws Exception
    {
       for(int i = 0; i < conn.length; i++)
@@ -222,7 +223,7 @@
       }
    }
 
-   // Private -------------------------------------------------------
+   // Private --------------------------------------------------------------------------------------
 
    private void drainQueues() throws Exception
    {
@@ -234,13 +235,9 @@
          // (round-robin in this case). If we want a connection to a specific node, we should be
          // able to look up something like "/ConnectionFactory0"
          
-         log.info("cf is " + cf);
-
          for(int i = 0; i < nodeCount; i++)
          {
             conn[i] = cf.createConnection();
-            
-            log.info("************ connection is " + conn[i].getClass().getName() + ":" + conn[i]);
          }
 
          // Safety check, making sure we get connections to distinct nodes
@@ -277,6 +274,6 @@
       }
    }
 
-   // Inner classes -------------------------------------------------
+   // Inner classes --------------------------------------------------------------------------------
 
 }




More information about the jboss-cvs-commits mailing list