activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1162215 - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/transport/stomp/FrameTranslator.java main/java/org/apache/activemq/transport/stomp/Stomp.java test/java/org/apache/activemq/transport/stomp/StompTest.java
Date Fri, 26 Aug 2011 19:18:34 GMT
Author: tabish
Date: Fri Aug 26 19:18:34 2011
New Revision: 1162215

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

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/FrameTranslator.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.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=1162215&r1=1162214&r2=1162215&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
Fri Aug 26 19:18:34 2011
@@ -82,6 +82,10 @@ public interface FrameTranslator {
                 headers.put(Stomp.Headers.Message.ORIGINAL_DESTINATION, ft.convertDestination(converter,
message.getOriginalDestination()));
             }
 
+            if (message.isPersistent()) {
+                headers.put(Stomp.Headers.Message.PERSISTENT, Stomp.TRUE);
+            }
+
             // now lets add all the message headers
             final Map<String, Object> properties = message.getProperties();
             if (properties != null) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java?rev=1162215&r1=1162214&r2=1162215&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/Stomp.java
Fri Aug 26 19:18:34 2011
@@ -110,6 +110,7 @@ public interface Stomp {
             String BROWSER = "browser";
             String USERID = "JMSXUserID";
             String ORIGINAL_DESTINATION = "original-destination";
+            String PERSISTENT = "persistent";
         }
 
         public interface Subscribe {

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=1162215&r1=1162214&r2=1162215&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
Fri Aug 26 19:18:34 2011
@@ -1522,7 +1522,6 @@ public class StompTest extends Combinati
         headers.put(Stomp.Headers.Message.EXPIRATION_TIME, String.valueOf(timestamp));
         headers.put(Stomp.Headers.Send.PERSISTENT, "true");
 
-
         stompConnection.send("/queue/" + getQueueName(), "msg", null, headers);
 
         stompConnection.subscribe("/queue/ActiveMQ.DLQ");
@@ -1531,8 +1530,35 @@ public class StompTest extends Combinati
         assertEquals(stompMessage.getHeaders().get(Stomp.Headers.Message.ORIGINAL_DESTINATION),
"/queue/" + getQueueName());
     }
 
+    public void testPersistent() throws Exception {
+        stompConnection.connect("system", "manager");
+
+        HashMap<String, String> headers = new HashMap<String, String>();
+        headers.put(Stomp.Headers.Message.PERSISTENT, "true");
+
+        stompConnection.send("/queue/" + getQueueName(), "hello", null, headers);
+
+        stompConnection.subscribe("/queue/" + getQueueName());
+
+        StompFrame stompMessage = stompConnection.receive();
+        assertNotNull(stompMessage);
+        assertNotNull(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT));
+        assertEquals(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT), "true");
+    }
+
+    public void testPersistentDefaultValue() throws Exception {
+        stompConnection.connect("system", "manager");
+
+        HashMap<String, String> headers = new HashMap<String, String>();
 
+        stompConnection.send("/queue/" + getQueueName(), "hello", null, headers);
 
+        stompConnection.subscribe("/queue/" + getQueueName());
+
+        StompFrame stompMessage = stompConnection.receive();
+        assertNotNull(stompMessage);
+        assertNull(stompMessage.getHeaders().get(Stomp.Headers.Message.PERSISTENT));
+    }
 
     protected void assertClients(int expected) throws Exception {
         org.apache.activemq.broker.Connection[] clients = broker.getBroker().getClients();



Mime
View raw message