diff --git a/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java b/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java index a9e5512522..8745d90aa9 100644 --- a/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java @@ -41,11 +41,12 @@ import org.apache.derby.jdbc.EmbeddedDataSource; public class JDBCMessagePriorityTest extends MessagePriorityTest { private static final Log LOG = LogFactory.getLog(JDBCMessagePriorityTest.class); + EmbeddedDataSource dataSource; @Override protected PersistenceAdapter createPersistenceAdapter(boolean delete) throws Exception { JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter(); - EmbeddedDataSource dataSource = new EmbeddedDataSource(); + dataSource = new EmbeddedDataSource(); dataSource.setDatabaseName("derbyDb"); dataSource.setCreateDatabase("create"); dataSource.setShutdownDatabase("false"); @@ -55,6 +56,17 @@ public class JDBCMessagePriorityTest extends MessagePriorityTest { return jdbc; } + + protected void tearDown() throws Exception { + super.tearDown(); + try { + dataSource.setShutdownDatabase("true"); + dataSource.getConnection(); + } catch (Exception ignored) { + } + + } + // this cannot be a general test as kahaDB just has support for 3 priority levels public void testDurableSubsReconnectWithFourLevels() throws Exception { ActiveMQTopic topic = (ActiveMQTopic) sess.createTopic("TEST");