Author: clebert.suconic(a)jboss.com
Date: 2011-04-08 16:22:53 -0400 (Fri, 08 Apr 2011)
New Revision: 10473
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java
Log:
just an additional test. I wrote this test to validate an user's telling me about a
bug that didn't really exist. So, why not commit it? There's never enough tests.
Modified:
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java
===================================================================
---
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java 2011-04-08
13:16:19 UTC (rev 10472)
+++
branches/Branch_2_2_EAP/tests/src/org/hornetq/tests/integration/client/MessagePriorityTest.java 2011-04-08
20:22:53 UTC (rev 10473)
@@ -17,12 +17,16 @@
import org.hornetq.api.core.SimpleString;
import org.hornetq.api.core.TransportConfiguration;
-import org.hornetq.api.core.client.*;
+import org.hornetq.api.core.client.ClientConsumer;
+import org.hornetq.api.core.client.ClientMessage;
+import org.hornetq.api.core.client.ClientProducer;
+import org.hornetq.api.core.client.ClientSession;
+import org.hornetq.api.core.client.ClientSessionFactory;
+import org.hornetq.api.core.client.HornetQClient;
+import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.core.config.Configuration;
-import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
-import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.core.server.HornetQServers;
import org.hornetq.tests.util.RandomUtil;
@@ -264,6 +268,60 @@
}
+ public void testManyMessages() throws Exception
+ {
+ SimpleString queue = RandomUtil.randomSimpleString();
+ SimpleString address = RandomUtil.randomSimpleString();
+
+ session.createQueue(address, queue, false);
+
+ ClientProducer producer = session.createProducer(address);
+
+ for (int i = 0 ; i < 777; i++)
+ {
+ ClientMessage msg = session.createMessage(true);
+ msg.setPriority((byte)5);
+ msg.putBooleanProperty("fast", false);
+ producer.send(msg);
+ }
+
+ for (int i = 0 ; i < 333; i++)
+ {
+ ClientMessage msg = session.createMessage(true);
+ msg.setPriority((byte)6);
+ msg.putBooleanProperty("fast", true);
+ producer.send(msg);
+ }
+
+ ClientConsumer consumer = session.createConsumer(queue);
+
+ session.start();
+
+
+ for (int i = 0 ; i < 333; i++)
+ {
+ ClientMessage msg = consumer.receive(5000);
+ assertNotNull(msg);
+ msg.acknowledge();
+ assertTrue(msg.getBooleanProperty("fast"));
+ }
+
+ for (int i = 0 ; i < 777; i++)
+ {
+ ClientMessage msg = consumer.receive(5000);
+ assertNotNull(msg);
+ msg.acknowledge();
+ assertFalse(msg.getBooleanProperty("fast"));
+ }
+
+ consumer.close();
+
+ session.deleteQueue(queue);
+
+ session.close();
+ }
+
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------