Added a option to be able to test againt the new kahadb store

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@740344 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2009-02-03 16:36:48 +00:00
parent 675afd6962
commit 5e2eedcac0
1 changed files with 25 additions and 16 deletions

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.bugs;
import java.io.File;
import java.text.DateFormat;
import java.util.Date;
import java.util.concurrent.CountDownLatch;
@ -33,6 +34,7 @@ import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.store.amq.AMQPersistenceAdapter;
import org.apache.activemq.store.amq.AMQPersistenceAdapterFactory;
import org.apache.activemq.store.kahadb.KahaDBStore;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@ -50,7 +52,7 @@ public class VerifySteadyEnqueueRate extends TestCase {
private Connection producerConnection;
final boolean useTopic = false;
AMQPersistenceAdapter persistentAdapter;
private boolean useAMQPStore=true;
protected static final String payload = new String(new byte[24]);
public void setUp() throws Exception {
@ -118,8 +120,8 @@ public class VerifySteadyEnqueueRate extends TestCase {
broker.setDeleteAllMessagesOnStartup(true);
broker.setPersistent(true);
broker.setUseJmx(true);
broker.addConnector("tcp://localhost:0").setName("Default");
if( useAMQPStore ) {
AMQPersistenceAdapterFactory factory = (AMQPersistenceAdapterFactory) broker.getPersistenceFactory();
// ensure there are a bunch of data files but multiple entries in each
//factory.setMaxFileLength(1024 * 20);
@ -133,7 +135,14 @@ public class VerifySteadyEnqueueRate extends TestCase {
factory.setIndexMaxBinSize(indexBinSize * 2);
factory.setIndexBinSize(indexBinSize);
factory.setIndexPageSize(192*20);
persistentAdapter = (AMQPersistenceAdapter) broker.getPersistenceAdapter();
} else {
KahaDBStore kaha = new KahaDBStore();
kaha.setDirectory(new File("target/activemq-data/kahadb"));
kaha.deleteAllMessages();
broker.setPersistenceAdapter(kaha);
}
broker.addConnector("tcp://localhost:0").setName("Default");
broker.start();
LOG.info("Starting broker..");
}