From 33fb7c6096c0786997f76caccd0c4e3e02e40a33 Mon Sep 17 00:00:00 2001 From: Timothy Bish Date: Mon, 15 Jun 2015 10:18:28 -0400 Subject: [PATCH] https://issues.apache.org/jira/browse/AMQ-5621 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. --- .../org/apache/activemq/bugs/AMQ5567Test.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5567Test.java b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5567Test.java index c0e1c1470e..a17d3f887a 100755 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5567Test.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5567Test.java @@ -18,11 +18,14 @@ package org.apache.activemq.bugs; import java.io.File; import java.util.concurrent.TimeUnit; + import javax.jms.JMSException; import javax.jms.TextMessage; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; + import junit.framework.Test; + import org.apache.activemq.broker.BrokerRestartTestSupport; import org.apache.activemq.broker.BrokerService; import org.apache.activemq.broker.StubConnection; @@ -46,8 +49,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class AMQ5567Test extends BrokerRestartTestSupport { + 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 protected void configureBroker(BrokerService broker) throws Exception { @@ -55,12 +61,19 @@ public class AMQ5567Test extends BrokerRestartTestSupport { broker.setPersistenceAdapter(persistenceAdapter); } + @Override protected PolicyEntry getDefaultPolicy() { PolicyEntry policy = new PolicyEntry(); policy.setMemoryLimit(60*1024); return policy; } + @Override + protected void tearDown() throws Exception { + super.tearDown(); + IOHelper.delete(new File(DATA_FOLDER)); + } + public void initCombosForTestPreparedTransactionNotDispatched() throws Exception { PersistenceAdapter[] persistenceAdapters = new PersistenceAdapter[]{ new KahaDBPersistenceAdapter(), @@ -68,7 +81,7 @@ public class AMQ5567Test extends BrokerRestartTestSupport { new JDBCPersistenceAdapter() }; for (PersistenceAdapter adapter : persistenceAdapters) { - adapter.setDirectory(new File(IOHelper.getDefaultDataDirectory())); + adapter.setDirectory(new File(DATA_FOLDER)); } addCombinationValues("persistenceAdapter", persistenceAdapters); }