Adds a test for anonymous Producers

This commit is contained in:
Timothy Bish 2014-03-06 12:39:30 -05:00
parent 52a2733535
commit f555d90e92
1 changed files with 34 additions and 1 deletions

View File

@ -49,7 +49,6 @@ import org.apache.activemq.util.Wait;
import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@ -108,6 +107,40 @@ public class JMSClientTest extends AmqpTestSupport {
connection.close();
}
@Test(timeout=30000)
public void testAnonymousProducerConsume() throws Exception {
ActiveMQAdmin.enableJMSFrameTracing();
Connection connection = createConnection();
{
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
Queue queue1 = session.createQueue(name.toString() + "1");
Queue queue2 = session.createQueue(name.toString() + "2");
MessageProducer p = session.createProducer(null);
TextMessage message = session.createTextMessage();
message.setText("hello");
p.send(queue1, message);
p.send(queue2, message);
{
MessageConsumer consumer = session.createConsumer(queue1);
Message msg = consumer.receive(TestConfig.TIMEOUT);
assertNotNull(msg);
assertTrue(msg instanceof TextMessage);
consumer.close();
}
{
MessageConsumer consumer = session.createConsumer(queue2);
Message msg = consumer.receive(TestConfig.TIMEOUT);
assertNotNull(msg);
assertTrue(msg instanceof TextMessage);
consumer.close();
}
}
connection.close();
}
@Test
public void testTransactedConsumer() throws Exception {
ActiveMQAdmin.enableJMSFrameTracing();