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
This commit is contained in:
James Strachan 2006-05-22 11:00:42 +00:00
parent c172b50ccc
commit deff26029f
3 changed files with 53 additions and 1 deletions

View File

@ -112,6 +112,7 @@ public class JmsSendReceiveTestSupport extends TestSupport implements MessageLis
for (int i = 0; i < data.length; i++) { for (int i = 0; i < data.length; i++) {
Message message = session.createTextMessage(data[i]); Message message = session.createTextMessage(data[i]);
configureMessage(message);
if (verbose) { if (verbose) {
log.info("About to send a message: " + message + " with text: " + data[i]); 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"); 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 * Waits to receive the messages and performs the test if all messages have been received and
* are in sequential order. * are in sequential order.

View File

@ -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);
}
}

View File

@ -18,6 +18,8 @@ package org.apache.activemq.test;
import javax.jms.Connection; import javax.jms.Connection;
import javax.jms.DeliveryMode; import javax.jms.DeliveryMode;
import javax.jms.JMSException;
import javax.jms.MessageConsumer;
import javax.jms.Session; import javax.jms.Session;
import org.apache.activemq.ActiveMQConnectionFactory; 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 consumer destination: " + consumerDestination + " of type: " + consumerDestination.getClass());
log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass()); log.info("Created producer destination: " + producerDestination + " of type: " + producerDestination.getClass());
consumer = receiveSession.createConsumer(consumerDestination); consumer = createConsumer();
consumer.setMessageListener(this); consumer.setMessageListener(this);
log.info("Started connections"); log.info("Started connections");
} }
protected MessageConsumer createConsumer() throws JMSException {
return receiveSession.createConsumer(consumerDestination);
}
/* /*
* @see junit.framework.TestCase#tearDown() * @see junit.framework.TestCase#tearDown()