From 6a382bbcd88cd49fb1437b756a2816212ddebefe Mon Sep 17 00:00:00 2001 From: Martin Ritchie Date: Tue, 12 Aug 2008 09:36:08 +0000 Subject: QPID-1136 : Fixed Flow Control problem due to this change and added test to validate that Flow Control is operating correctly git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@685104 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/qpid/server/queue/AckTest.java | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'java/systests/src') diff --git a/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java b/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java index 09d83bde0c..9c2932c5e2 100644 --- a/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java +++ b/java/systests/src/main/java/org/apache/qpid/server/queue/AckTest.java @@ -32,6 +32,7 @@ import org.apache.qpid.server.RequiredDeliveryException; import org.apache.qpid.server.subscription.Subscription; import org.apache.qpid.server.subscription.SubscriptionFactoryImpl; import org.apache.qpid.server.flow.LimitlessCreditManager; +import org.apache.qpid.server.flow.Pre0_10CreditManager; import org.apache.qpid.server.ack.UnacknowledgedMessageMap; import org.apache.qpid.server.registry.ApplicationRegistry; import org.apache.qpid.server.store.TestMemoryMessageStore; @@ -301,6 +302,31 @@ public class AckTest extends TestCase } } + /** + * A regression fixing QPID-1136 showed this up + * + * @throws Exception + */ + public void testMessageDequeueRestoresCreditTest() throws Exception + { + // Send 10 messages + Pre0_10CreditManager creditManager = new Pre0_10CreditManager(0l, 1); + + _subscription = SubscriptionFactoryImpl.INSTANCE.createSubscription(5, _protocolSession, + DEFAULT_CONSUMER_TAG, true, null, false, creditManager); + final int msgCount = 1; + publishMessages(msgCount); + + _queue.deliverAsync(_subscription); + + _channel.acknowledgeMessage(1, false); + + // Check credit available + assertTrue("No credit available", creditManager.hasCredit()); + + } + + /* public void testPrefetchHighLow() throws AMQException { -- cgit v1.2.1