@Before
public void init() throws JMSException, NamingException {
Context context = new InitialContext();
conFactiory = (ConnectionFactory) context.lookup(CONNECTION_FACTORY_NAME);
conn=conFactiory.createConnection();
session=conn.createSession(false,Session.AUTO_ACKNOWLEDGE);
conn.start();
}
@Test
public void testTextMessageQueue() throws JMSException, InterruptedException {
Destination queue=session.createQueue(TEST_QUEUE);
MessageProducer producer=session.createProducer(queue);
System.out.println("Here1");
Message m=session.createTextMessage(Helper.createDataSize(1024));
System.out.println("Here2");
producer.send(m);
System.out.println("Here3");
Thread.sleep(10 *1000);
MessageConsumer consumer=session.createConsumer(queue);
System.out.println(LOG_MESSAGE+" Queue tests, receiving messages");
Message message = consumer.receive(5000);
Assert.assertNotNull(message);
}
@Test
public void testTextMessageQueue() throws JMSException, InterruptedException {
Destination queue=session.createQueue(TEST_QUEUE);
MessageProducer producer=session.createProducer(queue);
Message m=session.createTextMessage(Helper.createTextMessage(1024));
producer.send(m);
Thread.sleep(10 *1000);
MessageConsumer consumer=session.createConsumer(queue);
System.out.println(LOG_MESSAGE+" Queue tests, receiving messages");
Message message = consumer.receive(5000);
Assert.assertNotNull(message);
}