Commit 6db2eb16 authored by afreyssin's avatar afreyssin

Use simple queues rather than deprecated DMQueue.

parent d5bd28be
......@@ -29,7 +29,6 @@ import javax.jms.ConnectionFactory;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
......@@ -37,7 +36,7 @@ import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.DeadMQueue;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import org.objectweb.joram.shared.MessageErrorConstants;
......@@ -72,12 +71,12 @@ public class ChainedDMQ extends TestCase {
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
DeadMQueue dmqueue0 = (DeadMQueue) ictx.lookup("dmqueue0");
DeadMQueue dmqueue1 = (DeadMQueue) ictx.lookup("dmqueue1");
DeadMQueue dmqueue2 = (DeadMQueue) ictx.lookup("dmqueue2");
DeadMQueue dmqueue3 = (DeadMQueue) ictx.lookup("dmqueue3");
DeadMQueue dmqueue4 = (DeadMQueue) ictx.lookup("dmqueue4");
DeadMQueue dmqueue5 = (DeadMQueue) ictx.lookup("dmqueue5");
Queue dmqueue0 = (Queue) ictx.lookup("dmqueue0");
Queue dmqueue1 = (Queue) ictx.lookup("dmqueue1");
Queue dmqueue2 = (Queue) ictx.lookup("dmqueue2");
Queue dmqueue3 = (Queue) ictx.lookup("dmqueue3");
Queue dmqueue4 = (Queue) ictx.lookup("dmqueue4");
Queue dmqueue5 = (Queue) ictx.lookup("dmqueue5");
ConnectionFactory cf0 = (ConnectionFactory) ictx.lookup("cf0");
ictx.close();
......@@ -205,27 +204,41 @@ public class ChainedDMQ extends TestCase {
* Admin : Create queue and a user anonymous use jndi
*/
public void admin() throws Exception {
Properties prop = new Properties();
prop.setProperty("period", "1000");
// connection
AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue = org.objectweb.joram.client.jms.Queue.create(0, prop);
// create a DMQueue
DeadMQueue dmqueue0 = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmqueue1 = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmqueue2 = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmqueue3 = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmqueue4 = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmqueue5 = (DeadMQueue) DeadMQueue.create(0);
queue.setFreeReading();
queue.setFreeWriting();
// create DMQs
Queue dmqueue0 = (Queue) Queue.create(0);
dmqueue0.setFreeReading();
dmqueue0.setFreeWriting();
dmqueue0.setNbMaxMsg(DMQ0_MAX_SIZE);
Queue dmqueue1 = (Queue) Queue.create(0);
dmqueue1.setFreeReading();
dmqueue1.setFreeWriting();
dmqueue1.setNbMaxMsg(DMQ1_MAX_SIZE);
Queue dmqueue2 = (Queue) Queue.create(0);
dmqueue2.setFreeReading();
dmqueue2.setFreeWriting();
dmqueue2.setNbMaxMsg(DMQ2_MAX_SIZE);
Queue dmqueue3 = (Queue) Queue.create(0);
dmqueue3.setFreeReading();
dmqueue3.setFreeWriting();
dmqueue3.setNbMaxMsg(DMQ3_MAX_SIZE);
Queue dmqueue4 = (Queue) Queue.create(0);
dmqueue4.setFreeReading();
dmqueue4.setFreeWriting();
dmqueue4.setNbMaxMsg(DMQ4_MAX_SIZE);
Queue dmqueue5 = (Queue) Queue.create(0);
dmqueue5.setFreeReading();
dmqueue5.setFreeWriting();
dmqueue0.setDMQ(dmqueue1);
dmqueue1.setDMQ(dmqueue2);
......@@ -233,19 +246,10 @@ public class ChainedDMQ extends TestCase {
dmqueue3.setDMQ(dmqueue4);
dmqueue4.setDMQ(dmqueue5);
queue.setDMQ(dmqueue0);
// create a user
org.objectweb.joram.client.jms.admin.User.create("anonymous", "anonymous", 0);
// set permissions
queue.setFreeReading();
queue.setFreeWriting();
dmqueue0.setFreeReading();
dmqueue1.setFreeReading();
dmqueue2.setFreeReading();
dmqueue3.setFreeReading();
dmqueue4.setFreeReading();
dmqueue5.setFreeReading();
queue.setDMQ(dmqueue0);
ConnectionFactory cf0 = TcpConnectionFactory.create("localhost", 2560);
......
......@@ -26,14 +26,15 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.admin.DeadMQueue;
import org.objectweb.joram.client.jms.Queue;
import org.objectweb.joram.client.jms.Topic;
import org.objectweb.joram.client.jms.admin.User;
import org.objectweb.joram.client.jms.tcp.TcpConnectionFactory;
import framework.TestCase;
......@@ -45,7 +46,6 @@ import framework.TestCase;
*/
public class TestDmq1 extends TestCase {
public static void main(String[] args) {
new TestDmq1().run();
}
......@@ -61,8 +61,8 @@ public class TestDmq1 extends TestCase {
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
Topic topic = (Topic) ictx.lookup("topic");
DeadMQueue dmq =(DeadMQueue) ictx.lookup("dmq");
DeadMQueue dmq1 =(DeadMQueue) ictx.lookup("dmq1");
Queue dmq =(Queue) ictx.lookup("dmq");
Queue dmq1 =(Queue) ictx.lookup("dmq1");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
......@@ -83,39 +83,46 @@ public class TestDmq1 extends TestCase {
MessageConsumer consumerq = sessioncq.createConsumer(queue);
MessageConsumer consumert = sessioncq.createConsumer(topic);
// create a text message send to the queue by the pruducer
TextMessage msg = sessionp.createTextMessage();
msg= sessionp.createTextMessage("message_q");
// create a text message send to the queue by the producer
TextMessage msg = sessionp.createTextMessage("message_q");
producer.send(queue,msg);
// create a text message send to the topic by the producer
msg= sessionp.createTextMessage("message_t");
producer.send(topic,msg);
// the consumer receive the message from the dq
TextMessage msg1=(TextMessage)consumerq.receive();
sessioncq.rollback();
msg1=(TextMessage) consumert.receive();
// the consumer receive the message from the queue then rollback it 2 times
TextMessage msg1= (TextMessage) consumerq.receive();
sessioncq.rollback();
msg1=(TextMessage) consumerq.receive();
sessioncq.rollback();
msg1=(TextMessage) consumert.receive();
// the consumer receive the message from the topic then rollback it 2 times
msg1= (TextMessage) consumert.receive();
sessioncq.rollback();
msg1= (TextMessage) consumert.receive();
sessioncq.rollback();
msg1=(TextMessage) consumerq.receive(500);
assertEquals(null,msg1);
msg1=(TextMessage) consumert.receive(500);
assertEquals(null,msg1);
msg1 = (TextMessage) consumerdq.receive();
assertEquals("message_q",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
msg1 = (TextMessage) consumerdq1.receive();
assertEquals("message_t",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
// the consumer try to receive a message from the queue
msg1= (TextMessage) consumerq.receive(500);
assertEquals(null, msg1);
// the consumer try to receive a message from the topic
msg1= (TextMessage) consumert.receive(500);
assertEquals(null ,msg1);
msg1 = (TextMessage) consumerdq.receive(1000L);
assertTrue(msg1 != null);
if (msg1 != null) {
assertEquals("message_q",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
}
msg1 = (TextMessage) consumerdq1.receive(1000L);
assertTrue(msg1 != null);
if (msg1 != null) {
assertEquals("message_t",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
}
cnxq.close();
cnxdq.close();
......@@ -134,42 +141,35 @@ public class TestDmq1 extends TestCase {
* use jndi
*/
public void admin() throws Exception {
// conexion
// connection
org.objectweb.joram.client.jms.admin.AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue =
(org.objectweb.joram.client.jms.Queue) org.objectweb.joram.client.jms.Queue.create("queue");
org.objectweb.joram.client.jms.Topic topic =
(org.objectweb.joram.client.jms.Topic) org.objectweb.joram.client.jms.Topic.create("topic");
DeadMQueue dmq = (DeadMQueue) DeadMQueue.create(0);
DeadMQueue dmq1 = (DeadMQueue) DeadMQueue.create(0);
// create a user
org.objectweb.joram.client.jms.admin.User user =
org.objectweb.joram.client.jms.admin.User.create("anonymous", "anonymous");
org.objectweb.joram.client.jms.admin.User userdmq =
org.objectweb.joram.client.jms.admin.User.create("dmq", "dmq");
// set permissions
// create users
User user = User.create("anonymous", "anonymous");
User userdmq = User.create("dmq", "dmq");
// create destinations
Queue queue = Queue.create("queue");
queue.setFreeReading();
queue.setFreeWriting();
Topic topic = Topic.create("topic");
topic.setFreeReading();
topic.setFreeWriting();
// create DMQs
Queue dmq = (Queue) Queue.create(0);
dmq.setReader(userdmq);
dmq.setFreeWriting();
Queue dmq1 = (Queue) Queue.create(0);
dmq1.setReader(userdmq);
dmq1.setFreeWriting();
queue.setDMQ(dmq);
queue.setThreshold(2);
user.setDMQ(dmq1);
user.setThreshold(2);
dmq.setReader(userdmq);
dmq.setWriter(userdmq);
dmq1.setReader(userdmq);
dmq1.setWriter(userdmq);
javax.jms.ConnectionFactory cf =
org.objectweb.joram.client.jms.tcp.TcpConnectionFactory.create("localhost", 2560);
javax.jms.ConnectionFactory cf = TcpConnectionFactory.create("localhost", 2560);
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
jndiCtx.bind("cf", cf);
......
......@@ -26,14 +26,13 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.admin.DeadMQueue;
import org.objectweb.joram.client.jms.Queue;
import framework.TestCase;
......@@ -43,105 +42,99 @@ import framework.TestCase;
*/
public class TestDmq2 extends TestCase {
public static void main(String[] args) {
new TestDmq2().run();
}
public void run() {
try {
System.out.println("server start");
startAgentServer((short)0);
admin();
System.out.println("admin config ok");
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
DeadMQueue dmq =(DeadMQueue) ictx.lookup("dmq");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
Connection cnx = cf.createConnection();
Session sessionp = cnx.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Session sessionc = cnx.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Session sessionc1 = cnx.createSession(true,
Session.AUTO_ACKNOWLEDGE);
cnx.start();
// create a producer and a consumer
MessageProducer producer = sessionp.createProducer(queue);
MessageConsumer consumerdq = sessionc.createConsumer(dmq);
MessageConsumer consumerq = sessionc1.createConsumer(queue);
// create a text message send to the queue by the pruducer
TextMessage msg = sessionp.createTextMessage();
msg= sessionp.createTextMessage("message_1");
producer.send(msg);
// the consumer receive the message from the dq
TextMessage msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive(2000);
assertEquals(null,msg1);
msg1=(TextMessage) consumerdq.receive();
//test messages
assertEquals("message_1",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
cnx.close();
} catch (Throwable exc) {
exc.printStackTrace();
error(exc);
} finally {
System.out.println("Server stop ");
stopAgentServer((short)0);
endTest();
}
}
/**
* Admin : Create queue and a user anonymous
* use jndi
*/
public void admin() throws Exception {
// conexion
org.objectweb.joram.client.jms.admin.AdminModule.connect("localhost", 2560,
"root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue = org.objectweb.joram.client.jms.Queue.create("queue");
// set permissions
queue.setFreeReading();
queue.setFreeWriting();
DeadMQueue dmq = (DeadMQueue) DeadMQueue.create(0);
dmq.setFreeReading();
dmq.setFreeWriting();
queue.setDMQ(dmq);
org.objectweb.joram.client.jms.admin.AdminModule.setDefaultThreshold(0,2);
// create a user
org.objectweb.joram.client.jms.admin.User user =
org.objectweb.joram.client.jms.admin.User.create("anonymous", "anonymous");
javax.jms.ConnectionFactory cf =
org.objectweb.joram.client.jms.tcp.TcpConnectionFactory.create("localhost", 2560);
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
jndiCtx.bind("cf", cf);
jndiCtx.bind("queue", queue);
jndiCtx.bind("dmq", dmq);
jndiCtx.close();
org.objectweb.joram.client.jms.admin.AdminModule.disconnect();
public static void main(String[] args) {
new TestDmq2().run();
}
public void run() {
try {
System.out.println("server start");
startAgentServer((short)0);
admin();
System.out.println("admin config ok");
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
Queue dmq =(Queue) ictx.lookup("dmq");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
Connection cnx = cf.createConnection();
Session sessionp = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc1 = cnx.createSession(true, Session.AUTO_ACKNOWLEDGE);
cnx.start();
// create a producer and a consumer
MessageProducer producer = sessionp.createProducer(queue);
MessageConsumer consumerdq = sessionc.createConsumer(dmq);
MessageConsumer consumerq = sessionc1.createConsumer(queue);
// create a text message send to the queue by the pruducer
TextMessage msg = sessionp.createTextMessage();
msg= sessionp.createTextMessage("message_1");
producer.send(msg);
// the consumer receive the message from the dq
TextMessage msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive(2000);
assertEquals(null,msg1);
msg1=(TextMessage) consumerdq.receive();
//test messages
assertEquals("message_1",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
cnx.close();
} catch (Throwable exc) {
exc.printStackTrace();
error(exc);
} finally {
System.out.println("Server stop ");
stopAgentServer((short)0);
endTest();
}
}
/**
* Admin : Create queue and a user anonymous
* use jndi
*/
public void admin() throws Exception {
// connection
org.objectweb.joram.client.jms.admin.AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue = org.objectweb.joram.client.jms.Queue.create("queue");
// set permissions
queue.setFreeReading();
queue.setFreeWriting();
Queue dmq = (Queue) Queue.create(0);
dmq.setFreeReading();
dmq.setFreeWriting();
queue.setDMQ(dmq);
org.objectweb.joram.client.jms.admin.AdminModule.setDefaultThreshold(0,2);
// create a user
org.objectweb.joram.client.jms.admin.User user =
org.objectweb.joram.client.jms.admin.User.create("anonymous", "anonymous");
javax.jms.ConnectionFactory cf =
org.objectweb.joram.client.jms.tcp.TcpConnectionFactory.create("localhost", 2560);
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
jndiCtx.bind("cf", cf);
jndiCtx.bind("queue", queue);
jndiCtx.bind("dmq", dmq);
jndiCtx.close();
org.objectweb.joram.client.jms.admin.AdminModule.disconnect();
}
}
......@@ -26,15 +26,13 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.admin.AdminModule;
import org.objectweb.joram.client.jms.admin.DeadMQueue;
import org.objectweb.joram.client.jms.Queue;
import framework.TestCase;
......@@ -57,7 +55,7 @@ public class TestDmq3 extends TestCase {
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
DeadMQueue dmq = (DeadMQueue) ictx.lookup("dmq");
Queue dmq = (Queue) ictx.lookup("dmq");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
......@@ -65,7 +63,6 @@ public class TestDmq3 extends TestCase {
Session sessionp = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc1 = cnx.createSession(true, Session.AUTO_ACKNOWLEDGE);
cnx.start();
// create a producer and a consumer
......@@ -107,7 +104,7 @@ public class TestDmq3 extends TestCase {
* Admin : Create queue and a user anonymous use jndi
*/
public void admin() throws Exception {
// conexion
// connection
AdminModule.connect("localhost", 2560, "root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue = org.objectweb.joram.client.jms.Queue.create("queue");
......@@ -115,7 +112,7 @@ public class TestDmq3 extends TestCase {
queue.setFreeReading();
queue.setFreeWriting();
DeadMQueue dmq = (DeadMQueue) DeadMQueue.create(0);
Queue dmq = (Queue) Queue.create(0);
dmq.setFreeReading();
dmq.setFreeWriting();
AdminModule.setDefaultDMQ(0, dmq);
......
......@@ -26,14 +26,12 @@ import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.objectweb.joram.client.jms.admin.DeadMQueue;
import org.objectweb.joram.client.jms.Queue;
import framework.TestCase;
......@@ -43,107 +41,102 @@ import framework.TestCase;
*/
public class TestDmq4 extends TestCase {
public static void main(String[] args) {
new TestDmq4().run();
}
public void run() {
try {
System.out.println("server start");
startAgentServer((short)0);
admin();
System.out.println("admin config ok");
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
DeadMQueue dmq =(DeadMQueue) ictx.lookup("dmq");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
Connection cnx = cf.createConnection();
Session sessionp = cnx.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Session sessionc = cnx.createSession(false,
Session.AUTO_ACKNOWLEDGE);
Session sessionc1 = cnx.createSession(true,
Session.AUTO_ACKNOWLEDGE);
cnx.start();
// create a producer and a consumer
MessageProducer producer = sessionp.createProducer(queue);
MessageConsumer consumerdq = sessionc.createConsumer(dmq);
MessageConsumer consumerq = sessionc1.createConsumer(queue);
// create a text message send to the queue by the pruducer
TextMessage msg = sessionp.createTextMessage();
msg= sessionp.createTextMessage("message_1");
producer.send(msg);
// the consumer receive the message from the dq
TextMessage msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive(2000);
assertEquals(null,msg1);
msg1=(TextMessage) consumerdq.receive();
//test messages
assertEquals("message_1",msg1.getText());
assertEquals(3, msg1.getIntProperty("JMSXDeliveryCount"));
cnx.close();
} catch (Throwable exc) {
exc.printStackTrace();
error(exc);
} finally {
System.out.println("Server stop ");
stopAgentServer((short)0);
endTest();
}
}
/**
* Admin : Create queue and a user anonymous
* use jndi
*/
public void admin() throws Exception {
// conexion
org.objectweb.joram.client.jms.admin.AdminModule.connect("localhost", 2560,
"root", "root", 60);
// create a Queue
org.objectweb.joram.client.jms.Queue queue =
(org.objectweb.joram.client.jms.Queue) org.objectweb.joram.client.jms.Queue.create("queue");
// set permissions
queue.setFreeReading();
queue.setFreeWriting();
DeadMQueue dmq = (DeadMQueue) DeadMQueue.create(0);
dmq.setFreeReading();
dmq.setFreeWriting();
org.objectweb.joram.client.jms.admin.AdminModule.setDefaultDMQ(0,dmq);
org.objectweb.joram.client.jms.admin.AdminModule.setDefaultThreshold(0,2);
// create a user
org.objectweb.joram.client.jms.admin.User user =
org.objectweb.joram.client.jms.admin.User.create("anonymous", "anonymous");
javax.jms.ConnectionFactory cf =
org.objectweb.joram.client.jms.tcp.TcpConnectionFactory.create("localhost", 2560);
javax.naming.Context jndiCtx = new javax.naming.InitialContext();
jndiCtx.bind("cf", cf);
jndiCtx.bind("queue", queue);
jndiCtx.bind("dmq", dmq);
jndiCtx.close();
org.objectweb.joram.client.jms.admin.AdminModule.disconnect();
public static void main(String[] args) {
new TestDmq4().run();
}
public void run() {
try {
System.out.println("server start");
startAgentServer((short)0);
admin();
System.out.println("admin config ok");
Context ictx = new InitialContext();
Queue queue = (Queue) ictx.lookup("queue");
Queue dmq =(Queue) ictx.lookup("dmq");
ConnectionFactory cf = (ConnectionFactory) ictx.lookup("cf");
ictx.close();
Connection cnx = cf.createConnection();
Session sessionp = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc = cnx.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sessionc1 = cnx.createSession(true, Session.AUTO_ACKNOWLEDGE);
cnx.start();
// create a producer and a consumer
MessageProducer producer = sessionp.createProducer(queue);
MessageConsumer consumerdq = sessionc.createConsumer(dmq);
MessageConsumer consumerq = sessionc1.createConsumer(queue);
// create a text message send to the queue by the pruducer
TextMessage msg = sessionp.createTextMessage();
msg= sessionp.createTextMessage("message_1");
producer.send(msg);
// the consumer receive the message from the dq
TextMessage msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive();
sessionc1.rollback();
msg1=(TextMessage) consumerq.receive(2000);
assertEquals(null,msg1);
msg1=(TextMessage) consumerdq.receive();
//test messages