Skip to content

Commit 21a86da

Browse files
committed
merge v1_5 into default
2 parents 5804d62 + 9dd1d05 commit 21a86da

File tree

3 files changed

+100
-8
lines changed

3 files changed

+100
-8
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// The contents of this file are subject to the Mozilla Public License
2+
// Version 1.1 (the "License"); you may not use this file except in
3+
// compliance with the License. You may obtain a copy of the License at
4+
// http://www.mozilla.org/MPL/
5+
//
6+
// Software distributed under the License is distributed on an "AS IS"
7+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
8+
// License for the specific language governing rights and limitations
9+
// under the License.
10+
//
11+
// The Original Code is RabbitMQ.
12+
//
13+
// The Initial Developers of the Original Code are LShift Ltd,
14+
// Cohesive Financial Technologies LLC, and Rabbit Technologies Ltd.
15+
//
16+
// Portions created before 22-Nov-2008 00:00:00 GMT by LShift Ltd,
17+
// Cohesive Financial Technologies LLC, or Rabbit Technologies Ltd
18+
// are Copyright (C) 2007-2008 LShift Ltd, Cohesive Financial
19+
// Technologies LLC, and Rabbit Technologies Ltd.
20+
//
21+
// Portions created by LShift Ltd are Copyright (C) 2007-2009 LShift
22+
// Ltd. Portions created by Cohesive Financial Technologies LLC are
23+
// Copyright (C) 2007-2009 Cohesive Financial Technologies
24+
// LLC. Portions created by Rabbit Technologies Ltd are Copyright
25+
// (C) 2007-2009 Rabbit Technologies Ltd.
26+
//
27+
// All Rights Reserved.
28+
//
29+
// Contributor(s): ______________________________________.
30+
//
31+
32+
package com.rabbitmq.client.test.functional;
33+
34+
import com.rabbitmq.client.AMQP;
35+
import com.rabbitmq.client.ShutdownSignalException;
36+
import java.io.IOException;
37+
38+
public class DoubleDeletion extends BrokerTestCase
39+
{
40+
protected static final String Q = "DoubleDeletionQueue";
41+
protected static final String X = "DoubleDeletionExchange";
42+
43+
public void testDoubleDeletionQueue()
44+
throws IOException
45+
{
46+
channel.queueDeclare(Q);
47+
channel.queueDelete(Q);
48+
try {
49+
channel.queueDelete(Q);
50+
fail("Expected exception from double deletion of queue");
51+
} catch (IOException ee) {
52+
checkShutdownSignal(AMQP.NOT_FOUND, ee);
53+
// Pass!
54+
}
55+
}
56+
57+
public void testDoubleDeletionExchange()
58+
throws IOException
59+
{
60+
channel.exchangeDeclare(X, "direct");
61+
channel.exchangeDelete(X);
62+
try {
63+
channel.exchangeDelete(X);
64+
fail("Expected exception from double deletion of exchange");
65+
} catch (IOException ee) {
66+
checkShutdownSignal(AMQP.NOT_FOUND, ee);
67+
// Pass!
68+
}
69+
}
70+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
public class FunctionalTests extends TestCase {
3838
public static TestSuite suite() {
3939
TestSuite suite = new TestSuite("functional");
40+
suite.addTestSuite(DoubleDeletion.class);
4041
suite.addTestSuite(Routing.class);
4142
suite.addTestSuite(BindingLifecycle.class);
4243
suite.addTestSuite(Transactions.class);

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

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,21 +218,42 @@ public void testHeadersRouting() throws Exception {
218218
}
219219

220220
public void testUnbind() throws Exception {
221-
AMQP.Queue.DeclareOk ok = channel.queueDeclare();
222-
String queue = ok.getQueue();
223221

224-
String routingKey = "quay";
225222
String x = "amq.direct";
223+
String q = "testUnbind";
224+
String routingKey = "quay";
226225

227-
channel.queueBind(queue, x, routingKey);
226+
AMQP.Queue.DeclareOk ok = channel.queueDeclare(q);
227+
channel.queueBind(q, x, routingKey);
228228
channel.basicPublish(x, routingKey, null, "foobar".getBytes());
229-
checkGet(queue, true);
229+
checkGet(q, true);
230+
231+
String[][] tests = new String[][] {
232+
new String[] {"unknown_queue", x, routingKey},
233+
new String[] {q, "unknown_exchange", routingKey},
234+
new String[] {"unknown_queue", "unknown_exchange", routingKey},
235+
// see bug 20633
236+
// new String[] {q, x, "unknown_rk"},
237+
new String[] {"unknown_queue", "unknown_exchange", "unknown_rk"}
238+
};
239+
240+
for (int i = 0; i < tests.length; i++) {
241+
242+
String[] test = tests[i];
243+
try {
244+
channel.queueUnbind(test[0], test[1], test[2]);
245+
fail("expected not_found in test " + i);
246+
} catch (IOException ee) {
247+
checkShutdownSignal(AMQP.NOT_FOUND, ee);
248+
openChannel();
249+
}
250+
}
230251

231-
channel.queueUnbind(queue, x, routingKey);
252+
channel.queueUnbind(q, x, routingKey);
232253

233254
channel.basicPublish(x, routingKey, null, "foobar".getBytes());
234-
checkGet(queue, false);
255+
checkGet(q, false);
235256

236-
channel.queueDelete(queue);
257+
channel.queueDelete(q);
237258
}
238259
}

0 commit comments

Comments
 (0)