You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by an...@apache.org on 2016/07/20 12:42:10 UTC

[1/2] activemq-artemis git commit: This closes #646 ARTEMIS-234 fix content-length for Stomp 1.0

Repository: activemq-artemis
Updated Branches:
  refs/heads/master 413e7aee5 -> d1cfcdffa


This closes #646 ARTEMIS-234 fix content-length for Stomp 1.0


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/d1cfcdff
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/d1cfcdff
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/d1cfcdff

Branch: refs/heads/master
Commit: d1cfcdffa018c618595502442f6c067caa256285
Parents: 413e7ae b466cce
Author: Andy Taylor <an...@gmail.com>
Authored: Wed Jul 20 13:40:57 2016 +0100
Committer: Andy Taylor <an...@gmail.com>
Committed: Wed Jul 20 13:40:57 2016 +0100

----------------------------------------------------------------------
 .../activemq/artemis/core/protocol/stomp/StompFrame.java     | 3 ++-
 docs/user-manual/en/protocols-interoperability.md            | 8 ++++----
 .../activemq/artemis/tests/integration/stomp/StompTest.java  | 4 ++++
 .../artemis/tests/integration/stomp/v11/StompV11Test.java    | 2 ++
 4 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: ARTEMIS-234 fix content-length for Stomp 1.0

Posted by an...@apache.org.
ARTEMIS-234 fix content-length for Stomp 1.0


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b466cce5
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b466cce5
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b466cce5

Branch: refs/heads/master
Commit: b466cce593bea6ab5ff9b2449c0fa724397a10e5
Parents: 413e7ae
Author: jbertram <jb...@apache.org>
Authored: Tue Jul 19 16:09:06 2016 -0500
Committer: Andy Taylor <an...@gmail.com>
Committed: Wed Jul 20 13:40:57 2016 +0100

----------------------------------------------------------------------
 .../activemq/artemis/core/protocol/stomp/StompFrame.java     | 3 ++-
 docs/user-manual/en/protocols-interoperability.md            | 8 ++++----
 .../activemq/artemis/tests/integration/stomp/StompTest.java  | 4 ++++
 .../artemis/tests/integration/stomp/v11/StompV11Test.java    | 2 ++
 4 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b466cce5/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
index 4e184db..27b222b 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
 import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
+import org.apache.activemq.artemis.core.protocol.stomp.v10.StompFrameV10;
 
 /**
  * Represents all the data in a STOMP frame.
@@ -107,7 +108,7 @@ public class StompFrame {
          head.append(Stomp.NEWLINE);
          // Output the headers.
          encodeHeaders(head);
-         if (bytesBody != null && bytesBody.length > 0 && !hasHeader(Stomp.Headers.CONTENT_LENGTH)) {
+         if (bytesBody != null && bytesBody.length > 0 && !hasHeader(Stomp.Headers.CONTENT_LENGTH) && !(this instanceof StompFrameV10)) {
             head.append(Stomp.Headers.CONTENT_LENGTH);
             head.append(Stomp.Headers.SEPARATOR);
             head.append(bytesBody.length);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b466cce5/docs/user-manual/en/protocols-interoperability.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/protocols-interoperability.md b/docs/user-manual/en/protocols-interoperability.md
index 5b486d0..7e81e65 100644
--- a/docs/user-manual/en/protocols-interoperability.md
+++ b/docs/user-manual/en/protocols-interoperability.md
@@ -384,18 +384,18 @@ destinations, the Stomp destinations must follow the same convention:
 Stomp is mainly a text-orientated protocol. To make it simpler to
 interoperate with JMS and Apache ActiveMQ Artemis Core API, our Stomp implementation
 checks for presence of the `content-length` header to decide how to map
-a Stomp message to a JMS Message or a Core message.
+a Stomp 1.0 message to a JMS Message or a Core message.
 
-If the Stomp message does *not* have a `content-length` header, it will
+If the Stomp 1.0 message does *not* have a `content-length` header, it will
 be mapped to a JMS *TextMessage* or a Core message with a *single
 nullable SimpleString in the body buffer*.
 
-Alternatively, if the Stomp message *has* a `content-length` header, it
+Alternatively, if the Stomp 1.0 message *has* a `content-length` header, it
 will be mapped to a JMS *BytesMessage* or a Core message with a *byte[]
 in the body buffer*.
 
 The same logic applies when mapping a JMS message or a Core message to
-Stomp. A Stomp client can check the presence of the `content-length`
+Stomp. A Stomp 1.0 client can check the presence of the `content-length`
 header to determine the type of the message body (String or bytes).
 
 #### Message IDs for Stomp messages

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b466cce5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
index f28f5b2..8ba369f 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
@@ -595,6 +595,10 @@ public class StompTest extends StompTestBase {
       Assert.assertTrue(frame.indexOf("destination:") > 0);
       Assert.assertTrue(frame.indexOf(getName()) > 0);
 
+      Pattern cl = Pattern.compile("Content-length:\\s*(\\d+)", Pattern.CASE_INSENSITIVE);
+      Matcher cl_matcher = cl.matcher(frame);
+      Assert.assertFalse(cl_matcher.find());
+
       frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
       sendFrame(frame);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b466cce5/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
index dfcd1b9..3d7e5f5 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11Test.java
@@ -2002,6 +2002,8 @@ public class StompV11Test extends StompV11TestBase {
 
       ClientStompFrame frame = connV11.receiveFrame();
 
+      assertEquals(getName().length(), Integer.parseInt(frame.getHeader("content-length")));
+
       this.ack(connV11, "sub1", frame);
 
       connV11.disconnect();