You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2017/01/23 20:41:03 UTC

qpid-interop-test git commit: QPIDIT-73: Fixed Rhea JS shim handling of AMQP char type

Repository: qpid-interop-test
Updated Branches:
  refs/heads/master 8d883313d -> 1bccde68e


QPIDIT-73: Fixed Rhea JS shim handling of AMQP char type


Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/1bccde68
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/1bccde68
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/1bccde68

Branch: refs/heads/master
Commit: 1bccde68efe6b8bcdd9d0305873ccd6e4530ae91
Parents: 8d88331
Author: Kim van der Riet <kv...@localhost.localdomain>
Authored: Mon Jan 23 15:40:28 2017 -0500
Committer: Kim van der Riet <kv...@localhost.localdomain>
Committed: Mon Jan 23 15:40:28 2017 -0500

----------------------------------------------------------------------
 shims/rhea-js/amqp_types_test/Receiver.js | 12 ++++--------
 shims/rhea-js/amqp_types_test/Sender.js   |  6 ++----
 2 files changed, 6 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/1bccde68/shims/rhea-js/amqp_types_test/Receiver.js
----------------------------------------------------------------------
diff --git a/shims/rhea-js/amqp_types_test/Receiver.js b/shims/rhea-js/amqp_types_test/Receiver.js
index dc4ec57..fa72a3b 100755
--- a/shims/rhea-js/amqp_types_test/Receiver.js
+++ b/shims/rhea-js/amqp_types_test/Receiver.js
@@ -122,16 +122,12 @@ function Receiver(brokerAddr, brokerPort, queueName, amqpType, numTestValues) {
         return "0x" + buf.toString('hex');
     };
 
-    // UTF32LE char per AMQP spec
+    // UTF32BE char per AMQP spec
     this.decodeChar = function(msgBody) {
-        if (Buffer.isBuffer(msgBody)) {
-            if (msgBody[0] === 0 && msgBody[1] === 0 && msgBody[2] === 0 && msgBody[3] >= 32 && msgBody[3] <= 126) {
-                // Printable single ASCII char - return just the char
-                return String.fromCharCode(msgBody[3]);
-            }
-            return "0x" + this.buffer2HexString(msgBody, false);
+        if (msgBody >= 32 && msgBody <=126) { // printable single ASCII char
+            return String.fromCharCode(msgBody);
         } else {
-            throw "AMQP type char message body is not Buffer";
+            return "0x" + msgBody.toString(16);
         }
     };
 

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/1bccde68/shims/rhea-js/amqp_types_test/Sender.js
----------------------------------------------------------------------
diff --git a/shims/rhea-js/amqp_types_test/Sender.js b/shims/rhea-js/amqp_types_test/Sender.js
index 475d6b5..b45103d 100755
--- a/shims/rhea-js/amqp_types_test/Sender.js
+++ b/shims/rhea-js/amqp_types_test/Sender.js
@@ -233,16 +233,14 @@ function Sender(brokerAddr, brokerPort, queueName, amqpType, testValues) {
     };
 
     this.encodeChar = function(testValue) {
-        var val = null;
         try {
             if (testValue.length === 1) { // Single char format 'a'
-                val = [0, 0, 0, testValue.charCodeAt(0)];
+                return testValue.charCodeAt(0);
             } else { // Hex format '0xNNNN'
-                val = this.hexString2ByteArray(testValue.slice(2), 4);
+                return parseInt(testValue, 16);
             }
         }
         catch (err) { this.handleEncodeError("char", testValue); }
-        return new Buffer(val);
     };
 
     this.encodeTimestamp = function(testValue) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org