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 2016/12/20 20:20:58 UTC

qpid-jms git commit: QPIDJMS-207 Fix some cases where QueueSession did not throw proper error

Repository: qpid-jms
Updated Branches:
  refs/heads/master 45dba0a39 -> ff7076ab5


QPIDJMS-207 Fix some cases where QueueSession did not throw proper error

The QueueSession needs to throw IllegalStateException for the new 2.0
create shared consumer methods

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

Branch: refs/heads/master
Commit: ff7076ab5ec10dc040af336bbb7a25b3b8cae554
Parents: 45dba0a
Author: Timothy Bish <ta...@gmail.com>
Authored: Tue Dec 20 15:20:41 2016 -0500
Committer: Timothy Bish <ta...@gmail.com>
Committed: Tue Dec 20 15:20:41 2016 -0500

----------------------------------------------------------------------
 .../org/apache/qpid/jms/JmsQueueSession.java    | 32 ++++++++++++++++++++
 .../qpid/jms/session/JmsQueueSessionTest.java   | 30 ++++++++++++++++++
 2 files changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/ff7076ab/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
index 4dba01f..7a314de 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/JmsQueueSession.java
@@ -144,4 +144,36 @@ public class JmsQueueSession extends JmsSession implements AutoCloseable {
     public TopicSubscriber createSubscriber(Topic topic, String messageSelector, boolean noLocal) throws JMSException {
         throw new IllegalStateException("Operation not supported by a QueueSession");
     }
+
+    /**
+     * @see javax.jms.Session#createSharedConsumer(javax.jms.Topic, java.lang.String)
+     */
+    @Override
+    public MessageConsumer createSharedConsumer(Topic topic, String name) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a QueueSession");
+    }
+
+    /**
+     * @see javax.jms.Session#createSharedConsumer(javax.jms.Topic, java.lang.String, java.lang.String)
+     */
+    @Override
+    public MessageConsumer createSharedConsumer(Topic topic, String name, String selector) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a QueueSession");
+    }
+
+    /**
+     * @see javax.jms.Session#createSharedDurableConsumer(javax.jms.Topic, java.lang.String)
+     */
+    @Override
+    public MessageConsumer createSharedDurableConsumer(Topic topic, String name) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a QueueSession");
+    }
+
+    /**
+     * @see javax.jms.Session#createSharedDurableConsumer(javax.jms.Topic, java.lang.String, java.lang.String)
+     */
+    @Override
+    public MessageConsumer createSharedDurableConsumer(Topic topic, String name, String selector) throws JMSException {
+        throw new IllegalStateException("Operation not supported by a QueueSession");
+    }
 }

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/ff7076ab/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
index bf68173..8ad18c3 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/session/JmsQueueSessionTest.java
@@ -134,6 +134,36 @@ public class JmsQueueSessionTest extends JmsConnectionTestSupport {
         queueSession.createDurableSubscriber(topic, "subscriptionName", "color = red", false);
     }
 
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateDurableConsumerOnQueueSession() throws JMSException {
+        queueSession.createDurableConsumer(topic, "subscriptionName");
+    }
+
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateDurableConsumerWithSelectorOnQueueSession() throws JMSException {
+        queueSession.createDurableConsumer(topic, "subscriptionName", "color = red", false);
+    }
+
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateSharedConsumerOnQueueSession() throws JMSException {
+        queueSession.createSharedConsumer(topic, "subscriptionName");
+    }
+
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateSharedConsumerWithSelectorOnQueueSession() throws JMSException {
+        queueSession.createSharedConsumer(topic, "subscriptionName", "color = red");
+    }
+
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateSharedDurableConsumerOnQueueSession() throws JMSException {
+        queueSession.createSharedDurableConsumer(topic, "subscriptionName");
+    }
+
+    @Test(timeout = 30000, expected=IllegalStateException.class)
+    public void testCreateSharedDurableConsumerWithSelectorOnQueueSession() throws JMSException {
+        queueSession.createSharedConsumer(topic, "subscriptionName", "color = red");
+    }
+
     /**
      * Test that a call to <code>createTemporaryTopic()</code> method
      * on a <code>QueueSession</code> throws a


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