Have the test store its data in the target folder to let the clean step
remove it and attempt to remove the data folder between runs to avoid
state derby instances.
This commit is contained in:
Timothy Bish 2015-06-15 10:18:28 -04:00
parent 1d0f0d541a
commit 33fb7c6096
1 changed files with 15 additions and 2 deletions

View File

@ -18,11 +18,14 @@ package org.apache.activemq.bugs;
import java.io.File; import java.io.File;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.jms.JMSException; import javax.jms.JMSException;
import javax.jms.TextMessage; import javax.jms.TextMessage;
import javax.management.MalformedObjectNameException; import javax.management.MalformedObjectNameException;
import javax.management.ObjectName; import javax.management.ObjectName;
import junit.framework.Test; import junit.framework.Test;
import org.apache.activemq.broker.BrokerRestartTestSupport; import org.apache.activemq.broker.BrokerRestartTestSupport;
import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.StubConnection; import org.apache.activemq.broker.StubConnection;
@ -46,8 +49,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class AMQ5567Test extends BrokerRestartTestSupport { public class AMQ5567Test extends BrokerRestartTestSupport {
protected static final Logger LOG = LoggerFactory.getLogger(AMQ5567Test.class); protected static final Logger LOG = LoggerFactory.getLogger(AMQ5567Test.class);
ActiveMQQueue destination = new ActiveMQQueue("Q");
private final ActiveMQQueue destination = new ActiveMQQueue("Q");
private final String DATA_FOLDER = "./target/AMQ5567Test-data";
@Override @Override
protected void configureBroker(BrokerService broker) throws Exception { protected void configureBroker(BrokerService broker) throws Exception {
@ -55,12 +61,19 @@ public class AMQ5567Test extends BrokerRestartTestSupport {
broker.setPersistenceAdapter(persistenceAdapter); broker.setPersistenceAdapter(persistenceAdapter);
} }
@Override
protected PolicyEntry getDefaultPolicy() { protected PolicyEntry getDefaultPolicy() {
PolicyEntry policy = new PolicyEntry(); PolicyEntry policy = new PolicyEntry();
policy.setMemoryLimit(60*1024); policy.setMemoryLimit(60*1024);
return policy; return policy;
} }
@Override
protected void tearDown() throws Exception {
super.tearDown();
IOHelper.delete(new File(DATA_FOLDER));
}
public void initCombosForTestPreparedTransactionNotDispatched() throws Exception { public void initCombosForTestPreparedTransactionNotDispatched() throws Exception {
PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[]{ PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[]{
new KahaDBPersistenceAdapter(), new KahaDBPersistenceAdapter(),
@ -68,7 +81,7 @@ public class AMQ5567Test extends BrokerRestartTestSupport {
new JDBCPersistenceAdapter() new JDBCPersistenceAdapter()
}; };
for (PersistenceAdapter adapter : persistenceAdapters) { for (PersistenceAdapter adapter : persistenceAdapters) {
adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory())); adapter.setDirectory(new File(DATA_FOLDER));
} }
addCombinationValues("persistenceAdapter", persistenceAdapters); addCombinationValues("persistenceAdapter", persistenceAdapters);
} }