[jboss-cvs] JBoss Messaging SVN: r8553 - in branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919: docs/examples/ordering-group and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 20 10:37:30 EDT 2012


Author: tcowhey
Date: 2012-07-20 10:37:29 -0400 (Fri, 20 Jul 2012)
New Revision: 8553

Added:
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/RouteResult.java
Modified:
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/docs/examples/ordering-group/
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/contract/PostOffice.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
   branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanExtraTest.java
Log:
JBPAPP-9421


Property changes on: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919
___________________________________________________________________
Added: svn:mergeinfo
   + /branches/Branch_1_4:8518


Property changes on: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/docs/examples/ordering-group
___________________________________________________________________
Deleted: svn:mergeinfo
   - 

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/jms/server/endpoint/ServerConnectionEndpoint.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -65,6 +65,7 @@
 import org.jboss.messaging.core.contract.MessageStore;
 import org.jboss.messaging.core.contract.PostOffice;
 import org.jboss.messaging.core.contract.Queue;
+import org.jboss.messaging.core.impl.postoffice.RouteResult;
 import org.jboss.messaging.core.impl.tx.Transaction;
 import org.jboss.messaging.core.impl.tx.TransactionRepository;
 import org.jboss.messaging.util.ExceptionUtil;
@@ -768,7 +769,8 @@
       else if (dest.isQueue())
       {
          if (trace) { log.trace(this + " routing " + msg + " to queue"); }
-         if (!postOffice.route(ref, new JMSCondition(true, dest.getName()), tx))
+         RouteResult result = postOffice.route(ref, new JMSCondition(true, dest.getName()), tx);
+         if (!result.getResult())
          {
             throw new JMSException("Failed to route " + ref + " to " + dest.getName());
          }
@@ -776,7 +778,11 @@
       else
       {
          if (trace) { log.trace(this + " routing " + msg + " to postoffice"); }
-         postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);
+         RouteResult result = postOffice.route(ref, new JMSCondition(false, dest.getName()), tx);
+         if (result.isFailue())
+         {
+            throw new JMSException("Failed to route " + ref + " to " + dest.getName());
+         }
       }
 
       if (trace) { log.trace("sent " + msg); }

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/contract/PostOffice.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/contract/PostOffice.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/contract/PostOffice.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -26,6 +26,7 @@
 import java.util.Set;
 
 import org.jboss.jms.server.destination.ManagedDestination;
+import org.jboss.messaging.core.impl.postoffice.RouteResult;
 import org.jboss.messaging.core.impl.tx.Transaction;
 
 /**
@@ -81,7 +82,7 @@
     *
     * @return true if reference was accepted by at least one queue.
     */
-   boolean route(MessageReference ref, Condition condition, Transaction tx) throws Exception; 
+   RouteResult route(MessageReference ref, Condition condition, Transaction tx) throws Exception; 
    
    /**
     * Get all queues that match the condition

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/MessagingPostOffice.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -565,7 +565,7 @@
    	return binding;
    }      
                  
-   public boolean route(MessageReference ref, Condition condition, Transaction tx) throws Exception
+   public RouteResult route(MessageReference ref, Condition condition, Transaction tx) throws Exception
    {
       if (ref == null)
       {
@@ -2353,13 +2353,13 @@
    	}
    }
    
-   private boolean routeInternal(MessageReference ref, Condition condition, Transaction tx, boolean fromCluster, Set names) throws Exception
+   private RouteResult routeInternal(MessageReference ref, Condition condition, Transaction tx, boolean fromCluster, Set names) throws Exception
    {
    	if (trace) { log.trace(this + " routing " + ref + " with condition '" +
    			                 condition + "'" + (tx == null ? "" : " transactionally in " + tx) + 
    			                 " from cluster " + fromCluster); }
    	
-      boolean routed = false;
+      RouteResult routed = new RouteResult(false);
 
       boolean intr = Thread.interrupted();
       for (;;)
@@ -2507,7 +2507,7 @@
 
                if (del != null && del.isSelectorAccepted())
                {
-                  routed = true;
+                  routed.setTrue();
                   
                   if (remoteSet != null)
                   {
@@ -2521,6 +2521,10 @@
                   	queueNames.add(queue.getName());
                   }
                }
+               else if (del == null)
+               {
+                  routed.setFailure();
+               }
          	}
          	            
             if (remoteSet != null)
@@ -2555,7 +2559,7 @@
          			callback.afterCommit(true);
          		}
          		
-         		routed = true;
+         		routed.setTrue();
          	}          
             
             if (startedTx)

Copied: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/RouteResult.java (from rev 8518, branches/Branch_1_4/src/main/org/jboss/messaging/core/impl/postoffice/RouteResult.java)
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/RouteResult.java	                        (rev 0)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/src/main/org/jboss/messaging/core/impl/postoffice/RouteResult.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005-2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+
+package org.jboss.messaging.core.impl.postoffice;
+
+/**
+ * A RouteResult
+ *
+ * @author <a href="mailto:hgao at redhat.com">Howard Gao</a>
+ * 
+ * Created Mar 27, 2012 2:34:51 PM
+ *
+ */
+public class RouteResult
+{
+   private boolean result = false;
+   private boolean failure = false;
+
+   public RouteResult(boolean b)
+   {
+      result = b;
+   }
+
+   public void setTrue()
+   {
+      result = true;
+   }
+   
+   public boolean getResult()
+   {
+      return result;
+   }
+
+   public void setFailure()
+   {
+      failure = true;
+   }
+   
+   public boolean isFailue()
+   {
+      return failure;
+   }
+
+}

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/PostOfficeTestBase.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -40,6 +40,7 @@
 import org.jboss.messaging.core.impl.JDBCPersistenceManager;
 import org.jboss.messaging.core.impl.message.SimpleMessageStore;
 import org.jboss.messaging.core.impl.postoffice.MessagingPostOffice;
+import org.jboss.messaging.core.impl.postoffice.RouteResult;
 import org.jboss.messaging.core.impl.tx.Transaction;
 import org.jboss.messaging.core.impl.tx.TransactionRepository;
 import org.jboss.test.messaging.MessagingTestCase;
@@ -176,9 +177,9 @@
 
          Condition condition = conditionFactory.createCondition(conditionText);
 
-         boolean routed = office.route(ref, condition, null);
+         RouteResult routed = office.route(ref, condition, null);
 
-         assertTrue(routed);
+         assertTrue(routed.getResult());
 
          list.add(msg);
       }

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/ClusteredPostOfficeTest.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -34,6 +34,7 @@
 import org.jboss.messaging.core.contract.PostOffice;
 import org.jboss.messaging.core.contract.Queue;
 import org.jboss.messaging.core.impl.MessagingQueue;
+import org.jboss.messaging.core.impl.postoffice.RouteResult;
 import org.jboss.messaging.core.impl.tx.Transaction;
 import org.jboss.test.messaging.core.PostOfficeTestBase;
 import org.jboss.test.messaging.core.SimpleCondition;
@@ -1427,18 +1428,18 @@
 
    		Message msg1 = CoreMessageFactory.createCoreMessage(1, true, null);      
    		MessageReference ref1 = ms.reference(msg1);  
-   		boolean routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
+   		assertTrue(routed.getResult());
 
    		Message msg2 = CoreMessageFactory.createCoreMessage(2, true, null);      
    		MessageReference ref2 = ms.reference(msg2);         
    		routed = office1.route(ref2, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Message msg3 = CoreMessageFactory.createCoreMessage(3, true, null);      
    		MessageReference ref3 = ms.reference(msg3);         
    		routed = office1.route(ref3, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Thread.sleep(3000);
    		
@@ -1718,10 +1719,10 @@
          
          Transaction tx = tr.createTransaction();
 
-         boolean routed = office1.route(ref1, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         RouteResult routed = office1.route(ref1, new SimpleCondition("condition1"), tx);         
+         assertTrue(routed.getResult());
          routed = office1.route(ref2, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          for (int i = 0; i < 16; i++)
          {
@@ -1783,9 +1784,9 @@
          tx = tr.createTransaction();
 
          routed = office1.route(ref1, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = office1.route(ref2, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          //Messages are sent asych so may take some finite time to arrive
          Thread.sleep(3000);         
@@ -1824,9 +1825,9 @@
          tx = tr.createTransaction();
 
          routed = office2.route(ref1, new SimpleCondition("condition2"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = office2.route(ref2, new SimpleCondition("condition2"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
                            
          for (int i = 0; i < 16; i++)
          {
@@ -1885,9 +1886,9 @@
          tx = tr.createTransaction();
 
          routed = office1.route(ref1, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = office1.route(ref2, new SimpleCondition("condition1"), tx);         
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          for (int i = 0; i < 16; i++)
          {
@@ -1987,19 +1988,19 @@
 
    		Message msg1 = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref1 = ms.reference(msg1);  
-   		boolean routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
+   		assertTrue(routed.getResult());
 
 
    		Message msg2 = CoreMessageFactory.createCoreMessage(2, persistentMessage, null);      
    		MessageReference ref2 = ms.reference(msg2);         
    		routed = office1.route(ref2, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Message msg3 = CoreMessageFactory.createCoreMessage(3, persistentMessage, null);      
    		MessageReference ref3 = ms.reference(msg3);         
    		routed = office1.route(ref3, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Thread.sleep(3000);
 
@@ -2106,18 +2107,18 @@
 
    		Message msg1 = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref1 = ms.reference(msg1);  
-   		boolean routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref1, new SimpleCondition("condition1"), null);   
+   		assertTrue(routed.getResult());
 
    		Message msg2 = CoreMessageFactory.createCoreMessage(2, persistentMessage, null);      
    		MessageReference ref2 = ms.reference(msg2);         
    		routed = office1.route(ref2, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Message msg3 = CoreMessageFactory.createCoreMessage(3, persistentMessage, null);      
    		MessageReference ref3 = ms.reference(msg3);         
    		routed = office1.route(ref3, new SimpleCondition("condition1"), null);      
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		Thread.sleep(3000);
    		
@@ -2337,8 +2338,8 @@
    		Message msg = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref = ms.reference(msg);         
 
-   		boolean routed = office1.route(ref, new SimpleCondition("condition1"), null);         
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref, new SimpleCondition("condition1"), null);         
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2365,7 +2366,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("condition2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 
@@ -2530,8 +2531,8 @@
    		Message msg = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref = ms.reference(msg);         
 
-   		boolean routed = office1.route(ref, new SimpleCondition("condition1"), null);         
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref, new SimpleCondition("condition1"), null);         
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2558,7 +2559,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("condition2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 
@@ -2675,8 +2676,8 @@
    		Message msg = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref = ms.reference(msg);         
 
-   		boolean routed = office1.route(ref, new SimpleCondition("myqueue1"), null);         
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref, new SimpleCondition("myqueue1"), null);         
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2696,7 +2697,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("myqueue1"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2717,7 +2718,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office1.route(ref, new SimpleCondition("myqueue2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 
@@ -2737,7 +2738,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("myqueue2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 
@@ -2818,8 +2819,8 @@
    		Message msg = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
    		MessageReference ref = ms.reference(msg);         
 
-   		boolean routed = office1.route(ref, new SimpleCondition("myqueue1"), null);         
-   		assertTrue(routed);
+   		RouteResult routed = office1.route(ref, new SimpleCondition("myqueue1"), null);         
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2839,7 +2840,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("myqueue1"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
 
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
@@ -2860,7 +2861,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office1.route(ref, new SimpleCondition("myqueue2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 
@@ -2880,7 +2881,7 @@
    		ref = ms.reference(msg);         
 
    		routed = office2.route(ref, new SimpleCondition("myqueue2"), null);         
-   		assertTrue(routed);
+   		assertTrue(routed.getResult());
    		//Messages are sent asych so may take some finite time to arrive
    		Thread.sleep(3000);
 

Modified: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java
===================================================================
--- branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java	2012-07-20 14:09:43 UTC (rev 8552)
+++ branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/core/postoffice/PostOfficeTest.java	2012-07-20 14:37:29 UTC (rev 8553)
@@ -23,14 +23,24 @@
 
 import java.util.Collection;
 import java.util.List;
+import java.util.Map;
 
+import javax.jms.JMSException;
+
 import org.jboss.messaging.core.contract.Binding;
 import org.jboss.messaging.core.contract.Condition;
+import org.jboss.messaging.core.contract.Delivery;
+import org.jboss.messaging.core.contract.DeliveryObserver;
+import org.jboss.messaging.core.contract.Distributor;
+import org.jboss.messaging.core.contract.Filter;
 import org.jboss.messaging.core.contract.Message;
 import org.jboss.messaging.core.contract.MessageReference;
 import org.jboss.messaging.core.contract.PostOffice;
 import org.jboss.messaging.core.contract.Queue;
 import org.jboss.messaging.core.impl.MessagingQueue;
+import org.jboss.messaging.core.impl.SimpleDelivery;
+import org.jboss.messaging.core.impl.clusterconnection.MessageSucker;
+import org.jboss.messaging.core.impl.postoffice.RouteResult;
 import org.jboss.messaging.core.impl.tx.Transaction;
 import org.jboss.test.messaging.core.PostOfficeTestBase;
 import org.jboss.test.messaging.core.SimpleCondition;
@@ -563,8 +573,8 @@
          Message msg1 = CoreMessageFactory.createCoreMessage(1);      
          MessageReference ref1 = ms.reference(msg1);
          
-         boolean routed = postOffice.route(ref1, condition1, null);      
-         assertTrue(routed);
+         RouteResult routed = postOffice.route(ref1, condition1, null);      
+         assertTrue(routed.getResult());
          
          List msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -602,7 +612,7 @@
          MessageReference ref2 = ms.reference(msg2);
          
          routed = postOffice.route(ref2, condition2, null);      
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -668,9 +678,9 @@
          
          MessageReference ref1 = ms.reference(msg1);
          
-         boolean routed = postOffice.route(ref1, new SimpleCondition("this won't match anything"), null);
+         RouteResult routed = postOffice.route(ref1, new SimpleCondition("this won't match anything"), null);
          
-         assertFalse(routed);
+         assertFalse(routed.getResult());
                
          List msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -687,7 +697,51 @@
    }
    
    
+
+   public final void testRouteTopicPersistenceFailure() throws Throwable
+   {
+      PostOffice postOffice = null;
+      
+      try
+      {      
+         postOffice = createNonClusteredPostOffice();
+         
+         Condition condition1 = new SimpleCondition("topic1");
+         
+         FakeCoreQueue queue1 =  new FakeCoreQueue("queue1", 1);
+         queue1.activate();
+
+         postOffice.addBinding(new Binding(condition1, queue1, false), false);
+         
+         FakeCoreQueue queue2 =  new FakeCoreQueue("queue2", 2);
+         queue2.activate();
+         
+         postOffice.addBinding(new Binding(condition1, queue2, false), false);
+         
+         FakeCoreQueue queue3 = new FakeCoreQueue("queue3", 3);
+         queue3.activate();
+         
+         postOffice.addBinding(new Binding(condition1, queue3, false), false);
+         
+         queue2.setFailure(true);
+         
+         Message msg1 = CoreMessageFactory.createCoreMessage(1);
+         MessageReference ref1 = ms.reference(msg1);
+         
+         RouteResult routed = postOffice.route(ref1, condition1, null);      
+         assertTrue(routed.isFailue());
+      }
+      finally
+      {
+         if (postOffice != null)
+         {
+            postOffice.stop();
+         }
+         
+      }
    
+   }   
+   
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------
@@ -771,8 +825,8 @@
          Message msg1 = CoreMessageFactory.createCoreMessage(1, persistentMessage, null);      
          MessageReference ref1 = ms.reference(msg1);
          
-         boolean routed = postOffice.route(ref1, condition1, null);      
-         assertTrue(routed);
+         RouteResult routed = postOffice.route(ref1, condition1, null);      
+         assertTrue(routed.getResult());
          
          List msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -825,7 +879,7 @@
          MessageReference ref2 = ms.reference(msg2);
          
          routed = postOffice.route(ref2, condition2, null);      
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          msgs = receiver4.getMessages();
          assertNotNull(msgs);
@@ -923,10 +977,10 @@
          
          Transaction tx = tr.createTransaction();
          
-         boolean routed = postOffice.route(ref1, condition1, tx);            
-         assertTrue(routed);
+         RouteResult routed = postOffice.route(ref1, condition1, tx);            
+         assertTrue(routed.getResult());
          routed = postOffice.route(ref2, condition1, tx);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
                
          List msgs = queue1.browse(null);
          assertNotNull(msgs);
@@ -982,9 +1036,9 @@
          tx = tr.createTransaction();
          
          routed = postOffice.route(ref3, condition1, tx);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = postOffice.route(ref4, condition1, tx);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
                
          msgs = queue1.browse(null);
          assertNotNull(msgs);
@@ -1016,9 +1070,9 @@
          MessageReference ref6 = ms.reference(msg6);
                
          routed = postOffice.route(ref5, new SimpleCondition("topic1"), null);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = postOffice.route(ref6, new SimpleCondition("topic1"), null);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -1073,9 +1127,9 @@
          MessageReference ref8 = ms.reference(msg8);
                
          routed = postOffice.route(ref7, new SimpleCondition("topic1"), null);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          routed = postOffice.route(ref8, new SimpleCondition("topic1"), null);            
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          msgs = receiver1.getMessages();
          assertNotNull(msgs);
@@ -1172,16 +1226,16 @@
          
          Message msg1 = CoreMessageFactory.createCoreMessage(1);      
          MessageReference ref1 = ms.reference(msg1);         
-         boolean routed = postOffice.route(ref1, condition1, null);      
-         assertTrue(routed);
+         RouteResult routed = postOffice.route(ref1, condition1, null);      
+         assertTrue(routed.getResult());
          Message msg2 = CoreMessageFactory.createCoreMessage(2);      
          MessageReference ref2 = ms.reference(msg2);         
          routed = postOffice.route(ref2, condition1, null);      
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          Message msg3 = CoreMessageFactory.createCoreMessage(3);      
          MessageReference ref3 = ms.reference(msg3);         
          routed = postOffice.route(ref3, condition1, null);      
-         assertTrue(routed);
+         assertTrue(routed.getResult());
          
          List msgs = receiver1.getMessages();
          assertNotNull(msgs);           
@@ -1238,6 +1292,250 @@
    }
 
    // Inner classes -------------------------------------------------
+   class FakeCoreQueue implements org.jboss.messaging.core.contract.Queue
+   {
+      private String queueName;
+      
+      private boolean failure = false;
+      
+      private long chid;
 
+      public FakeCoreQueue(String name, long chid) throws JMSException
+      {
+         queueName = name;
+         this.chid = chid;
+      }
+
+      /**
+       * @param b
+       */
+      public void setFailure(boolean b)
+      {
+         failure = b;
+      }
+
+      public String getName()
+      {
+         return queueName;
+      }
+
+      public void addAllToRecoveryArea(int nodeID, Map ids)
+      {
+      }
+
+      public void addToRecoveryArea(int nodeID, long messageID, String sessionID)
+      {
+      }
+
+      public int getDownCacheSize()
+      {
+         return 0;
+      }
+
+      public Filter getFilter()
+      {
+         return null;
+      }
+
+      public int getFullSize()
+      {
+         return 0;
+      }
+
+      public Distributor getLocalDistributor()
+      {
+         return null;
+      }
+
+      public int getNodeID()
+      {
+         return 1;
+      }
+
+      public int getPageSize()
+      {
+         return 0;
+      }
+
+      public long getRecoverDeliveriesTimeout()
+      {
+         return 0;
+      }
+
+      public Map getRecoveryArea()
+      {
+         return null;
+      }
+
+      public int getRecoveryMapSize()
+      {
+         return 0;
+      }
+
+      public Distributor getRemoteDistributor()
+      {
+         return null;
+      }
+
+      public Delivery handleMove(MessageReference ref, long sourceChannelID)
+      {
+         return null;
+      }
+
+      public boolean isClustered()
+      {
+         return false;
+      }
+
+      public void mergeIn(long channelID, int nodeID) throws Exception
+      {
+      }
+
+      public List recoverDeliveries(List messageIds)
+      {
+         return null;
+      }
+
+      public void registerSucker(MessageSucker sucker)
+      {
+      }
+
+      public void removeAllFromRecoveryArea(int nodeID)
+      {
+      }
+
+      public void removeFromRecoveryArea(int nodeID, long messageID)
+      {
+      }
+
+      public void removeStrandedReferences(String sessionID)
+      {
+      }
+
+      public void setPagingParams(int fullSize, int pageSize, int downCacheSize)
+      {
+      }
+
+      public boolean unregisterSucker(MessageSucker sucker)
+      {
+         return false;
+      }
+
+      public void activate()
+      {
+      }
+
+      public List browse(Filter filter)
+      {
+         return null;
+      }
+
+      public void close()
+      {
+      }
+
+      public void deactivate()
+      {
+      }
+
+      public void deliver()
+      {
+      }
+
+      public long getChannelID()
+      {
+         return chid;
+      }
+
+      public int getDeliveringCount()
+      {
+         return 0;
+      }
+
+      public int getMaxSize()
+      {
+         return 0;
+      }
+
+      public int getMessageCount()
+      {
+         return 0;
+      }
+
+      public int getMessagesAdded()
+      {
+         return 0;
+      }
+
+      public int getScheduledCount()
+      {
+         return 0;
+      }
+
+      public boolean isActive()
+      {
+         return false;
+      }
+
+      public boolean isRecoverable()
+      {
+         return false;
+      }
+
+      public void load() throws Exception
+      {
+      }
+
+      public void removeAllReferences() throws Throwable
+      {
+      }
+
+      public void setMaxSize(int newSize)
+      {
+      }
+
+      public void unload() throws Exception
+      {
+      }
+
+      public void acknowledge(Delivery d, Transaction tx) throws Throwable
+      {
+      }
+
+      public void acknowledgeNoPersist(Delivery d) throws Throwable
+      {
+      }
+
+      public void cancel(Delivery d) throws Throwable
+      {
+      }
+
+      public Delivery handle(DeliveryObserver observer, MessageReference reference, Transaction tx)
+      {
+         if (failure)
+         {
+            return null;
+         }
+         return new SimpleDelivery();
+      }
+
+      public void setClustered(boolean isClustered)
+      {
+      }
+
+      public void staticMerge(org.jboss.messaging.core.contract.Queue queue) throws Exception
+      {
+      }
+
+      public List listInProcessMessages()
+      {
+         return null;
+      }
+
+      public void setDeliveringCounterLevel(int delCounterLevel)
+      {
+      }
+   }
+
 }
 


Property changes on: branches/Branch_JBossMessaging_1_4_7_GA_JBMESSAGING-1919/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanExtraTest.java
___________________________________________________________________
Deleted: svn:mergeinfo
   - 



More information about the jboss-cvs-commits mailing list