Skip to content

Commit 009464c

Browse files
Let BrokerTestCase#tearDown handle connection termination where possible
1 parent 9374062 commit 009464c

File tree

1 file changed

+2
-21
lines changed

1 file changed

+2
-21
lines changed

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

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,23 @@ public void testConnectionRecovery() throws IOException, InterruptedException {
2222
assertTrue(connection.isOpen());
2323
closeAndWaitForRecovery();
2424
assertTrue(connection.isOpen());
25-
connection.abort();
2625
}
2726

2827
public void testConnectionRecoveryWithServerRestart() throws IOException, InterruptedException {
2928
assertTrue(connection.isOpen());
3029
restartPrimaryAndWaitForRecovery();
3130
assertTrue(connection.isOpen());
32-
connection.abort();
33-
assertFalse(connection.isOpen());
3431
}
3532

3633
public void testConnectionRecoveryWithMultipleAddresses() throws IOException, InterruptedException {
3734
final Address[] addresses = {new Address("127.0.0.1"), new Address("127.0.0.1", 5672)};
35+
AutorecoveringConnection c = newRecoveringConnection(addresses);
3836
try {
39-
AutorecoveringConnection c = newRecoveringConnection(addresses);
4037
assertTrue(c.isOpen());
4138
closeAndWaitForRecovery(c);
4239
assertTrue(c.isOpen());
4340
} finally {
44-
channel.abort();
41+
c.abort();
4542
}
4643

4744
}
@@ -102,7 +99,6 @@ public void handleUnblocked() throws IOException {
10299
channel.basicPublish("", "", null, "".getBytes());
103100
unblock();
104101
wait(latch);
105-
connection.abort();
106102
}
107103

108104
public void testChannelRecovery() throws IOException, InterruptedException {
@@ -114,7 +110,6 @@ public void testChannelRecovery() throws IOException, InterruptedException {
114110
closeAndWaitForRecovery();
115111
expectChannelRecovery(ch1);
116112
expectChannelRecovery(ch2);
117-
connection.abort();
118113
}
119114

120115
public void testReturnListenerRecovery() throws IOException, InterruptedException {
@@ -131,7 +126,6 @@ public void handleReturn(int replyCode, String replyText, String exchange,
131126
expectChannelRecovery(channel);
132127
channel.basicPublish("", "unknown", true, false, null, "mandatory1".getBytes());
133128
wait(latch);
134-
connection.abort();
135129
}
136130

137131
public void testConfirmListenerRecovery() throws IOException, InterruptedException, TimeoutException {
@@ -157,7 +151,6 @@ public void handleNack(long deliveryTag, boolean multiple) throws IOException {
157151
}
158152
waitForConfirms(channel);
159153
wait(latch);
160-
connection.abort();
161154
}
162155

163156
public void testClientNamedQueueRecovery() throws IOException, InterruptedException, TimeoutException {
@@ -168,7 +161,6 @@ public void testClientNamedQueueRecovery() throws IOException, InterruptedExcept
168161
expectChannelRecovery(ch);
169162
expectQueueRecovery(ch, q);
170163
ch.queueDelete(q);
171-
connection.abort();
172164
}
173165

174166
public void testServerNamedQueueRecovery() throws IOException, InterruptedException {
@@ -181,7 +173,6 @@ public void testServerNamedQueueRecovery() throws IOException, InterruptedExcept
181173
channel.basicPublish(x, "", null, "msg".getBytes());
182174
assertDelivered(q, 1);
183175
channel.queueDelete(q);
184-
connection.abort();
185176
}
186177

187178
public void testExchangeToExchangeBindingRecovery() throws IOException, InterruptedException {
@@ -200,7 +191,6 @@ public void testExchangeToExchangeBindingRecovery() throws IOException, Interrup
200191
} finally {
201192
channel.exchangeDelete(x2);
202193
channel.queueDelete(q);
203-
connection.abort();
204194
}
205195
}
206196

@@ -225,7 +215,6 @@ public void testThatDeletedQueueBindingsDontReappearOnRecovery() throws IOExcept
225215
} finally {
226216
channel.exchangeDelete(x2);
227217
channel.queueDelete(q);
228-
connection.abort();
229218
}
230219
}
231220

@@ -246,7 +235,6 @@ public void testThatDeletedExchangeBindingsDontReappearOnRecovery() throws IOExc
246235
} finally {
247236
channel.exchangeDelete(x2);
248237
channel.queueDelete(q);
249-
connection.abort();
250238
}
251239
}
252240

@@ -261,8 +249,6 @@ public void testThatDeletedExchangeDoesNotReappearOnRecover() throws IOException
261249
fail("Expected passive declare to fail");
262250
} catch (IOException ioe) {
263251
// expected
264-
} finally {
265-
connection.abort();
266252
}
267253
}
268254

@@ -276,8 +262,6 @@ public void testThatDeletedQueueDoesNotReappearOnRecover() throws IOException, I
276262
fail("Expected passive declare to fail");
277263
} catch (IOException ioe) {
278264
// expected
279-
} finally {
280-
connection.abort();
281265
}
282266
}
283267

@@ -292,7 +276,6 @@ public void testThatCancelledConsumerDoesNotReappearOnRecover() throws IOExcepti
292276
expectChannelRecovery(channel);
293277
AMQP.Queue.DeclareOk ok2 = channel.queueDeclarePassive(q);
294278
assertEquals(0, ok2.getConsumerCount());
295-
connection.abort();
296279
}
297280

298281
public void testChannelRecoveryCallback() throws IOException, InterruptedException {
@@ -313,7 +296,6 @@ public void handleRecovery(Recoverable recoverable) {
313296
expectChannelRecovery(ch1);
314297
expectChannelRecovery(ch2);
315298
wait(latch);
316-
connection.abort();
317299
}
318300

319301
public void testBasicAckAfterChannelRecovery() throws IOException, InterruptedException {
@@ -351,7 +333,6 @@ public void handleDelivery(String consumerTag,
351333
}
352334
wait(latch);
353335
publishingConnection.abort();
354-
connection.abort();
355336
}
356337

357338
private AMQP.Queue.DeclareOk declareClientNamedQueue(Channel ch, String q) throws IOException {

0 commit comments

Comments
 (0)