You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/05/20 10:37:34 UTC

svn commit: r658166 - in /incubator/qpid/branches/M2.x: ./ java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java

Author: ritchiem
Date: Tue May 20 01:37:33 2008
New Revision: 658166

URL: http://svn.apache.org/viewvc?rev=658166&view=rev
Log:
Merged revisions 657859 via svnmerge from 
https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid

........
  r657859 | ritchiem | 2008-05-19 17:54:06 +0100 (Mon, 19 May 2008) | 1 line
  
  QPID-1066 : Removed isInfo wrapping. Added test that is missing from trunk from M2.x QueueDepthSelectorTest. 
........

Modified:
    incubator/qpid/branches/M2.x/   (props changed)
    incubator/qpid/branches/M2.x/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java
    incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java

Propchange: incubator/qpid/branches/M2.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: incubator/qpid/branches/M2.x/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.x/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java?rev=658166&r1=658165&r2=658166&view=diff
==============================================================================
--- incubator/qpid/branches/M2.x/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java (original)
+++ incubator/qpid/branches/M2.x/java/broker/src/main/java/org/apache/qpid/server/queue/ConcurrentSelectorDeliveryManager.java Tue May 20 01:37:33 2008
@@ -751,13 +751,7 @@
             }
             else if (messageQueue == sub.getPreDeliveryQueue() && !sub.isBrowser())
             {
-                if (_log.isInfoEnabled())
-                {
-                    //fixme - we should do the clean up as the message remains on the _message queue
-                    // this is resulting in the next consumer receiving the message and then attempting to purge it
-                    //
-                    cleanMainQueue(sub);
-                }
+                cleanMainQueue(sub);
             }
 
         }

Modified: incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java?rev=658166&r1=658165&r2=658166&view=diff
==============================================================================
--- incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java (original)
+++ incubator/qpid/branches/M2.x/java/systests/src/main/java/org/apache/qpid/server/queue/QueueDepthWithSelectorTest.java Tue May 20 01:37:33 2008
@@ -22,6 +22,9 @@
 package org.apache.qpid.server.queue;
 
 import java.util.Hashtable;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQDestination;
+import org.apache.qpid.client.AMQSession;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -34,18 +37,13 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.spi.InitialContextFactory;
+import java.util.Hashtable;
 
 import junit.framework.TestCase;
 
 import org.apache.log4j.Logger;
 import org.apache.qpid.client.transport.TransportConnection;
-import org.apache.qpid.framing.AMQShortString;
 import org.apache.qpid.jndi.PropertiesFileInitialContextFactory;
-import org.apache.qpid.server.registry.ApplicationRegistry;
-import org.apache.qpid.server.registry.IApplicationRegistry;
-import org.apache.qpid.server.virtualhost.VirtualHost;
-
-
 /**
  * Test Case to ensure that messages are correctly returned.
  * This includes checking:
@@ -107,7 +105,7 @@
         {
             TransportConnection.killAllVMBrokers();
         }
-    } 
+    }
 
     public void test() throws Exception
     {
@@ -153,14 +151,42 @@
 
     private void verifyBrokerState()
     {
-        IApplicationRegistry registry = ApplicationRegistry.getInstance();
+        try
+        {
+            _clientConnection = ((ConnectionFactory) _context.lookup("connection")).createConnection();
+
+            _clientSession = _clientConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        }
+        catch (Exception e)
+        {
+            fail(e.getMessage());
+        }
+
+        try
+        {
+            long queueDepth = ((AMQSession) _clientSession).getQueueDepth((AMQDestination) _context.lookup("queue"));
+            assertEquals("Session reports Queue depth not as expected", 0, queueDepth);
+        }
+        catch (NamingException e)
+        {
+            fail(e.getMessage());
+        }
+        catch (AMQException e)
+        {
+            fail(e.getMessage());
+        }
+        finally
+        {
+            try
+            {
+                _clientConnection.close();
+            }
+            catch (JMSException e)
+            {
+                fail(e.getMessage());
+            }
+        }
 
-        VirtualHost testVhost = registry.getVirtualHostRegistry().getVirtualHost(VHOST);
-        assertNotNull("Unable to get test Vhost", testVhost);
-        assertNotNull("Unable to get test queue registry", testVhost.getQueueRegistry());
-        AMQQueue q = testVhost.getQueueRegistry().getQueue(new AMQShortString(QUEUE));
-        assertNotNull("Unable to get test queue", q);
-        assertEquals("Queue count too big", 0, q.getMessageCount());
     }
 
     private void verifyAllMessagesRecevied() throws JMSException