activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1506591 - /activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
Date Wed, 24 Jul 2013 15:13:53 GMT
Author: tabish
Date: Wed Jul 24 15:13:53 2013
New Revision: 1506591

URL: http://svn.apache.org/r1506591
Log:
Add more info to assert messages. 

Modified:
    activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java

Modified: activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java?rev=1506591&r1=1506590&r2=1506591&view=diff
==============================================================================
--- activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
(original)
+++ activemq/trunk/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/MemoryLimitTest.java
Wed Jul 24 15:13:53 2013
@@ -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 Tes
         return broker;
     }
 
+    @Override
     @Before
     public void setUp() throws Exception {
         if (broker == null) {
@@ -90,6 +96,7 @@ public class MemoryLimitTest extends Tes
         broker.waitUntilStarted();
     }
 
+    @Override
     @After
     public void tearDown() throws Exception {
         if (broker != null) {
@@ -122,7 +129,8 @@ public class MemoryLimitTest extends Tes
         // 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 Tes
             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 Tes
         };
         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 Tes
         producer2.join();
 
         assertEquals("consumer got all produced messages", producer.getMessageCount(), consumer.getReceived());
-
     }
 }



Mime
View raw message