Skip to content

Commit 695efa5

Browse files
author
Alexandru Scvortov
committed
merge bug22956 into default
2 parents 8e34cea + dc87b42 commit 695efa5

File tree

6 files changed

+15
-31
lines changed

6 files changed

+15
-31
lines changed

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

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ public void testExchangeIfUnused() throws IOException {
137137
try {
138138
channel.exchangeDelete(binding.x, true);
139139
}
140-
catch (Exception e) {
141-
// do nothing, this is the correct behaviour
140+
catch (IOException e) {
141+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
142142
openChannel();
143143
deleteExchangeAndQueue(binding);
144144
return;
@@ -193,17 +193,7 @@ public void testExchangePassiveDeclare() throws IOException {
193193
fail("Passive declare of an unknown exchange should fail");
194194
}
195195
catch (IOException ioe) {
196-
Throwable t = ioe.getCause();
197-
String msg = "Passive declare of an unknown exchange should send a 404";
198-
assertTrue(msg, t instanceof ShutdownSignalException);
199-
Object r = ((ShutdownSignalException)t).getReason();
200-
assertTrue(msg, r instanceof Command);
201-
Method m = ((Command)r).getMethod();
202-
assertTrue(msg, m instanceof AMQP.Channel.Close);
203-
assertEquals(msg,
204-
AMQP.NOT_FOUND,
205-
((AMQP.Channel.Close)m).getReplyCode());
206-
return;
196+
checkShutdownSignal(AMQP.NOT_FOUND, ioe);
207197
}
208198
}
209199

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
package com.rabbitmq.client.test.functional;
3333

34+
import com.rabbitmq.client.AMQP;
3435
import com.rabbitmq.client.GetResponse;
3536
import com.rabbitmq.client.QueueingConsumer;
3637
import java.io.IOException;
@@ -104,8 +105,8 @@ protected void doAutoDelete(boolean durable, int queues) throws IOException {
104105
channel.queueBind(binding.q, binding.x, binding.k);
105106
sendRoutable(binding);
106107
}
107-
catch (Exception e) {
108-
// do nothing, this is the correct behaviour
108+
catch (IOException e) {
109+
checkShutdownSignal(AMQP.NOT_FOUND, e);
109110
channel = null;
110111
return;
111112
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ public void testQueueAutoDelete() throws IOException {
139139
try {
140140
verifyQueueExists(name);
141141
} catch (IOException ioe) {
142+
checkShutdownSignal(AMQP.NOT_FOUND, ioe);
142143
return;
143144
}
144145
fail("Queue should have been auto-deleted after we removed its only consumer");

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,9 @@ public void testUnknownTagAck()
248248
txCommit();
249249
fail("expected exception");
250250
}
251-
catch (IOException e) {}
252-
catch (AlreadyClosedException e) {}
251+
catch (IOException e) {
252+
checkShutdownSignal(AMQP.PRECONDITION_FAILED, e);
253+
}
253254
connection = null;
254255
openConnection();
255256
}

test/src/com/rabbitmq/client/test/server/ExclusiveQueueDurability.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import java.io.IOException;
3535
import java.util.HashMap;
3636

37+
import com.rabbitmq.client.AMQP;
3738
import com.rabbitmq.client.Channel;
3839
import com.rabbitmq.client.Connection;
3940
import com.rabbitmq.client.ConnectionFactory;
@@ -55,7 +56,7 @@ void verifyQueueMissing(Channel channel, String queueName)
5556
try {
5657
channel.queueDeclare(queueName, false, false, false, null);
5758
} catch (IOException ioe) {
58-
// FIXME check that it's specifically resource locked
59+
checkShutdownSignal(AMQP.RESOURCE_LOCKED, ioe);
5960
fail("Declaring the queue resulted in a channel exception, probably meaning that it already exists");
6061
}
6162
}

test/src/com/rabbitmq/client/test/server/Permissions.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -374,19 +374,9 @@ protected void runTest(boolean exp, String name, WithName test)
374374
test.with(name);
375375
assertTrue(msg, exp);
376376
} catch (IOException e) {
377-
assertFalse(msg, exp);
378-
Throwable t = e.getCause();
379-
assertTrue(msg, t instanceof ShutdownSignalException);
380-
Object r = ((ShutdownSignalException)t).getReason();
381-
assertTrue(msg, r instanceof Command);
382-
Method m = ((Command)r).getMethod();
383-
assertTrue(msg, m instanceof AMQP.Channel.Close);
384-
assertEquals(msg,
385-
AMQP.ACCESS_REFUSED,
386-
((AMQP.Channel.Close)m).getReplyCode());
387-
//This fails due to bug 20296
388-
//openChannel();
389-
channel = connection.createChannel(channel.getChannelNumber() + 1);
377+
checkShutdownSignal(AMQP.ACCESS_REFUSED, e);
378+
openConnection();
379+
openChannel();
390380
}
391381
}
392382

0 commit comments

Comments
 (0)