|
27 | 27 | import com.rabbitmq.client.ConnectionFactory;
|
28 | 28 | import com.rabbitmq.client.GetResponse;
|
29 | 29 | import com.rabbitmq.client.MessageProperties;
|
| 30 | +import com.rabbitmq.client.Method; |
30 | 31 | import com.rabbitmq.client.ShutdownSignalException;
|
31 | 32 | import com.rabbitmq.client.AlreadyClosedException;
|
32 | 33 | import com.rabbitmq.client.impl.ShutdownNotifierComponent;
|
@@ -82,10 +83,15 @@ protected void releaseResources()
|
82 | 83 | protected void restart()
|
83 | 84 | throws IOException {
|
84 | 85 | tearDown();
|
85 |
| - Host.executeCommand("cd ../rabbitmq-test; make restart-app"); |
| 86 | + bareRestart(); |
86 | 87 | setUp();
|
87 | 88 | }
|
88 | 89 |
|
| 90 | + protected void bareRestart() |
| 91 | + throws IOException { |
| 92 | + Host.executeCommand("cd ../rabbitmq-test; make restart-app"); |
| 93 | + } |
| 94 | + |
89 | 95 | public void openConnection()
|
90 | 96 | throws IOException {
|
91 | 97 | if (connection == null) {
|
@@ -126,14 +132,20 @@ public void checkShutdownSignal(int expectedCode, AlreadyClosedException ace) {
|
126 | 132 | }
|
127 | 133 |
|
128 | 134 | public void checkShutdownSignal(int expectedCode, ShutdownSignalException sse) {
|
129 |
| - Command closeCommand = (Command) sse.getReason(); |
| 135 | + Object reason = sse.getReason(); |
| 136 | + Method method; |
| 137 | + if (reason instanceof Command) { |
| 138 | + method = ((Command) reason).getMethod(); |
| 139 | + } else { |
| 140 | + method = (Method) reason; |
| 141 | + } |
130 | 142 | channel = null;
|
131 | 143 | if (sse.isHardError()) {
|
132 | 144 | connection = null;
|
133 |
| - AMQP.Connection.Close closeMethod = (AMQP.Connection.Close) closeCommand.getMethod(); |
| 145 | + AMQP.Connection.Close closeMethod = (AMQP.Connection.Close) method; |
134 | 146 | assertEquals(expectedCode, closeMethod.getReplyCode());
|
135 | 147 | } else {
|
136 |
| - AMQP.Channel.Close closeMethod = (AMQP.Channel.Close) closeCommand.getMethod(); |
| 148 | + AMQP.Channel.Close closeMethod = (AMQP.Channel.Close) method; |
137 | 149 | assertEquals(expectedCode, closeMethod.getReplyCode());
|
138 | 150 | }
|
139 | 151 | }
|
|
0 commit comments