mirror of https://github.com/apache/activemq.git
apply patch for: https://issues.apache.org/jira/browse/AMQ-3954
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1367622 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
79bce92c33
commit
3eed779378
|
@ -59,10 +59,13 @@ public class JMSUsecaseTest extends JmsTestSupport {
|
|||
connection.start();
|
||||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
destination = createDestination(session, destinationType);
|
||||
sendMessages(session, destination, 5);
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
producer.setDeliveryMode(this.deliveryMode);
|
||||
sendMessages(session, producer, 5);
|
||||
producer.close();
|
||||
|
||||
QueueBrowser browser = session.createBrowser((Queue)destination);
|
||||
Enumeration enumeration = browser.getEnumeration();
|
||||
Enumeration<?> enumeration = browser.getEnumeration();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
Thread.sleep(100);
|
||||
assertTrue(enumeration.hasMoreElements());
|
||||
|
@ -85,6 +88,7 @@ public class JMSUsecaseTest extends JmsTestSupport {
|
|||
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
|
||||
destination = createDestination(session, destinationType);
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
producer.setDeliveryMode(this.deliveryMode);
|
||||
MessageConsumer consumer = session.createConsumer(destination);
|
||||
ActiveMQMessage message = new ActiveMQMessage();
|
||||
producer.send(message);
|
||||
|
@ -106,6 +110,7 @@ public class JMSUsecaseTest extends JmsTestSupport {
|
|||
Session session = connection.createSession(true, Session.SESSION_TRANSACTED);
|
||||
destination = createDestination(session, destinationType);
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
producer.setDeliveryMode(this.deliveryMode);
|
||||
MessageConsumer consumer = session.createConsumer(destination);
|
||||
producer.send(session.createTextMessage("test"));
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ import org.apache.activemq.command.ActiveMQDestination;
|
|||
|
||||
/**
|
||||
* Test cases used to test the JMS message consumer.
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class JmsTestSupport extends CombinationTestSupport {
|
||||
|
||||
|
@ -96,10 +96,14 @@ public class JmsTestSupport extends CombinationTestSupport {
|
|||
|
||||
protected void sendMessages(Session session, Destination destination, int count) throws JMSException {
|
||||
MessageProducer producer = session.createProducer(destination);
|
||||
sendMessages(session, producer, count);
|
||||
producer.close();
|
||||
}
|
||||
|
||||
protected void sendMessages(Session session, MessageProducer producer, int count) throws JMSException {
|
||||
for (int i = 0; i < count; i++) {
|
||||
producer.send(session.createTextMessage(messageTextPrefix + i));
|
||||
}
|
||||
producer.close();
|
||||
}
|
||||
|
||||
protected ConnectionFactory createConnectionFactory() throws Exception {
|
||||
|
@ -126,8 +130,8 @@ public class JmsTestSupport extends CombinationTestSupport {
|
|||
}
|
||||
|
||||
protected void tearDown() throws Exception {
|
||||
for (Iterator iter = connections.iterator(); iter.hasNext();) {
|
||||
Connection conn = (Connection)iter.next();
|
||||
for (Iterator<Connection> iter = connections.iterator(); iter.hasNext();) {
|
||||
Connection conn = iter.next();
|
||||
try {
|
||||
conn.close();
|
||||
} catch (Throwable e) {
|
||||
|
|
Loading…
Reference in New Issue