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: Need to check for opened but with null Target which indicates the remote will close with error. Add ActiveMQ tests.
Date Fri, 06 Mar 2015 19:49:09 GMT
Repository: qpid-jms
Updated Branches:
  refs/heads/master fe0c416d3 -> 96917fde6


Need to check for opened but with null Target which indicates the remote
will close with error.  Add ActiveMQ tests.

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

Branch: refs/heads/master
Commit: 96917fde65c13ea46b0ac7ea5ef7c61a30e322d0
Parents: fe0c416
Author: Timothy Bish <tabish121@gmail.com>
Authored: Fri Mar 6 14:49:00 2015 -0500
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Fri Mar 6 14:49:00 2015 -0500

----------------------------------------------------------------------
 .../provider/amqp/AmqpTemporaryDestination.java | 11 ++++++++++
 .../apache/qpid/jms/session/JmsSessionTest.java | 22 ++++++++++++++++++++
 2 files changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/96917fde/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
----------------------------------------------------------------------
diff --git a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
index 1f2155b..eaa4a7e 100644
--- a/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
+++ b/qpid-jms-client/src/main/java/org/apache/qpid/jms/provider/amqp/AmqpTemporaryDestination.java
@@ -123,6 +123,17 @@ public class AmqpTemporaryDestination extends AmqpAbstractResource<JmsTemporaryD
     }
 
     @Override
+    protected void doOpenCompletion() {
+        // Verify the attach response contained a non-null target
+        org.apache.qpid.proton.amqp.transport.Target t = getEndpoint().getRemoteTarget();
+        if (t != null) {
+            super.doOpenCompletion();
+        } else {
+            // No link terminus was created, the peer will now detach/close us.
+        }
+    }
+
+    @Override
     protected void doClose() {
         this.connection.removeTemporaryDestination(this);
 

http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/96917fde/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
----------------------------------------------------------------------
diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
index 375271a..7f23a90 100644
--- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
+++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/session/JmsSessionTest.java
@@ -23,6 +23,7 @@ import static org.junit.Assert.fail;
 
 import java.util.concurrent.TimeUnit;
 
+import javax.jms.JMSSecurityException;
 import javax.jms.MessageConsumer;
 import javax.jms.MessageProducer;
 import javax.jms.Queue;
@@ -135,6 +136,16 @@ public class JmsSessionTest extends AmqpTestSupport {
         assertEquals(1, broker.getTemporaryQueues().length);
     }
 
+    @Test(timeout=30000)
+    public void testCreateTemporaryQueueNotAuthorized() throws Exception {
+        connection = createAmqpConnection("guest", "password");
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        try {
+            session.createTemporaryQueue();
+            fail("Should have thrown a security exception");
+        } catch (JMSSecurityException jmsse) {}
+    }
+
     @Ignore("Delete of Temporary destinations not yet supported.")
     @Test(timeout=30000)
     public void testDeleteTemporaryQueue() throws Exception {
@@ -174,6 +185,17 @@ public class JmsSessionTest extends AmqpTestSupport {
 
     @Ignore("Temporary Topics not supported in AMQ yet.")
     @Test(timeout=30000)
+    public void testCreateTemporaryTopicNotAuthorized() throws Exception {
+        connection = createAmqpConnection("guest", "password");
+        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+        try {
+            session.createTemporaryTopic();
+            fail("Should have thrown a security exception");
+        } catch (JMSSecurityException jmsse) {}
+    }
+
+    @Ignore("Temporary Topics not supported in AMQ yet.")
+    @Test(timeout=30000)
     public void testDeleteTemporaryTopic() throws Exception {
         connection = createAmqpConnection();
         Session session = connection.createSession(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