[minor] Use MemoryPersistenceAdapter for testing when choice of persistence adapter is indifferent

This commit is contained in:
Hadrian Zbarcea 2014-03-10 11:00:08 -04:00
parent d793db4440
commit 570dbb4372
1 changed files with 11 additions and 12 deletions

View File

@ -17,6 +17,7 @@
package org.apache.activemq.usecases; package org.apache.activemq.usecases;
import junit.framework.Test; import junit.framework.Test;
import org.apache.activemq.ActiveMQConnectionFactory; import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.CombinationTestSupport; import org.apache.activemq.CombinationTestSupport;
import org.apache.activemq.broker.BrokerService; 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.broker.region.policy.VMPendingQueueMessageStoragePolicy;
import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQQueue; 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.apache.activemq.util.Wait;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import javax.jms.*; import javax.jms.*;
import java.io.File; import java.io.File;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
@ -68,6 +70,13 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
brokerUri = broker.getTransportConnectors().get(0).getPublishableConnectString(); brokerUri = broker.getTransportConnectors().get(0).getPublishableConnectString();
} }
@Override
protected void tearDown() throws Exception {
connection.stop();
broker.stop();
broker.waitUntilStopped();
}
public void testExpiredMessages() throws Exception { public void testExpiredMessages() throws Exception {
ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUri); ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory(brokerUri);
@ -291,9 +300,7 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
BrokerService broker = new BrokerService(); BrokerService broker = new BrokerService();
broker.setBrokerName("localhost"); broker.setBrokerName("localhost");
broker.setDestinations(new ActiveMQDestination[]{destination}); broker.setDestinations(new ActiveMQDestination[]{destination});
LevelDBStore adaptor = new LevelDBStore(); broker.setPersistenceAdapter(new MemoryPersistenceAdapter());
adaptor.setDirectory(new File("target/expiredtest-data/"));
broker.setPersistenceAdapter(adaptor);
PolicyEntry defaultPolicy = new PolicyEntry(); PolicyEntry defaultPolicy = new PolicyEntry();
if (useVMCursor) { if (useVMCursor) {
@ -311,12 +318,4 @@ public class ExpiredMessagesTest extends CombinationTestSupport {
return broker; return broker;
} }
@Override
protected void tearDown() throws Exception {
connection.stop();
broker.stop();
broker.waitUntilStopped();
}
} }