[jboss-cvs] JBoss Messaging SVN: r5305 - in branches/Branch_JBMESSAGING_1416: 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
Fri Nov 7 04:37:56 EST 2008


Author: gaohoward
Date: 2008-11-07 04:37:56 -0500 (Fri, 07 Nov 2008)
New Revision: 5305

Modified:
   branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
   branches/Branch_JBMESSAGING_1416/tests/src/org/jboss/test/messaging/jms/clustering/OrderingGroupBasicClusteringTest.java
Log:
JBMESSAGING-1416  failover, message sucker tests


Modified: branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java	2008-11-07 08:40:09 UTC (rev 5304)
+++ branches/Branch_JBMESSAGING_1416/src/main/org/jboss/messaging/core/impl/ChannelSupport.java	2008-11-07 09:37:56 UTC (rev 5305)
@@ -164,6 +164,8 @@
 
       // Each channel has its own copy of the reference
       ref = ref.copy();
+      
+      monitor.registerMessage(ref, null);
 
       try
       {

Modified: branches/Branch_JBMESSAGING_1416/tests/src/org/jboss/test/messaging/jms/clustering/OrderingGroupBasicClusteringTest.java
===================================================================
--- branches/Branch_JBMESSAGING_1416/tests/src/org/jboss/test/messaging/jms/clustering/OrderingGroupBasicClusteringTest.java	2008-11-07 08:40:09 UTC (rev 5304)
+++ branches/Branch_JBMESSAGING_1416/tests/src/org/jboss/test/messaging/jms/clustering/OrderingGroupBasicClusteringTest.java	2008-11-07 09:37:56 UTC (rev 5305)
@@ -44,7 +44,7 @@
 /**
  * A OrderingGroupBasicClusteringTest
  *
- * @author howard
+ * @author Howard Gao 
  * 
  * Created Nov 4, 2008 10:30:22 AM
  *
@@ -69,17 +69,100 @@
    }
 
    // Public --------------------------------------------------------
+   
+   /*
+    * make sure the ordering group works when failover happens.
+    */
    public void testOrderingKillFailoverNode() throws Exception
    {
       testKillFailoverNode(false);
    }
    
+   /*
+    * make sure the ordering group works when failover happens.
+    */
    public void testOrderingKillFailoverNodeTx() throws Exception
    {
       testKillFailoverNode(true);
    }
 
+   /*
+    * Make sure the ordering group works when message sucking happens.
+    */
+   public void testOnSuckPersistent() throws Exception
+   {
+      testMessageReceiveOnSuck(true);
+   }
    
+   /*
+    * Make sure the ordering group works when message sucking happens.
+    */
+   public void testOnSuckNonPersistent() throws Exception
+   {
+      testMessageReceiveOnSuck(false);
+   }
+
+   private void testMessageReceiveOnSuck(boolean persistent) throws Exception
+   {
+      Connection conn0 = null;
+      Connection conn1 = null;
+      Connection conn2 = null;
+
+      try
+      {
+         conn0 = this.createConnectionOnServer(cf, 0);
+         conn1 = this.createConnectionOnServer(cf, 1);
+         conn2 = this.createConnectionOnServer(cf, 2);
+
+         Session sess0 = conn0.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         
+         MessageConsumer cons2 = sess2.createConsumer(queue[2]);
+         
+         conn0.start();
+         conn2.start();
+
+         // Send at node 0
+         JBossMessageProducer prod0 = (JBossMessageProducer)sess0.createProducer(queue[0]);
+         prod0.enableOrderingGroup(null);
+
+         int delMode = persistent ? DeliveryMode.PERSISTENT : DeliveryMode.NON_PERSISTENT;
+         
+         for (int i = 0; i < 100; i++)
+         {
+            TextMessage tms = sess0.createTextMessage("suckedmessage" + i);
+            prod0.send(tms, delMode, i%10, Message.DEFAULT_TIME_TO_LIVE);
+         }
+
+         for (int j = 0; j < 100; j++)
+         {
+            TextMessage rms = (TextMessage)cons2.receive(1000);
+            assertNotNull(rms);
+            assertEquals("suckedmessage" + j, rms.getText());
+         }
+         
+         TextMessage nulMsg = (TextMessage)cons2.receive(5000);
+         assertNull(nulMsg);
+         
+      }
+      finally
+      {
+         if (conn0 != null)
+         {
+            conn0.close();
+         }
+
+         if (conn1 != null)
+         {
+            conn1.close();
+         }
+
+         if (conn2 != null)
+         {
+            conn2.close();
+         }
+      }
+   }
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------




More information about the jboss-cvs-commits mailing list