Skip to content

Commit 2dd773e

Browse files
author
Matthew Sackman
committed
Modified QoS tests to demonstrate that autoack obeys qos limits
1 parent cbbb571 commit 2dd773e

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

test/src/com/rabbitmq/client/test/functional/QosTests.java

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,17 @@
3232
package com.rabbitmq.client.test.functional;
3333

3434
import java.io.IOException;
35-
import java.util.Arrays;
3635
import java.util.ArrayList;
36+
import java.util.Arrays;
3737
import java.util.LinkedList;
3838
import java.util.List;
3939
import java.util.Queue;
4040

41+
import com.rabbitmq.client.AMQP;
4142
import com.rabbitmq.client.Channel;
4243
import com.rabbitmq.client.GetResponse;
4344
import com.rabbitmq.client.QueueingConsumer;
4445
import com.rabbitmq.client.QueueingConsumer.Delivery;
45-
import com.rabbitmq.client.ShutdownSignalException;
46-
47-
import com.rabbitmq.client.AMQP;
4846

4947
public class QosTests extends BrokerTestCase
5048
{
@@ -124,7 +122,7 @@ public void testMessageLimitUnlimited()
124122
drain(c, 2);
125123
}
126124

127-
public void testNoAckUnlimited()
125+
public void testNoAckNoAlterLimit()
128126
throws IOException
129127
{
130128
QueueingConsumer c = new QueueingConsumer(channel);
@@ -134,6 +132,26 @@ public void testNoAckUnlimited()
134132
drain(c, 2);
135133
}
136134

135+
public void testNoAckObeysLimit()
136+
throws IOException
137+
{
138+
channel.basicQos(1);
139+
QueueingConsumer c1 = new QueueingConsumer(channel);
140+
declareBindConsume(channel, c1, false);
141+
fill(2);
142+
QueueingConsumer c2 = new QueueingConsumer(channel);
143+
declareBindConsume(channel, c2, true);
144+
try {
145+
Delivery d = c2.nextDelivery(1000);
146+
assertNull(d);
147+
} catch (InterruptedException ie) {
148+
fail("interrupted");
149+
}
150+
Queue<Delivery> d = drain(c1, 1);
151+
ack(d, false);
152+
// we have no guarantees about where the other message has gone
153+
}
154+
137155
public void testPermutations()
138156
throws IOException
139157
{

0 commit comments

Comments
 (0)