mirror of https://github.com/apache/activemq.git
basic test case for https://issues.apache.org/activemq/browse/AMQ-1763 - but does not show the problem atm
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@790087 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f1907138b
commit
b97dbff52a
|
@ -17,10 +17,14 @@
|
||||||
package org.apache.activemq.broker.virtual;
|
package org.apache.activemq.broker.virtual;
|
||||||
|
|
||||||
import javax.jms.Connection;
|
import javax.jms.Connection;
|
||||||
|
import javax.jms.JMSException;
|
||||||
|
import javax.jms.Message;
|
||||||
import javax.jms.MessageConsumer;
|
import javax.jms.MessageConsumer;
|
||||||
import javax.jms.MessageProducer;
|
import javax.jms.MessageProducer;
|
||||||
import javax.jms.Session;
|
import javax.jms.Session;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
|
||||||
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
import org.apache.activemq.EmbeddedBrokerTestSupport;
|
||||||
import org.apache.activemq.command.ActiveMQQueue;
|
import org.apache.activemq.command.ActiveMQQueue;
|
||||||
import org.apache.activemq.command.ActiveMQTopic;
|
import org.apache.activemq.command.ActiveMQTopic;
|
||||||
|
@ -33,14 +37,35 @@ import org.apache.activemq.spring.ConsumerBean;
|
||||||
public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport {
|
public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport {
|
||||||
|
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
public int ackMode = Session.AUTO_ACKNOWLEDGE;
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
return suite(VirtualTopicPubSubTest.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void initCombosForTestVirtualTopicCreation() {
|
||||||
|
addCombinationValues("ackMode", new Object[] {new Integer(Session.AUTO_ACKNOWLEDGE), new Integer(Session.CLIENT_ACKNOWLEDGE) });
|
||||||
|
}
|
||||||
|
|
||||||
public void testVirtualTopicCreation() throws Exception {
|
public void testVirtualTopicCreation() throws Exception {
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
connection = createConnection();
|
connection = createConnection();
|
||||||
}
|
}
|
||||||
connection.start();
|
connection.start();
|
||||||
|
|
||||||
ConsumerBean messageList = new ConsumerBean();
|
ConsumerBean messageList = new ConsumerBean() {
|
||||||
|
public synchronized void onMessage(Message message) {
|
||||||
|
super.onMessage(message);
|
||||||
|
if (ackMode == Session.CLIENT_ACKNOWLEDGE) {
|
||||||
|
try {
|
||||||
|
message.acknowledge();
|
||||||
|
} catch (JMSException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
messageList.setVerbose(true);
|
messageList.setVerbose(true);
|
||||||
|
|
||||||
String queueAName = getVirtualTopicConsumerName();
|
String queueAName = getVirtualTopicConsumerName();
|
||||||
|
@ -48,7 +73,7 @@ public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport {
|
||||||
ActiveMQQueue queue1 = new ActiveMQQueue(queueAName);
|
ActiveMQQueue queue1 = new ActiveMQQueue(queueAName);
|
||||||
ActiveMQQueue queue2 = new ActiveMQQueue(queueAName);
|
ActiveMQQueue queue2 = new ActiveMQQueue(queueAName);
|
||||||
|
|
||||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
Session session = connection.createSession(false, ackMode);
|
||||||
MessageConsumer c1 = session.createConsumer(queue1);
|
MessageConsumer c1 = session.createConsumer(queue1);
|
||||||
MessageConsumer c2 = session.createConsumer(queue2);
|
MessageConsumer c2 = session.createConsumer(queue2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue