You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ta...@apache.org on 2015/01/31 01:01:42 UTC

qpid-jms git commit: Adds a start on a QueueBrowser test.

Repository: qpid-jms
Updated Branches:
  refs/heads/master bb5ddbace -> dd8a0adf4


Adds a start on a 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/dd8a0adf
Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/dd8a0adf
Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/dd8a0adf

Branch: refs/heads/master
Commit: dd8a0adf488d3d28688ab09ed39ad5503db30bd8
Parents: bb5ddba
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Jan 30 19:01:30 2015 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Jan 30 19:01:30 2015 -0500

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


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/dd8a0adf/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
new file mode 100644
index 0000000..f02a79a
--- /dev/null
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/consumer/JmsQueueBrowserTest.java
@@ -0,0 +1,62 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.qpid.jms.consumer;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import javax.jms.Queue;
+import javax.jms.QueueBrowser;
+import javax.jms.Session;
+
+import org.apache.qpid.jms.JmsConnectionTestSupport;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Test basic contract of QueueBroser implementation.
+ */
+public class JmsQueueBrowserTest extends JmsConnectionTestSupport {
+
+    protected Session session;
+    protected Queue queue;
+    protected QueueBrowser browser;
+
+    @Override
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        connection = createConnectionToMockProvider();
+        session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        queue = session.createQueue(_testName.getMethodName());
+        browser = session.createBrowser(queue);
+    }
+
+    @Test(timeout = 30000)
+    public void testCreateBrowser() throws Exception {
+        QueueBrowser browser = session.createBrowser(queue);
+        assertEquals(queue, browser.getQueue());
+        assertNull(browser.getMessageSelector());
+    }
+
+    @Test(timeout = 30000)
+    public void testCreateBrowserAndCloseTwice() throws Exception {
+        browser = session.createBrowser(queue);
+        browser.close();
+        browser.close();  // Should not throw on multiple close.
+    }
+}


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