Skip to content

Commit f806c94

Browse files
committed
AMQP-800: Destroy test default connection factory
JIRA: https://jira.spring.io/browse/AMQP-800
1 parent f32b358 commit f806c94

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/connection/LocalizedQueueConnectionFactoryIntegrationTests.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import java.util.UUID;
2222

23+
import org.junit.After;
2324
import org.junit.Before;
2425
import org.junit.ClassRule;
2526
import org.junit.Test;
@@ -41,9 +42,11 @@ public class LocalizedQueueConnectionFactoryIntegrationTests {
4142

4243
private LocalizedQueueConnectionFactory lqcf;
4344

45+
private CachingConnectionFactory defaultConnectionFactory;
46+
4447
@Before
4548
public void setup() {
46-
ConnectionFactory defaultConnectionFactory = new CachingConnectionFactory("localhost");
49+
this.defaultConnectionFactory = new CachingConnectionFactory("localhost");
4750
String[] addresses = new String[] { "localhost:9999", "localhost:5672" };
4851
String[] adminUris = new String[] { "http://localhost:15672", "http://localhost:15672" };
4952
String[] nodes = new String[] { "foo@bar", "rabbit@localhost" };
@@ -54,6 +57,12 @@ public void setup() {
5457
adminUris, nodes, vhost, username, password, false, null);
5558
}
5659

60+
@After
61+
public void tearDown() throws Exception {
62+
this.lqcf.destroy();
63+
this.defaultConnectionFactory.destroy();
64+
}
65+
5766
@Test
5867
public void testConnect() throws Exception {
5968
RabbitAdmin admin = new RabbitAdmin(this.lqcf);
@@ -64,7 +73,6 @@ public void testConnect() throws Exception {
6473
template.convertAndSend("", queue.getName(), "foo");
6574
assertEquals("foo", template.receiveAndConvert(queue.getName()));
6675
admin.deleteQueue(queue.getName());
67-
lqcf.destroy();
6876
}
6977

7078
}

0 commit comments

Comments
 (0)