diff options
| author | Robert Gemmell <robbie@apache.org> | 2009-11-06 15:56:28 +0000 |
|---|---|---|
| committer | Robert Gemmell <robbie@apache.org> | 2009-11-06 15:56:28 +0000 |
| commit | 66ce9a9afaa34ba3ecfc58b4a6ed13a9c017e266 (patch) | |
| tree | f025ee2374310af65dfa3db8e48760951cb64ca8 /qpid/java | |
| parent | c1b0efc381581a58b69d4e098224e5f8d1fdf0ec (diff) | |
| download | qpid-python-66ce9a9afaa34ba3ecfc58b4a6ed13a9c017e266.tar.gz | |
QPID-2178: test expanded channels() output correctly returns current channel blocking status
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@833447 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java index e6561a06b9..9152e68ee0 100644 --- a/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java +++ b/qpid/java/broker/src/test/java/org/apache/qpid/server/protocol/AMQProtocolSessionMBeanTest.java @@ -24,6 +24,7 @@ import junit.framework.TestCase; 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.MessageStore; 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 @@ public class AMQProtocolSessionMBeanTest extends TestCase 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(); |
