Add more info to assert messages.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1506591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2013-07-24 15:13:53 +00:00
parent 02185be527
commit b4f880a75c
1 changed files with 14 additions and 11 deletions

View File

@ -16,6 +16,16 @@
*/
package org.apache.activemq.usecases;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.jms.Connection;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.Queue;
import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.TestSupport;
import org.apache.activemq.broker.BrokerService;
@ -34,11 +44,6 @@ import org.junit.runners.Parameterized;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.jms.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@RunWith(value = Parameterized.class)
public class MemoryLimitTest extends TestSupport {
private static final Logger LOG = LoggerFactory.getLogger(MemoryLimitTest.class);
@ -81,6 +86,7 @@ public class MemoryLimitTest extends TestSupport {
return broker;
}
@Override
@Before
public void setUp() throws Exception {
if (broker == null) {
@ -90,6 +96,7 @@ public class MemoryLimitTest extends TestSupport {
broker.waitUntilStarted();
}
@Override
@After
public void tearDown() throws Exception {
if (broker != null) {
@ -122,7 +129,8 @@ public class MemoryLimitTest extends TestSupport {
// assert we didn't break high watermark (70%) usage
Destination dest = broker.getDestination((ActiveMQQueue) queue);
LOG.info("Destination usage: " + dest.getMemoryUsage());
assertTrue(dest.getMemoryUsage().getPercentUsage() <= 71);
int percentUsage = dest.getMemoryUsage().getPercentUsage();
assertTrue("Should be less than 70% of limit but was: " + percentUsage, percentUsage <= 71);
LOG.info("Broker usage: " + broker.getSystemUsage().getMemoryUsage());
assertTrue(broker.getSystemUsage().getMemoryUsage().getPercentUsage() <= 71);
@ -145,13 +153,10 @@ public class MemoryLimitTest extends TestSupport {
assertNotNull("Didn't receive message " + i, msg);
msg.acknowledge();
}
}
/**
*
* Handy test for manually checking what's going on
*
*/
@Ignore
@Test(timeout = 120000)
@ -178,7 +183,6 @@ public class MemoryLimitTest extends TestSupport {
};
producer2.setMessageCount(1000);
ConsumerThread consumer = new ConsumerThread(sess, sess.createQueue("STORE.1"));
consumer.setBreakOnNull(false);
consumer.setMessageCount(1000);
@ -196,6 +200,5 @@ public class MemoryLimitTest extends TestSupport {
producer2.join();
assertEquals("consumer got all produced messages", producer.getMessageCount(), consumer.getReceived());
}
}