Skip to content

Commit 736cdeb

Browse files
author
Matthias Radestock
committed
cherry-pick some useful code from 'default'
1 parent 7ce6453 commit 736cdeb

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@
3636
import junit.framework.TestCase;
3737

3838
import com.rabbitmq.client.Channel;
39+
import com.rabbitmq.client.Command;
3940
import com.rabbitmq.client.Connection;
4041
import com.rabbitmq.client.ConnectionFactory;
42+
import com.rabbitmq.client.ShutdownSignalException;
43+
44+
import com.rabbitmq.client.AMQP;
4145

4246
public class BrokerTestCase extends TestCase
4347
{
@@ -120,4 +124,17 @@ public void closeChannel()
120124
}
121125
}
122126

127+
public void checkShutdownSignal(int expectedCode, IOException ioe) {
128+
ShutdownSignalException sse = (ShutdownSignalException) ioe.getCause();
129+
Command closeCommand = (Command) sse.getReason();
130+
channel = null;
131+
if (sse.isHardError()) {
132+
connection = null;
133+
AMQP.Connection.Close closeMethod = (AMQP.Connection.Close) closeCommand.getMethod();
134+
assertEquals(expectedCode, closeMethod.getReplyCode());
135+
} else {
136+
AMQP.Channel.Close closeMethod = (AMQP.Channel.Close) closeCommand.getMethod();
137+
assertEquals(expectedCode, closeMethod.getReplyCode());
138+
}
139+
}
123140
}

0 commit comments

Comments
 (0)