[jboss-cvs] JBoss Messaging SVN: r1964 - trunk/tests/src/org/jboss/test/messaging/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 11 18:12:29 EST 2007


Author: clebert.suconic at jboss.com
Date: 2007-01-11 18:12:28 -0500 (Thu, 11 Jan 2007)
New Revision: 1964

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java
Log:
Merging test from 1_0_1_SP branch

Modified: trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java	2007-01-11 22:24:57 UTC (rev 1963)
+++ trunk/tests/src/org/jboss/test/messaging/jms/QueueTest.java	2007-01-11 23:12:28 UTC (rev 1964)
@@ -117,6 +117,63 @@
       }
    }
 
+   /**
+    * The simplest possible queue test.
+    */
+   public void testRedeployQueue() throws Exception
+   {
+      Queue queue = (Queue)ic.lookup("/queue/TestQueue");
+
+      Connection conn = cf.createConnection();
+
+      try
+      {
+         Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         MessageProducer p = s.createProducer(queue);
+         MessageConsumer c = s.createConsumer(queue);
+         conn.start();
+
+         for (int i = 0; i < 500; i++)
+         {
+            p.send(s.createTextMessage("payload " + i));
+         }
+
+         //ServerManagement.undeployQueue("TestQueue");
+
+         log.info("Stopping server");
+         ServerManagement.stopServerPeer();
+
+         log.info("Starting server");
+         ServerManagement.startServerPeer();
+         ServerManagement.deployQueue("TestQueue");
+
+         ic = new InitialContext(ServerManagement.getJNDIEnvironment());
+         cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
+
+         conn = cf.createConnection();
+         s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+         p = s.createProducer(queue);
+         c = s.createConsumer(queue);
+         conn.start();
+
+         for (int i = 0; i < 500; i++)
+         {
+            TextMessage message = (TextMessage)c.receive(3000);
+            assertNotNull(message);
+            assertNotNull(message.getJMSDestination());
+         }
+
+      }
+      finally
+      {
+         if (conn != null)
+         {
+            conn.close();
+         }
+      }
+   }
+
+
    public void testQueueName() throws Exception
    {
       Queue queue = (Queue)ic.lookup("/queue/TestQueue");




More information about the jboss-cvs-commits mailing list