activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1365816 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/ActiveMQConnection.java main/java/org/apache/activemq/ActiveMQConnectionFactory.java test/java/org/apache/activemq/joramtests/JoramJmsTest.java
Date Wed, 25 Jul 2012 22:04:34 GMT
Author: tabish
Date: Wed Jul 25 22:04:34 2012
New Revision: 1365816

URL: http://svn.apache.org/viewvc?rev=1365816&view=rev
Log:
fix test case UnifiedSessionTest for: https://issues.apache.org/jira/browse/AMQ-3944

ActiveMQConnection had no way to tell if it was a QueueConnection or not.  

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java?rev=1365816&r1=1365815&r2=1365816&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnection.java
Wed Jul 25 22:04:34 2012
@@ -154,6 +154,7 @@ public class ActiveMQConnection implemen
     private int sendTimeout =0;
     private boolean sendAcksAsync=true;
     private boolean checkForDuplicates = true;
+    private boolean queueOnlyConnection = false;
 
     private final Transport transport;
     private final IdGenerator clientIdGenerator;
@@ -780,6 +781,11 @@ public class ActiveMQConnection implemen
     public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String subscriptionName,
String messageSelector, ServerSessionPool sessionPool, int maxMessages,
                                                               boolean noLocal) throws JMSException
{
         checkClosedOrFailed();
+
+        if (queueOnlyConnection) {
+            throw new IllegalStateException("QueueConnection cannot be used to create Pub/Sub
based resources.");
+        }
+
         ensureConnectionInfoSent();
         SessionId sessionId = new SessionId(info.getConnectionId(), -1);
         ConsumerInfo info = new ConsumerInfo(new ConsumerId(sessionId, consumerIdGenerator.getNextSequenceId()));
@@ -2579,4 +2585,14 @@ public class ActiveMQConnection implemen
     public void setMaxThreadPoolSize(int maxThreadPoolSize) {
         this.maxThreadPoolSize = maxThreadPoolSize;
     }
+
+    /**
+     * Enable enforcement of QueueConnection semantics.
+     *
+     * @return this object, useful for chaining
+     */
+    ActiveMQConnection enforceQueueOnlyConnection() {
+        this.queueOnlyConnection = true;
+        return this;
+    }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java?rev=1365816&r1=1365815&r2=1365816&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java
Wed Jul 25 22:04:34 2012
@@ -205,14 +205,14 @@ public class ActiveMQConnectionFactory e
      * @throws JMSException
      */
     public QueueConnection createQueueConnection() throws JMSException {
-        return createActiveMQConnection();
+        return createActiveMQConnection().enforceQueueOnlyConnection();
     }
 
     /**
      * @return Returns the QueueConnection.
      */
     public QueueConnection createQueueConnection(String userName, String password) throws
JMSException {
-        return createActiveMQConnection(userName, password);
+        return createActiveMQConnection(userName, password).enforceQueueOnlyConnection();
     }
 
     /**

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java?rev=1365816&r1=1365815&r2=1365816&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/joramtests/JoramJmsTest.java
Wed Jul 25 22:04:34 2012
@@ -19,6 +19,7 @@ package org.apache.activemq.joramtests;
 import junit.framework.Test;
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
+
 import org.objectweb.jtests.jms.conform.connection.ConnectionTest;
 import org.objectweb.jtests.jms.conform.connection.TopicConnectionTest;
 import org.objectweb.jtests.jms.conform.message.MessageBodyTest;
@@ -27,11 +28,8 @@ import org.objectweb.jtests.jms.conform.
 import org.objectweb.jtests.jms.conform.message.headers.MessageHeaderTest;
 import org.objectweb.jtests.jms.conform.message.properties.JMSXPropertyTest;
 import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyConversionTest;
-import org.objectweb.jtests.jms.conform.message.properties.MessagePropertyTest;
-import org.objectweb.jtests.jms.conform.queue.QueueBrowserTest;
 import org.objectweb.jtests.jms.conform.queue.TemporaryQueueTest;
 import org.objectweb.jtests.jms.conform.selector.SelectorSyntaxTest;
-import org.objectweb.jtests.jms.conform.selector.SelectorTest;
 import org.objectweb.jtests.jms.conform.session.QueueSessionTest;
 import org.objectweb.jtests.jms.conform.session.SessionTest;
 import org.objectweb.jtests.jms.conform.session.TopicSessionTest;
@@ -59,11 +57,11 @@ public class JoramJmsTest extends TestCa
         suite.addTestSuite(SessionTest.class);
         suite.addTestSuite(TopicSessionTest.class);
         suite.addTestSuite(TemporaryTopicTest.class);
+        suite.addTestSuite(UnifiedSessionTest.class);
 // TODO: figure out why the following tests are failing..
 //        suite.addTestSuite(MessagePropertyTest.class);
 //        suite.addTestSuite(QueueBrowserTest.class);
 //        suite.addTestSuite(SelectorTest.class);
-//        suite.addTestSuite(UnifiedSessionTest.class);
         return suite;
     }
 



Mime
View raw message