qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1480327 - in /qpid/trunk/qpid/cpp/src: qpid/amqp_0_10/Codecs.cpp tests/MessagingSessionTests.cpp
Date Wed, 08 May 2013 15:39:24 GMT
Author: gsim
Date: Wed May  8 15:39:24 2013
New Revision: 1480327

URL: http://svn.apache.org/r1480327
Log:
QPID-4820: fix incorrect AMQP 0-10 typecodes

Modified:
    qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
    qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp?rev=1480327&r1=1480326&r2=1480327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/amqp_0_10/Codecs.cpp Wed May  8 15:39:24 2013
@@ -102,9 +102,9 @@ Variant toVariant(boost::shared_ptr<Fiel
     //based on AMQP 0-10 typecode, pick most appropriate variant type
     switch (in->getType()) {
         //Fixed Width types:
-      case 0x01: out.setEncoding(amqp0_10_binary);
-      case 0x02: out = in->getIntegerValue<int8_t>(); break;
-      case 0x03: out = in->getIntegerValue<uint8_t>(); break;
+      case 0x00: out.setEncoding(amqp0_10_binary);
+      case 0x01: out = in->getIntegerValue<int8_t>(); break;
+      case 0x02: out = in->getIntegerValue<uint8_t>(); break;
       case 0x04: break; //TODO: iso-8859-15 char
       case 0x08: out = static_cast<bool>(in->getIntegerValue<uint8_t>());
break;
       case 0x10: out.setEncoding(amqp0_10_binary);

Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1480327&r1=1480326&r2=1480327&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Wed May  8 15:39:24 2013
@@ -86,6 +86,11 @@ QPID_AUTO_TEST_CASE(testSendReceiveHeade
         out.setProperty("b", i + 100);
         sender.send(out);
     }
+    uint8_t v1(255u);
+    int8_t v2(-120);
+    out.getProperties()["c"] = v1;
+    out.getProperties()["d"] = v2;
+    sender.send(out);
     Receiver receiver = fix.session.createReceiver(fix.queue);
     Message in;
     for (uint i = 0; i < 10; ++i) {
@@ -95,6 +100,13 @@ QPID_AUTO_TEST_CASE(testSendReceiveHeade
         BOOST_CHECK_EQUAL(in.getProperties()["b"].asUint32(), i + 100);
         fix.session.acknowledge();
     }
+    BOOST_CHECK(receiver.fetch(in, Duration::SECOND * 5));
+    Variant& c = in.getProperties()["c"];
+    BOOST_CHECK_EQUAL(c.getType(), VAR_UINT8);
+    BOOST_CHECK_EQUAL(c.asUint8(), v1);
+    Variant& d = in.getProperties()["d"];
+    BOOST_CHECK_EQUAL(d.getType(), VAR_INT8);
+    BOOST_CHECK_EQUAL(d.asInt8(), v2);
 }
 
 QPID_AUTO_TEST_CASE(testSenderError)



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


Mime
View raw message