mirror of https://github.com/apache/activemq.git
Ensure that connections created with vm Transport connections get
closed.
This commit is contained in:
parent
98d2000833
commit
c9b208f0a3
|
@ -72,6 +72,8 @@ public class ActiveMQConnectionFactoryTest {
|
|||
ActiveMQConnection connection = ((ActiveMQConnection) ((ManagedConnectionProxy) con).getManagedConnection().getPhysicalConnection());
|
||||
assertEquals(100, connection.getPrefetchPolicy().getQueuePrefetch());
|
||||
assertNotNull("Connection object returned by ActiveMQConnectionFactory.createConnection() is null", con);
|
||||
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
|
@ -92,6 +94,8 @@ public class ActiveMQConnectionFactoryTest {
|
|||
con.start();
|
||||
|
||||
assertEquals(0, ((ActiveMQTopicSubscriber) sub).getPrefetchNumber());
|
||||
|
||||
con.close();
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
|
|
|
@ -51,7 +51,6 @@ public class ManagedConnectionTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
managedConnectionFactory = new ActiveMQManagedConnectionFactory();
|
||||
managedConnectionFactory.setServerUrl(DEFAULT_HOST);
|
||||
managedConnectionFactory.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
|
||||
|
@ -60,7 +59,6 @@ public class ManagedConnectionTest {
|
|||
connectionFactory = (ConnectionFactory)managedConnectionFactory.createConnectionFactory(connectionManager);
|
||||
connection = (ManagedConnectionProxy)connectionFactory.createConnection();
|
||||
managedConnection = connection.getManagedConnection();
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -106,7 +104,6 @@ public class ManagedConnectionTest {
|
|||
session.commit();
|
||||
|
||||
assertTrue(test[0]);
|
||||
|
||||
}
|
||||
|
||||
@Test(timeout = 60000)
|
||||
|
@ -254,6 +251,7 @@ public class ManagedConnectionTest {
|
|||
public void testSamePropertiesButNotEqual() throws Exception {
|
||||
ManagedConnectionProxy newConnection = (ManagedConnectionProxy)connectionFactory.createConnection();
|
||||
assertNonEquality(managedConnection, newConnection.getManagedConnection());
|
||||
newConnection.close();
|
||||
}
|
||||
|
||||
private void assertEquality(ActiveMQManagedConnection leftCon, ActiveMQManagedConnection rightCon) {
|
||||
|
|
|
@ -29,6 +29,7 @@ import javax.resource.ResourceException;
|
|||
import javax.transaction.xa.XAException;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -51,6 +52,13 @@ public class UnsubscribeResubscribeTest {
|
|||
managedConnectionFactory.setClientid("clientId");
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
private void getConnection() throws ResourceException, JMSException {
|
||||
connectionFactory = (ConnectionFactory)managedConnectionFactory.createConnectionFactory(connectionManager);
|
||||
connection = (ManagedConnectionProxy)connectionFactory.createConnection();
|
||||
|
|
Loading…
Reference in New Issue