Skip to content

Commit e9dd0ba

Browse files
author
Alexandru Scvortov
committed
expand deleted dlx test
1 parent 13e5e75 commit e9dd0ba

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,24 @@ public void run() {
109109
}, args, "expired");
110110
}
111111

112-
public void testDeadLetterNonExistingDLX() throws Exception {
112+
public void testDeadLetterDeletedDLX() throws Exception {
113113
declareQueue(TEST_QUEUE_NAME, DLX, null, null, 1);
114114
channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test");
115+
channel.queueBind(DLQ, DLX, "test");
115116

116117
channel.exchangeDelete(DLX);
117-
118118
publishN(MSG_COUNT);
119119
sleep(100);
120120

121-
// Nothing was dead-lettered.
122121
consumeN(DLQ, 0, WithResponse.NULL);
122+
123+
channel.exchangeDeclare(DLX, "direct");
124+
channel.queueBind(DLQ, DLX, "test");
125+
126+
publishN(MSG_COUNT);
127+
sleep(100);
128+
129+
consumeN(DLQ, MSG_COUNT, WithResponse.NULL);
123130
}
124131

125132
public void testDeadLetterExchangeDeleteTwice()
@@ -374,7 +381,8 @@ private void consumeN(String queue, int n, WithResponse withResponse)
374381
for(int x = 0; x < n; x++) {
375382
GetResponse getResponse =
376383
channel.basicGet(queue, true);
377-
assertNotNull("Message not dead-lettered", getResponse);
384+
assertNotNull("Messages not dead-lettered (" + (n-x) + " left)",
385+
getResponse);
378386
assertEquals("test message", new String(getResponse.getBody()));
379387
withResponse.process(getResponse);
380388
}

0 commit comments

Comments
 (0)