[hornetq-commits] JBoss hornetq SVN: r7983 - in branches/hornetq_grouping: tests/src/org/hornetq/tests/integration/cluster/distribution and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Sep 23 05:57:19 EDT 2009


Author: ataylor
Date: 2009-09-23 05:57:19 -0400 (Wed, 23 Sep 2009)
New Revision: 7983

Modified:
   branches/hornetq_grouping/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
   branches/hornetq_grouping/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
Log:
fix and new test

Modified: branches/hornetq_grouping/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
===================================================================
--- branches/hornetq_grouping/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java	2009-09-23 09:35:05 UTC (rev 7982)
+++ branches/hornetq_grouping/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java	2009-09-23 09:57:19 UTC (rev 7983)
@@ -36,6 +36,7 @@
 import org.hornetq.core.server.group.impl.Response;
 import org.hornetq.core.server.group.Arbitrator;
 import org.hornetq.core.transaction.Transaction;
+import org.hornetq.core.exception.HornetQException;
 import org.hornetq.utils.SimpleString;
 
 /**
@@ -359,7 +360,7 @@
                         break;
                      }
                   }
-                  if( chosen != null && (routeWhenNoConsumers || chosen.isHighAcceptPriority(message)))
+                  if( chosen != null)
                   {
                      System.out.println("found sending message" + message.getProperty("count_prop") + " to " + chosen.getClusterName());
                      chosen.willRoute(message);
@@ -369,6 +370,7 @@
                   else
                   {
                      System.out.println("BindingsImpl.route");
+                     throw new HornetQException(HornetQException.QUEUE_DOES_NOT_EXIST, "queue " + resp.getChosen() + " has been removed cannot deliver message, queues should not be removed when grouping is used");
                   }
                }
             }

Modified: branches/hornetq_grouping/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java
===================================================================
--- branches/hornetq_grouping/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java	2009-09-23 09:35:05 UTC (rev 7982)
+++ branches/hornetq_grouping/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredGroupingTest.java	2009-09-23 09:57:19 UTC (rev 7983)
@@ -14,6 +14,7 @@
 
 import org.hornetq.core.message.impl.MessageImpl;
 import org.hornetq.core.server.group.impl.ArbitratorConfiguration;
+import org.hornetq.core.exception.HornetQException;
 import org.hornetq.utils.SimpleString;
 
 /**
@@ -369,7 +370,7 @@
          addConsumer(1, 1, "queue0", null);
          addConsumer(2, 2, "queue0", null);
 
-         verifyReceiveAllInRange(0, 30, 1);
+         verifyReceiveAllInRange(0, 30, 1 );
 
          System.out.println("*****************************************************************************");
       }
@@ -426,15 +427,41 @@
          sendInRange(0, "queues.testaddress", 0, 10, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
 
          verifyReceiveAllInRange(0, 10, 0);
-         removeConsumer(0);
-         deleteQueue(0, "queue0");
          sendInRange(1, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
 
          verifyReceiveAllInRange(10, 20, 0);
-         sendInRange(2, "queues.testaddress", 10, 20, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+         sendInRange(2, "queues.testaddress", 20, 30, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
 
-         verifyReceiveAllInRange(10, 20, 0);
-
+         verifyReceiveAllInRange(20, 30, 0);
+         removeConsumer(0);
+         deleteQueue(0, "queue0");
+         try
+         {
+            sendInRange(0, "queues.testaddress", 30, 31, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+            fail("should throw exception");
+         }
+         catch (HornetQException e)
+         {
+            assertEquals(e.getCode(), HornetQException.QUEUE_DOES_NOT_EXIST);
+         }
+         try
+         {
+            sendInRange(1, "queues.testaddress", 31, 32, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+            fail("should throw exception");
+         }
+         catch (HornetQException e)
+         {
+            assertEquals(e.getCode(), HornetQException.QUEUE_DOES_NOT_EXIST);
+         }
+         try
+         {
+            sendInRange(2, "queues.testaddress", 32, 33, false, MessageImpl.HDR_GROUP_ID, new SimpleString("id1"));
+            fail("should throw exception");
+         }
+         catch (HornetQException e)
+         {
+            assertEquals(e.getCode(), HornetQException.QUEUE_DOES_NOT_EXIST);
+         }
          System.out.println("*****************************************************************************");
       }
       finally
@@ -447,7 +474,7 @@
       }
    }
 
-   /*public void testGroupingSendTo3queuesPinnedNodeGoesDown() throws Exception
+   public void testGroupingSendTo3queuesPinnedNodeGoesDown() throws Exception
    {
       setupServer(0, isFileStorage(), isNetty());
       setupServer(1, isFileStorage(), isNetty());
@@ -514,7 +541,7 @@
 
          stopServers(0, 1, 2);
       }
-   }*/
+   }
 
    public boolean isNetty()
    {



More information about the hornetq-commits mailing list