qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject [1/3] git commit: Tests for stat exception thrown when connection is closed.
Date Thu, 16 Oct 2014 22:55:29 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master 0b4311225 -> ec13a0d50


Tests for stat exception thrown when connection is closed.

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

Branch: refs/heads/master
Commit: 49db0e5e84f11274c55c7dfb7ee6f30bacbb1d4f
Parents: 0b43112
Author: Timothy Bish <tabish121@gmail.com>
Authored: Thu Oct 16 14:51:09 2014 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Thu Oct 16 14:51:09 2014 -0400

----------------------------------------------------------------------
 .../org/apache/qpid/jms/JmsConnectionTest.java  | 68 ++++++++++++++++++++
 1 file changed, 68 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/49db0e5e/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTest.java b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTest.java
index 841fd51..4f50a37 100644
--- a/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTest.java
+++ b/qpid-jms-client/src/test/java/org/apache/qpid/jms/JmsConnectionTest.java
@@ -25,6 +25,7 @@ import java.io.IOException;
 import java.net.URI;
 
 import javax.jms.JMSException;
+import javax.jms.Session;
 
 import org.apache.qpid.jms.message.JmsInboundMessageDispatch;
 import org.apache.qpid.jms.meta.JmsConnectionInfo;
@@ -134,4 +135,71 @@ public class JmsConnectionTest {
         connection.start();
         assertTrue(connection.isConnected());
     }
+
+    //---------- Test methods fail after connection closed -------------------//
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testSetClientIdAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.setClientID("test-Id");
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testStartCalledAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.start();
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testStopCalledAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.stop();
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testSetExceptionListenerAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.setExceptionListener(null);
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testFetExceptionListenerAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.getExceptionListener();
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testCreateConnectionConsumerForTopicAfterClose() throws JMSException {
+        JmsDestination destination = new JmsTopic("test");
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.createConnectionConsumer(destination, null, null, 0);
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testCreateConnectionConsumerForQueueAfterClose() throws JMSException {
+        JmsDestination destination = new JmsQueue("test");
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.createConnectionConsumer(destination, null, null, 0);
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testCreateTopicSessionAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
+    }
+
+    @Test(expected=javax.jms.IllegalStateException.class)
+    public void testCreateQueueSessionAfterClose() throws JMSException {
+        JmsConnection connection = new JmsConnection("ID:TEST:1", provider, clientIdGenerator);
+        connection.close();
+        connection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+    }
 }


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


Mime
View raw message