mirror of https://github.com/apache/activemq.git
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. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1365816 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
83760fdcd0
commit
6da702be23
|
@ -154,6 +154,7 @@ public class ActiveMQConnection implements Connection, TopicConnection, QueueCon
|
|||
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 implements Connection, TopicConnection, QueueCon
|
|||
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 implements Connection, TopicConnection, QueueCon
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,14 +205,14 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne
|
|||
* @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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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.message.MessageTypeTest;
|
|||
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 TestCase {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue