qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject qpid-jms git commit: Add an additional QueueBrowser test
Date Wed, 01 Apr 2015 21:52:48 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 9db79b954 -> 305a5a0ec


Add an additional QueueBrowser test

Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/305a5a0e
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/305a5a0e
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/305a5a0e

Branch: refs/heads/master
Commit: 305a5a0ecb38955f8c8f1fd70756cb5aff74ee39
Parents: 9db79b9
Author: Timothy Bish <tabish121@gmail.com>
Authored: Wed Apr 1 17:51:32 2015 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Wed Apr 1 17:51:32 2015 -0400

----------------------------------------------------------------------
 .../qpid/jms/consumer/JmsQueueBrowserTest.java  | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/305a5a0e/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
index dde6451..af23365 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
@@ -19,13 +19,17 @@ package org.apache.qpid.jms.consumer;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.util.Enumeration;
 
 import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
 import javax.jms.Queue;
 import javax.jms.QueueBrowser;
 import javax.jms.Session;
+import javax.jms.TextMessage;
 
 import org.apache.activemq.broker.jmx.QueueViewMBean;
 import org.apache.qpid.jms.JmsConnection;
@@ -80,6 +84,33 @@ public class JmsQueueBrowserTest extends AmqpTestSupport {
     }
 
     @SuppressWarnings("rawtypes")
+    @Test(timeout=30000)
+    public void testBroseOneInQueue() throws Exception {
+        connection = createAmqpConnection();
+        connection.start();
+
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        Queue queue = session.createQueue(getDestinationName());
+        MessageProducer producer = session.createProducer(queue);
+        producer.send(session.createTextMessage("hello"));
+        producer.close();
+
+        QueueBrowser browser = session.createBrowser(queue);
+        Enumeration enumeration = browser.getEnumeration();
+        while (enumeration.hasMoreElements()) {
+            Message m = (Message) enumeration.nextElement();
+            assertTrue(m instanceof TextMessage);
+        }
+
+        browser.close();
+
+        MessageConsumer consumer = session.createConsumer(queue);
+        Message msg = consumer.receive(5000);
+        assertNotNull(msg);
+        assertTrue(msg instanceof TextMessage);
+    }
+
+    @SuppressWarnings("rawtypes")
     @Test(timeout = 60000)
     public void testBrowseAllInQueue() throws Exception {
         connection = createAmqpConnection();


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message