From deff26029f93f199ea8039d5135c5710f051d99e Mon Sep 17 00:00:00 2001 From: James Strachan Date: Mon, 22 May 2006 11:00:42 +0000 Subject: [PATCH] added another attempt to reproduce AMQ-715 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@408640 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/JmsSendReceiveTestSupport.java | 9 +++++ ...WithTwoConnectionsAndByteSelectorTest.java | 37 +++++++++++++++++++ ...opicSendReceiveWithTwoConnectionsTest.java | 8 +++- 3 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java index feb27b3219..8d969f35db 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsSendReceiveTestSupport.java @@ -112,6 +112,7 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis for (int i = 0; i < data.length; i++) { Message message = session.createTextMessage(data[i]); + configureMessage(message); if (verbose) { log.info("About to send a message: " + message + " with text: " + data[i]); } @@ -123,6 +124,14 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis log.info("" + data.length + " messages(s) received, closing down connections"); } + /** + * A hook to allow the message to be configured such as adding extra headers + * @throws JMSException + */ + protected void configureMessage(Message message) throws JMSException { + } + + /** * Waits to receive the messages and performs the test if all messages have been received and * are in sequential order. diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java new file mode 100644 index 0000000000..fe502af2c9 --- /dev/null +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest.java @@ -0,0 +1,37 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.test; + +import javax.jms.JMSException; +import javax.jms.Message; +import javax.jms.MessageConsumer; + +/** + * @version $Revision$ + */ +public class JmsTopicSendReceiveWithTwoConnectionsAndByteSelectorTest extends JmsTopicSendReceiveWithTwoConnectionsTest { + + + protected void configureMessage(Message message) throws JMSException { + message.setByteProperty("dummy", (byte) 33); + } + + protected MessageConsumer createConsumer() throws JMSException { + return receiveSession.createConsumer(consumerDestination, "dummy = 33", false); + } + +} \ No newline at end of file diff --git a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java index 6218c7e00b..5f410a73c9 100755 --- a/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java +++ b/activemq-core/src/test/java/org/apache/activemq/test/JmsTopicSendReceiveWithTwoConnectionsTest.java @@ -18,6 +18,8 @@ package org.apache.activemq.test; import javax.jms.Connection; import javax.jms.DeliveryMode; +import javax.jms.JMSException; +import javax.jms.MessageConsumer; import javax.jms.Session; import org.apache.activemq.ActiveMQConnectionFactory; @@ -82,11 +84,15 @@ public class JmsTopicSendReceiveWithTwoConnectionsTest extends JmsSendReceiveTes log.info("Created consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass()); log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); - consumer = receiveSession.createConsumer(consumerDestination); + consumer = createConsumer(); consumer.setMessageListener(this); log.info("Started connections"); } + + protected MessageConsumer createConsumer() throws JMSException { + return receiveSession.createConsumer(consumerDestination); + } /* * @see junit.framework.TestCase#tearDown()