Skip to content

Commit c16ba06

Browse files
author
Matthew Sackman
committed
The RoundRobin test as it stood only checked that an equal number of messages were sent to each consumer, not that the consumers were roundrobined.
1 parent f864a1e commit c16ba06

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,18 @@ public void testRoundRobin()
221221

222222
final Map<String, Integer> counts =
223223
Collections.synchronizedMap(new HashMap<String, Integer>());
224+
final String [] nextTag = new String[] { null };
224225

225226
QueueingConsumer c = new QueueingConsumer(channel) {
226227
@Override public void handleDelivery(String consumerTag,
227228
Envelope envelope,
228229
AMQP.BasicProperties properties,
229230
byte[] body)
230231
throws IOException {
232+
String otherConsumerTag = "c1".equals(consumerTag) ? "c2" : "c1";
233+
if (null != nextTag[0])
234+
assertEquals(consumerTag, nextTag[0]);
235+
nextTag[0] = otherConsumerTag;
231236
counts.put(consumerTag, counts.get(consumerTag) + 1);
232237
super.handleDelivery(consumerTag, envelope,
233238
properties, body);

0 commit comments

Comments
 (0)