mirror of https://github.com/apache/activemq.git
Added a test to the QueueBrowser to browse "large number of messages (1000)"
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1439420 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9988fff773
commit
8e6ce9f7d7
|
@ -25,6 +25,7 @@ import javax.jms.MessageProducer;
|
|||
import javax.jms.Queue;
|
||||
import javax.jms.QueueBrowser;
|
||||
import javax.jms.Session;
|
||||
import javax.jms.Connection;
|
||||
import javax.jms.TextMessage;
|
||||
import javax.management.ObjectName;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
|
@ -304,6 +305,36 @@ public class JmsQueueBrowserTest extends JmsTestSupport {
|
|||
|
||||
}
|
||||
|
||||
public void testLargeNumberOfMessages() throws Exception {
|
||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
ActiveMQQueue destination = new ActiveMQQueue("TEST");
|
||||
connection.start();
|
||||
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
producer.send(session.createTextMessage("Message: " + i));
|
||||
}
|
||||
|
||||
QueueBrowser browser = session.createBrowser(destination);
|
||||
Enumeration enumeration = browser.getEnumeration();
|
||||
|
||||
assertTrue(enumeration.hasMoreElements());
|
||||
|
||||
int numberBrowsed = 0;
|
||||
|
||||
while (enumeration.hasMoreElements()) {
|
||||
enumeration.nextElement();
|
||||
numberBrowsed++;
|
||||
}
|
||||
|
||||
System.out.println("Number browsed: " + numberBrowsed);
|
||||
assertEquals(1000, numberBrowsed);
|
||||
browser.close();
|
||||
producer.close();
|
||||
|
||||
}
|
||||
|
||||
public void testQueueBrowserWith2Consumers() throws Exception {
|
||||
final int numMessages = 1000;
|
||||
connection.setAlwaysSyncSend(false);
|
||||
|
|
Loading…
Reference in New Issue