Skip to content

Commit fc74fb0

Browse files
author
Simon MacMullen
committed
Adjust various tests to account for the fact that delete and unbind are now idempotent. And remove testDeadLetterExchangeDeleteTwice altogether as it's no longer at all interesting.
1 parent aac886c commit fc74fb0

File tree

4 files changed

+11
-48
lines changed

4 files changed

+11
-48
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,9 @@ public void testUnbind() throws Exception {
201201
};
202202

203203
for (int i = 0; i < tests.length; i++) {
204-
205204
Binding test = tests[i];
206-
try {
207-
channel.queueUnbind(test.q, test.x, test.k);
208-
fail("expected not_found in test " + i);
209-
} catch (IOException ee) {
210-
checkShutdownSignal(AMQP.NOT_FOUND, ee);
211-
openChannel();
212-
}
205+
// check we can unbind all sorts of things that don't exist
206+
channel.queueUnbind(test.q, test.x, test.k);
213207
}
214208

215209
// success case

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -203,22 +203,6 @@ public void process(GetResponse getResponse) {
203203
});
204204
}
205205

206-
public void testDeadLetterExchangeDeleteTwice()
207-
throws IOException
208-
{
209-
declareQueue(TEST_QUEUE_NAME, DLX, null, null, 1);
210-
channel.queueBind(TEST_QUEUE_NAME, "amq.direct", "test");
211-
212-
publishN(MSG_COUNT_MANY);
213-
channel.queueDelete(TEST_QUEUE_NAME);
214-
try {
215-
channel.queueDelete(TEST_QUEUE_NAME);
216-
fail();
217-
} catch (IOException ex) {
218-
checkShutdownSignal(AMQP.NOT_FOUND, ex);
219-
}
220-
}
221-
222206
public void testDeadLetterOnReject() throws Exception {
223207
rejectionTest(false);
224208
}

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

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.io.IOException;
2121

22-
import com.rabbitmq.client.AMQP;
2322
import com.rabbitmq.client.test.BrokerTestCase;
2423

2524
public class DoubleDeletion extends BrokerTestCase
@@ -30,28 +29,18 @@ public class DoubleDeletion extends BrokerTestCase
3029
public void testDoubleDeletionQueue()
3130
throws IOException
3231
{
33-
channel.queueDeclare(Q, false, false, false, null);
34-
channel.queueDelete(Q);
35-
try {
36-
channel.queueDelete(Q);
37-
fail("Expected exception from double deletion of queue");
38-
} catch (IOException ee) {
39-
checkShutdownSignal(AMQP.NOT_FOUND, ee);
40-
// Pass!
41-
}
32+
channel.queueDelete(Q);
33+
channel.queueDeclare(Q, false, false, false, null);
34+
channel.queueDelete(Q);
35+
channel.queueDelete(Q);
4236
}
4337

4438
public void testDoubleDeletionExchange()
4539
throws IOException
4640
{
41+
channel.exchangeDelete(X);
4742
channel.exchangeDeclare(X, "direct");
48-
channel.exchangeDelete(X);
49-
try {
50-
channel.exchangeDelete(X);
51-
fail("Expected exception from double deletion of exchange");
52-
} catch (IOException ee) {
53-
checkShutdownSignal(AMQP.NOT_FOUND, ee);
54-
// Pass!
55-
}
43+
channel.exchangeDelete(X);
44+
channel.exchangeDelete(X);
5645
}
5746
}

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,11 @@ protected void consumeNoDuplicates(QueueingConsumer consumer)
8080
}
8181

8282
public void testBindingCreationDeletion() throws IOException {
83+
channel.exchangeUnbind("e2", "e1", "");
8384
channel.exchangeBind("e2", "e1", "");
8485
channel.exchangeBind("e2", "e1", "");
8586
channel.exchangeUnbind("e2", "e1", "");
86-
try {
87-
channel.exchangeUnbind("e2", "e1", "");
88-
fail("expected not_found in testBindingCreationDeletion");
89-
} catch (IOException e) {
90-
checkShutdownSignal(AMQP.NOT_FOUND, e);
91-
}
87+
channel.exchangeUnbind("e2", "e1", "");
9288
}
9389

9490
/* pre (eN --> qN) for N in [0..2]

0 commit comments

Comments
 (0)