Adding logging to help debug test failures

https://issues.apache.org/jira/browse/AMQ-5923
This commit is contained in:
Christopher L. Shannon (cshannon) 2015-09-11 11:33:28 +00:00
parent fe34a61c3a
commit 226222546a
5 changed files with 28 additions and 15 deletions

View File

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

View File

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

View File

@ -45,10 +45,13 @@ import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.broker.BrokerService;
import org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean;
import org.apache.activemq.broker.region.Destination;
import org.apache.activemq.broker.region.cursors.AbstractPendingMessageCursorTest;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
@ -56,6 +59,9 @@ import org.apache.activemq.command.ActiveMQTopic;
*/
public abstract class AbstractStoreStatTestSupport {
protected static final Logger LOG = LoggerFactory
.getLogger(AbstractStoreStatTestSupport.class);
protected static int defaultMessageSize = 1000;
protected abstract BrokerService getBroker();
@ -173,6 +179,7 @@ public abstract class AbstractStoreStatTestSupport {
MessageProducer prod = session.createProducer(queue);
prod.setDeliveryMode(deliveryMode);
for (int i = 0; i < count; i++) {
LOG.info("Publishing message: " + i + ", size: " + messageSize);
prod.send(createMessage(session, messageSize, publishedMessageSize));
}
@ -223,6 +230,7 @@ public abstract class AbstractStoreStatTestSupport {
MessageProducer prod = session.createProducer(topic);
prod.setDeliveryMode(deliveryMode);
for (int i = 0; i < publishSize; i++) {
LOG.info("Publishing message: " + i + ", size: " + messageSize);
prod.send(createMessage(session, messageSize, publishedMessageSize));
}

View File

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

View File

@ -28,7 +28,9 @@ 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;
@ -44,12 +46,13 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
protected static final Logger LOG = LoggerFactory
.getLogger(MultiKahaDBMessageStoreSizeStatTest.class);
File dataFileDir = new File("target/test-amq-5748/stat-datadb");
@Rule
public TemporaryFolder dataFileDir = new TemporaryFolder(new File("target"));
@Override
protected void setUpBroker(boolean clearDataDir) throws Exception {
if (clearDataDir && dataFileDir.exists())
FileUtils.cleanDirectory(dataFileDir);
if (clearDataDir && dataFileDir.getRoot().exists())
FileUtils.cleanDirectory(dataFileDir.getRoot());
super.setUpBroker(clearDataDir);
}
@ -60,7 +63,7 @@ public class MultiKahaDBMessageStoreSizeStatTest extends
//setup multi-kaha adapter
MultiKahaDBPersistenceAdapter persistenceAdapter = new MultiKahaDBPersistenceAdapter();
persistenceAdapter.setDirectory(dataFileDir);
persistenceAdapter.setDirectory(dataFileDir.getRoot());
KahaDBPersistenceAdapter kahaStore = new KahaDBPersistenceAdapter();
kahaStore.setJournalMaxFileLength(1024 * 512);