You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ro...@apache.org on 2009/11/06 16:56:29 UTC

svn commit: r833447 - /qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java

Author: robbie
Date: Fri Nov  6 15:56:28 2009
New Revision: 833447

URL: http://svn.apache.org/viewvc?rev=833447&view=rev
Log:
QPID-2178: test expanded channels() output correctly returns current channel blocking status

Modified:
    qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java

Modified: qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java?rev=833447&r1=833446&r2=833447&view=diff
==============================================================================
--- qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java (original)
+++ qpid/trunk/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java Fri Nov  6 15:56:28 2009
@@ -24,6 +24,7 @@
 import org.apache.log4j.Logger;
 import org.apache.qpid.AMQException;
 import org.apache.qpid.framing.AMQShortString;
+import org.apache.qpid.management.common.mbeans.ManagedConnection;
 import org.apache.qpid.server.AMQChannel;
 import org.apache.qpid.server.virtualhost.VirtualHost;
 import org.apache.qpid.server.queue.AMQQueue;
@@ -33,6 +34,9 @@
 import org.apache.qpid.server.store.SkeletonMessageStore;
 
 import javax.management.JMException;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
 
 /** Test class to test MBean operations for AMQMinaProtocolSession. */
 public class AMQProtocolSessionMBeanTest extends TestCase
@@ -85,6 +89,29 @@
             log.debug("expected exception is thrown :" + ex.getMessage());
         }
 
+        // check channels() return type conveys flow control blocking status correctly
+        AMQChannel channel4 = new AMQChannel(_protocolSession, 4, _messageStore);
+        _protocolSession.addChannel(channel4);
+        channel4.setDefaultQueue(queue);
+        
+        final String blocking = ManagedConnection.COMPOSITE_ITEM_NAMES[4];
+        TabularData channels = _mbean.channels();
+        CompositeData chan4result = channels.get(new Integer[]{4});
+        assertNotNull(chan4result);
+        assertEquals("Flow should not have been blocked", false, chan4result.get(blocking));
+        
+        channel4.block(queue);
+        channels = _mbean.channels();
+        chan4result = channels.get(new Integer[]{4});
+        assertNotNull(chan4result);
+        assertEquals("Flow should have been blocked", true, chan4result.get(blocking));    
+        
+        channel4.unblock(queue);
+        channels = _mbean.channels();
+        chan4result = channels.get(new Integer[]{4});
+        assertNotNull(chan4result);
+        assertEquals("Flow should have been unblocked", false, chan4result.get(blocking));  
+        
         // check if closing of session works
         _protocolSession.addChannel(new AMQChannel(_protocolSession, 5, _messageStore));
         _mbean.closeConnection();



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org