You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gs...@apache.org on 2007/05/09 10:48:21 UTC

svn commit: r536458 [2/2] - in /incubator/qpid/trunk/qpid/java: broker/src/main/java/org/apache/qpid/server/ broker/src/main/java/org/apache/qpid/server/messageStore/ broker/src/main/java/org/apache/qpid/server/queue/ broker/src/main/java/org/apache/qp...

Modified: incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/testutil/QpidClientConnection.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/testutil/QpidClientConnection.java?view=diff&rev=536458&r1=536457&r2=536458
==============================================================================
--- incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/testutil/QpidClientConnection.java (original)
+++ incubator/qpid/trunk/qpid/java/systests/src/main/java/org/apache/qpid/testutil/QpidClientConnection.java Wed May  9 01:48:18 2007
@@ -16,7 +16,6 @@
 import javax.jms.Message;
 import javax.jms.MessageConsumer;
 import javax.jms.TextMessage;
-import javax.jms.DeliveryMode;
 
 public class QpidClientConnection implements ExceptionListener
 {
@@ -42,7 +41,9 @@
     }
 
 
-    public void connect() throws JMSException
+    public void connect()
+            throws
+            JMSException
     {
         if (!connected)
         {
@@ -77,7 +78,9 @@
         }
     }
 
-    public void disconnect() throws JMSException
+    public void disconnect()
+            throws
+            JMSException
     {
         if (connected)
         {
@@ -89,7 +92,9 @@
         }
     }
 
-    public void disconnectWithoutCommit() throws JMSException
+    public void disconnectWithoutCommit()
+            throws
+            JMSException
     {
         if (connected)
         {
@@ -126,7 +131,9 @@
     }
 
 
-    /** override as necessary */
+    /**
+     * override as necessary
+     */
     public void onException(JMSException exception)
     {
         _logger.info("ExceptionListener event: error " + exception.getErrorCode() + ", message: " + exception.getMessage());
@@ -148,10 +155,11 @@
      * @param queueName The queue name to put to
      * @param payload   the content of the payload
      * @param copies    the number of messages to put
-     *
      * @throws javax.jms.JMSException any exception that occurs
      */
-    public void put(String queueName, String payload, int copies, int deliveryMode) throws JMSException
+    public void put(String queueName, String payload, int copies)
+            throws
+            JMSException
     {
         if (!connected)
         {
@@ -163,8 +171,6 @@
 
         final MessageProducer sender = session.createProducer(queue);
 
-        sender.setDeliveryMode(deliveryMode);
-
         for (int i = 0; i < copies; i++)
         {
             Message m = session.createTextMessage(payload + i);
@@ -172,7 +178,13 @@
             sender.send(m);
         }
 
-        session.commit();
+        try
+        {
+            session.commit();
+        } catch (JMSException e)
+        {
+            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
         sender.close();
         _logger.info("put " + copies + " copies");
     }
@@ -182,12 +194,12 @@
      *
      * @param queueName   The quename to get from
      * @param readTimeout The timeout to use
-     *
      * @return the content of the text message if any
-     *
      * @throws javax.jms.JMSException any exception that occured
      */
-    public Message getNextMessage(String queueName, long readTimeout) throws JMSException
+    public Message getNextMessage(String queueName, long readTimeout)
+            throws
+            JMSException
     {
         if (!connected)
         {
@@ -208,12 +220,10 @@
         if (message instanceof TextMessage)
         {
             result = ((TextMessage) message);
-        }
-        else if (null == message)
+        } else if (null == message)
         {
             result = null;
-        }
-        else
+        } else
         {
             _logger.info("warning: received non-text message");
             result = message;
@@ -226,12 +236,12 @@
      * GET the top message on a queue. Consumes the message.
      *
      * @param queueName The Queuename to get from
-     *
      * @return The string content of the text message, if any received
-     *
      * @throws javax.jms.JMSException any exception that occurs
      */
-    public Message getNextMessage(String queueName) throws JMSException
+    public Message getNextMessage(String queueName)
+            throws
+            JMSException
     {
         return getNextMessage(queueName, 0);
     }
@@ -241,11 +251,13 @@
      *
      * @param queueName   The Queue name to consume from
      * @param readTimeout The timeout for each consume
-     *
      * @throws javax.jms.JMSException Any exception that occurs during the consume
      * @throws InterruptedException   If the consume thread was interrupted during a consume.
      */
-    public void consume(String queueName, int readTimeout) throws JMSException, InterruptedException
+    public void consume(String queueName, int readTimeout)
+            throws
+            JMSException,
+            InterruptedException
     {
         if (!connected)
         {
@@ -266,6 +278,7 @@
 
         session.commit();
         consumer.close();
+
         _logger.info("consumed: " + messagesReceived);
     }
 }