activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1071432 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/stomp/FrameTranslator.java test/java/org/apache/activemq/transport/stomp/StompTest.java
Date Wed, 16 Feb 2011 22:54:24 GMT
Author: tabish
Date: Wed Feb 16 22:54:23 2011
New Revision: 1071432

URL: http://svn.apache.org/viewvc?rev=1071432&view=rev
Log:
fix for: https://issues.apache.org/jira/browse/AMQ-3006

assign default JMS priority when none is set on a Message.

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
    activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java?rev=1071432&r1=1071431&r2=1071432&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
Wed Feb 16 22:54:23 2011
@@ -22,9 +22,12 @@ import java.util.Map;
 
 import javax.jms.Destination;
 import javax.jms.JMSException;
+import javax.jms.MessageListener;
+import javax.jms.MessageProducer;
 
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQMessage;
+import org.apache.activemq.command.Message;
 
 /**
  * Implementations of this interface are used to map back and forth from Stomp
@@ -81,7 +84,7 @@ public interface FrameTranslator {
             if (message.getOriginalDestination() != null) {
                 headers.put(Stomp.Headers.Message.ORIGINAL_DESTINATION, ft.convertDestination(converter,
message.getOriginalDestination()));
             }
-            
+
             // now lets add all the message headers
             final Map<String, Object> properties = message.getProperties();
             if (properties != null) {
@@ -107,6 +110,8 @@ public interface FrameTranslator {
             o = headers.remove(Stomp.Headers.Send.PRIORITY);
             if (o != null) {
                 msg.setJMSPriority(Integer.parseInt((String)o));
+            } else {
+                msg.setJMSPriority(javax.jms.Message.DEFAULT_PRIORITY);
             }
 
             o = headers.remove(Stomp.Headers.Send.TYPE);

Modified: activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?rev=1071432&r1=1071431&r2=1071432&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
(original)
+++ activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
Wed Feb 16 22:54:23 2011
@@ -296,6 +296,27 @@ public class StompTest extends Combinati
         assertEquals("GroupID", "abc", amqMessage.getGroupID());
     }
 
+    public void testSendMessageWithNoPriorityReceivesDefault() throws Exception {
+
+        MessageConsumer consumer = session.createConsumer(queue);
+
+        String frame = "CONNECT\n" + "login: system\n" + "passcode: manager\n\n" + Stomp.NULL;
+        stompConnection.sendFrame(frame);
+
+        frame = stompConnection.receiveFrame();
+        assertTrue(frame.startsWith("CONNECTED"));
+
+        frame = "SEND\n" + "correlation-id:c123\n" + "destination:/queue/" + getQueueName()
+ "\n\n" + "Hello World"
+                + Stomp.NULL;
+
+        stompConnection.sendFrame(frame);
+
+        TextMessage message = (TextMessage)consumer.receive(2500);
+        assertNotNull(message);
+        assertEquals("Hello World", message.getText());
+        assertEquals("getJMSPriority", 4, message.getJMSPriority());
+    }
+    
     public void testReceipts() throws Exception {
 
         StompConnection receiver = new StompConnection();



Mime
View raw message