Skip to content

Commit 69867d6

Browse files
committed
refactor and fix the test - now it *really* does what it says
1 parent de845ef commit 69867d6

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

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

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -192,42 +192,40 @@ public void testExchangeRoutingLoop() throws IOException,
192192
*/
193193
public void testTopicExchange() throws IOException, ShutdownSignalException,
194194
InterruptedException {
195+
195196
channel.exchangeDeclare("e", "topic");
197+
196198
for (String e : exchanges) {
197199
channel.exchangeBind(e, "e", e);
198200
}
199-
for (String e : exchanges) {
200-
publishWithMarker("e", e);
201-
}
202-
for (QueueingConsumer c : consumers) {
203-
consumeNoDuplicates(c);
204-
}
201+
publishAndConsumeAll("e");
205202

206203
channel.exchangeDeclare("ef", "direct");
207204
channel.exchangeBind("ef", "e", "#");
208205

209206
for (String e : exchanges) {
210207
channel.exchangeBind(e, "ef", e);
211208
}
209+
publishAndConsumeAll("e");
210+
212211
for (String e : exchanges) {
213-
publishWithMarker("e", e);
214-
}
215-
for (QueueingConsumer c : consumers) {
216-
consumeNoDuplicates(c);
212+
channel.exchangeUnbind(e, "e", e);
217213
}
214+
publishAndConsumeAll("e");
218215

219216
channel.exchangeDelete("ef");
217+
channel.exchangeDelete("e");
218+
}
219+
220+
private void publishAndConsumeAll(String exchange)
221+
throws IOException, ShutdownSignalException, InterruptedException {
220222

221223
for (String e : exchanges) {
222-
channel.exchangeUnbind(e, "e", e);
223-
}
224-
for (String e : exchanges) {
225-
publishWithMarker("e", e);
224+
publishWithMarker(exchange, e);
226225
}
227226
for (QueueingConsumer c : consumers) {
228227
consumeNoDuplicates(c);
229228
}
230-
231-
channel.exchangeDelete("e");
232229
}
230+
233231
}

0 commit comments

Comments
 (0)