diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java index 581311d99b..ab8858a6cd 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java @@ -16,10 +16,8 @@ */ package org.apache.activemq.broker.store; -import java.io.File; -import java.util.ArrayList; -import java.util.concurrent.TimeUnit; import junit.framework.Test; +import org.apache.activemq.TestSupport; import org.apache.activemq.broker.BrokerRestartTestSupport; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.StubConnection; @@ -35,16 +33,15 @@ import org.apache.activemq.command.Message; import org.apache.activemq.command.MessageAck; import org.apache.activemq.command.ProducerInfo; import org.apache.activemq.command.SessionInfo; -import org.apache.activemq.openwire.OpenWireFormat; -import org.apache.activemq.store.PersistenceAdapter; -import org.apache.activemq.store.jdbc.JDBCPersistenceAdapter; -import org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter; -import org.apache.activemq.util.IOHelper; + +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport { final ArrayList expected = new ArrayList(); final ActiveMQDestination destination = new ActiveMQQueue("TEST"); public PendingQueueMessageStoragePolicy queuePendingPolicy; + public TestSupport.PersistenceAdapterChoice persistenceAdapterChoice; @Override protected void setUp() throws Exception { @@ -54,14 +51,10 @@ public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport { public void initCombosForTestRecovery() throws Exception { addCombinationValues("queuePendingPolicy", new PendingQueueMessageStoragePolicy[] {new FilePendingQueueMessageStoragePolicy(), new VMPendingQueueMessageStoragePolicy()}); - PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[] { - new KahaDBPersistenceAdapter(), - new JDBCPersistenceAdapter() + TestSupport.PersistenceAdapterChoice[] persistenceAdapters = new TestSupport.PersistenceAdapterChoice[] { + TestSupport.PersistenceAdapterChoice.JDBC, TestSupport.PersistenceAdapterChoice.KahaDB }; - for (PersistenceAdapter adapter : persistenceAdapters) { - adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory())); - } - addCombinationValues("persistenceAdapter", persistenceAdapters); + addCombinationValues("persistenceAdapterChoice", persistenceAdapters); } public void testRecovery() throws Exception { @@ -134,10 +127,7 @@ public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport { @Override protected void configureBroker(BrokerService broker) throws Exception { super.configureBroker(broker); - if (persistenceAdapter instanceof JDBCPersistenceAdapter) { - ((JDBCPersistenceAdapter) persistenceAdapter).setLockDataSource(null); - } - broker.setPersistenceAdapter(persistenceAdapter); + TestSupport.setPersistenceAdapter(broker, persistenceAdapterChoice); } public static Test suite() {