From 570dbb437210b6190920932257fcd1b255155a66 Mon Sep 17 00:00:00 2001 From: Hadrian Zbarcea Date: Mon, 10 Mar 2014 11:00:08 -0400 Subject: [PATCH] [minor] Use MemoryPersistenceAdapter for testing when choice of persistence adapter is indifferent --- .../usecases/ExpiredMessagesTest.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java index 15597dc121..4c97972f2a 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/ExpiredMessagesTest.java @@ -17,6 +17,7 @@ package org.apache.activemq.usecases; import junit.framework.Test; + import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.CombinationTestSupport; import org.apache.activemq.broker.BrokerService; @@ -26,12 +27,13 @@ import org.apache.activemq.broker.region.policy.PolicyMap; import org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; -import org.apache.activemq.leveldb.LevelDBStore; +import org.apache.activemq.store.memory.MemoryPersistenceAdapter; import org.apache.activemq.util.Wait; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.jms.*; + import java.io.File; import java.util.concurrent.atomic.AtomicLong; @@ -68,6 +70,13 @@ public class ExpiredMessagesTest extends CombinationTestSupport { brokerUri = broker.getTransportConnectors().get(0).getPublishableConnectString(); } + @Override + protected void tearDown() throws Exception { + connection.stop(); + broker.stop(); + broker.waitUntilStopped(); + } + public void testExpiredMessages() throws Exception { ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUri); @@ -291,9 +300,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport { BrokerService broker = new BrokerService(); broker.setBrokerName("localhost"); broker.setDestinations(new ActiveMQDestination[]{destination}); - LevelDBStore adaptor = new LevelDBStore(); - adaptor.setDirectory(new File("target/expiredtest-data/")); - broker.setPersistenceAdapter(adaptor); + broker.setPersistenceAdapter(new MemoryPersistenceAdapter()); PolicyEntry defaultPolicy = new PolicyEntry(); if (useVMCursor) { @@ -311,12 +318,4 @@ public class ExpiredMessagesTest extends CombinationTestSupport { return broker; } - - - @Override - protected void tearDown() throws Exception { - connection.stop(); - broker.stop(); - broker.waitUntilStopped(); - } }