From caae68a1ba4ea8fb410e4d6b70dada870689ce54 Mon Sep 17 00:00:00 2001 From: gtully Date: Thu, 13 Mar 2014 16:27:35 +0000 Subject: [PATCH] compaction or gc can effect this test - make it more tolerant and dumpthreads on error so we can validate --- .../activemq/usecases/MemoryLimitTest.java | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java index e7b707b809..de9e11ce17 100644 --- a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java @@ -16,16 +16,12 @@ */ package org.apache.activemq.usecases; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - +import java.util.Arrays; 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; @@ -51,22 +47,12 @@ public class MemoryLimitTest extends TestSupport { final String payload = new String(new byte[10 * 1024]); //10KB protected BrokerService broker; - private final TestSupport.PersistenceAdapterChoice persistenceAdapterChoice; + @Parameterized.Parameter + public TestSupport.PersistenceAdapterChoice persistenceAdapterChoice; - @Parameterized.Parameters - public static Collection getTestParameters() { - TestSupport.PersistenceAdapterChoice[] kahaDb = {TestSupport.PersistenceAdapterChoice.KahaDB}; - TestSupport.PersistenceAdapterChoice[] levelDb = {TestSupport.PersistenceAdapterChoice.LevelDB}; - TestSupport.PersistenceAdapterChoice[] jdbc = {TestSupport.PersistenceAdapterChoice.JDBC}; - List choices = new ArrayList(); - choices.add(kahaDb); - choices.add(levelDb); - choices.add(jdbc); - return choices; - } - - public MemoryLimitTest(TestSupport.PersistenceAdapterChoice choice) { - this.persistenceAdapterChoice = choice; + @Parameterized.Parameters(name="{0}") + public static Iterable getTestParameters() { + return Arrays.asList(new Object[][]{{TestSupport.PersistenceAdapterChoice.KahaDB}, {PersistenceAdapterChoice.LevelDB}, {PersistenceAdapterChoice.JDBC}}); } protected BrokerService createBroker() throws Exception { @@ -155,7 +141,10 @@ public class MemoryLimitTest extends TestSupport { // let's make sure we can consume all messages for (int i = 1; i < 2000; i++) { - msg = consumer.receive(1000); + msg = consumer.receive(5000); + if (msg == null) { + dumpAllThreads("NoMessage"); + } assertNotNull("Didn't receive message " + i, msg); msg.acknowledge(); }