Removing TemporaryFolder usage in Junit tests to try and fix the
tests that are hanging when messages are produced.
This commit is contained in:
Christopher L. Shannon (cshannon) 2015-09-10 19:40:45 +00:00
parent 3ec560f2a8
commit d27b192553
5 changed files with 19 additions and 24 deletions

View File

@ -179,7 +179,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
verifyStoreStats(dest, 0, 0);
}
@Test(timeout=200000)
@Test(timeout=10000)
public void testTopicMessageSize() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();
@ -205,7 +205,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
connection.close();
}
@Test(timeout=200000)
@Test(timeout=10000)
public void testTopicNonPersistentMessageSize() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();
@ -232,7 +232,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
connection.close();
}
@Test(timeout=200000)
@Test(timeout=10000)
public void testTopicPersistentAndNonPersistentMessageSize() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();
@ -261,7 +261,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
connection.close();
}
@Test(timeout=20000)
@Test(timeout=10000)
public void testMessageSizeOneDurable() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();
Connection connection = new ActiveMQConnectionFactory(brokerConnectURI).createConnection();
@ -286,7 +286,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
connection.close();
}
@Test(timeout=20000)
@Test(timeout=10000)
public void testMessageSizeOneDurablePartialConsumption() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();
@ -312,7 +312,7 @@ public abstract class AbstractPendingMessageCursorTest extends AbstractStoreStat
connection.close();
}
@Test(timeout=20000)
@Test(timeout=10000)
public void testMessageSizeTwoDurables() throws Exception {
AtomicLong publishedMessageSize = new AtomicLong();

View File

@ -45,13 +45,12 @@ public class KahaDBPendingMessageCursorTest extends
protected static final Logger LOG = LoggerFactory
.getLogger(KahaDBPendingMessageCursorTest.class);
@Rule
public TemporaryFolder dataFileDir = new TemporaryFolder(new File("target"));
File dataFileDir = new File("target/test-amq-5923/pending-datadb");
@Override
protected void setUpBroker(boolean clearDataDir) throws Exception {
if (clearDataDir && dataFileDir.getRoot().exists())
FileUtils.cleanDirectory(dataFileDir.getRoot());
if (clearDataDir && dataFileDir.exists())
FileUtils.cleanDirectory(dataFileDir);
super.setUpBroker(clearDataDir);
}
@ -59,7 +58,7 @@ public class KahaDBPendingMessageCursorTest extends
protected void initPersistence(BrokerService brokerService)
throws IOException {
broker.setPersistent(true);
broker.setDataDirectoryFile(dataFileDir.getRoot());
broker.setDataDirectoryFile(dataFileDir);
}
/**

View File

@ -41,7 +41,7 @@ public class MultiKahaDBPendingMessageCursorTest extends
//setup multi-kaha adapter
MultiKahaDBPersistenceAdapter persistenceAdapter = new MultiKahaDBPersistenceAdapter();
persistenceAdapter.setDirectory(dataFileDir.getRoot());
persistenceAdapter.setDirectory(dataFileDir);
KahaDBPersistenceAdapter kahaStore = new KahaDBPersistenceAdapter();
kahaStore.setJournalMaxFileLength(1024 * 512);

View File

@ -42,13 +42,12 @@ public class KahaDBMessageStoreSizeStatTest extends
protected static final Logger LOG = LoggerFactory
.getLogger(KahaDBMessageStoreSizeStatTest.class);
@Rule
public TemporaryFolder dataFileDir = new TemporaryFolder(new File("target"));
File dataFileDir = new File("target/test-amq-5748/stat-datadb");
@Override
protected void setUpBroker(boolean clearDataDir) throws Exception {
if (clearDataDir && dataFileDir.getRoot().exists())
FileUtils.cleanDirectory(dataFileDir.getRoot());
if (clearDataDir && dataFileDir.exists())
FileUtils.cleanDirectory(dataFileDir);
super.setUpBroker(clearDataDir);
}
@ -56,7 +55,7 @@ public class KahaDBMessageStoreSizeStatTest extends
protected void initPersistence(BrokerService brokerService)
throws IOException {
broker.setPersistent(true);
broker.setDataDirectoryFile(dataFileDir.getRoot());
broker.setDataDirectoryFile(dataFileDir);
}
/**

View File

@ -28,9 +28,7 @@ import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.store.AbstractMessageStoreSizeStatTest;
import org.apache.commons.io.FileUtils;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -46,13 +44,12 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
protected static final Logger LOG = LoggerFactory
.getLogger(MultiKahaDBMessageStoreSizeStatTest.class);
@Rule
public TemporaryFolder dataFileDir = new TemporaryFolder(new File("target"));
File dataFileDir = new File("target/test-amq-5748/stat-datadb");
@Override
protected void setUpBroker(boolean clearDataDir) throws Exception {
if (clearDataDir && dataFileDir.getRoot().exists())
FileUtils.cleanDirectory(dataFileDir.getRoot());
if (clearDataDir && dataFileDir.exists())
FileUtils.cleanDirectory(dataFileDir);
super.setUpBroker(clearDataDir);
}
@ -63,7 +60,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
//setup multi-kaha adapter
MultiKahaDBPersistenceAdapter persistenceAdapter = new MultiKahaDBPersistenceAdapter();
persistenceAdapter.setDirectory(dataFileDir.getRoot());
persistenceAdapter.setDirectory(dataFileDir);
KahaDBPersistenceAdapter kahaStore = new KahaDBPersistenceAdapter();
kahaStore.setJournalMaxFileLength(1024 * 512);