diff options
author | Robert Gemmell <robbie@apache.org> | 2009-12-08 11:43:53 +0000 |
---|---|---|
committer | Robert Gemmell <robbie@apache.org> | 2009-12-08 11:43:53 +0000 |
commit | 8963b645781e4d822e0fe93c59edf3e4d01b2a98 (patch) | |
tree | 63e25a40dd5252e72faa1a9db33bfe71ab0aebe9 | |
parent | a65b4b105a295807e8490a817557f1ecee10e691 (diff) | |
download | qpid-python-8963b645781e4d822e0fe93c59edf3e4d01b2a98.tar.gz |
QPID-2177: rework noddy unit test
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@888348 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java b/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java index d6bdacee86..4e5ba0213a 100644 --- a/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java +++ b/java/broker/src/test/java/org/apache/qpid/server/queue/AMQQueueMBeanTest.java @@ -337,12 +337,16 @@ public class AMQQueueMBeanTest extends TestCase assertTrue(_queueMBean.getFlowResumeCapacity() == 0); } - //(FlowResume)Capacity currently 0, set both to 2 then try setting Capacity below this + //add a message to the queue + sendMessages(1, true); + + //(FlowResume)Capacity currently 0, set both to 2 _queueMBean.setCapacity(2L); assertTrue(_queueMBean.getCapacity() == 2L); _queueMBean.setFlowResumeCapacity(2L); assertTrue(_queueMBean.getFlowResumeCapacity() == 2L); + //Try setting Capacity below FlowResumeCapacity try { _queueMBean.setCapacity(1L); @@ -354,27 +358,16 @@ public class AMQQueueMBeanTest extends TestCase assertTrue(_queueMBean.getCapacity() == 2); } - //set (FlowResume)Capacity to MESSAGE_SIZE +1 then add a message to the queue - _queueMBean.setCapacity(MESSAGE_SIZE + 1); - _queueMBean.setFlowResumeCapacity(MESSAGE_SIZE + 1); - + //create a channel and use it to exercise the capacity check mechanism AMQChannel channel = new AMQChannel(_protocolSession, 1, _messageStore); - sendMessages(1, true); - _queue.checkCapacity(channel); - - assertFalse(_queueMBean.isFlowOverfull()); - assertFalse(channel.getBlocking()); - - //add another message then check queue is now overfull and channel blocked - sendMessages(1, true); _queue.checkCapacity(channel); assertTrue(_queueMBean.isFlowOverfull()); assertTrue(channel.getBlocking()); - //set FlowResumeCapacity to 2x MESSAGE_SIZE and check queue is now underfull and channel unblocked - _queueMBean.setCapacity(2 * MESSAGE_SIZE);//must increase capacity too - _queueMBean.setFlowResumeCapacity(2 * MESSAGE_SIZE); + //set FlowResumeCapacity to MESSAGE_SIZE and check queue is now underfull and channel unblocked + _queueMBean.setCapacity(MESSAGE_SIZE);//must increase capacity too + _queueMBean.setFlowResumeCapacity(MESSAGE_SIZE); assertFalse(_queueMBean.isFlowOverfull()); assertFalse(channel.getBlocking()); |