qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From g...@apache.org
Subject svn commit: r1226931 - in /qpid/trunk/qpid/cpp/src: qpid/messaging/AddressParser.cpp tests/MessagingSessionTests.cpp
Date Tue, 03 Jan 2012 19:50:38 GMT
Author: gsim
Date: Tue Jan  3 19:50:37 2012
New Revision: 1226931

URL: http://svn.apache.org/viewvc?rev=1226931&view=rev
Log:
QPID-3492: Fix quoted values as well as unquoted values; added a test case

Modified:
    qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp
    qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp?rev=1226931&r1=1226930&r2=1226931&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/messaging/AddressParser.cpp Tue Jan  3 19:50:37 2012
@@ -7,9 +7,9 @@
  * to you under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
- * 
+ *
  *   http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -191,13 +191,14 @@ bool AddressParser::readQuotedValue(Vari
     std::string s;
     if (readQuotedString(s)) {
         value = s;
+        value.setEncoding("utf8");
         return true;
     } else {
         return false;
     }
 }
-    
-bool AddressParser::readSimpleValue(Variant& value)   
+
+bool AddressParser::readSimpleValue(Variant& value)
 {
     std::string s;
     if (readWord(s)) {
@@ -217,7 +218,7 @@ bool AddressParser::readWord(std::string
     //read any number of non-whitespace, non-reserved chars into value
     std::string::size_type start = current;
     while (!eos() && !iswhitespace() && !in(delims)) ++current;
-    
+
     if (current > start) {
         value = input.substr(start, current - start);
         return true;
@@ -229,8 +230,8 @@ bool AddressParser::readWord(std::string
 bool AddressParser::readChar(char c)
 {
     while (!eos()) {
-        if (iswhitespace()) { 
-            ++current; 
+        if (iswhitespace()) {
+            ++current;
         } else if (input.at(current) == c) {
             ++current;
             return true;

Modified: qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=1226931&r1=1226930&r2=1226931&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/MessagingSessionTests.cpp Tue Jan  3 19:50:37 2012
@@ -1118,6 +1118,27 @@ QPID_AUTO_TEST_CASE(testUnsubscribeOnClo
     fix.session.acknowledge();
 }
 
+QPID_AUTO_TEST_CASE(testHeadersExchange)
+{
+    MessagingFixture fix;
+    //use both quoted and unquoted values
+    Receiver receiver = fix.session.createReceiver("amq.match; {link:{x-bindings:[{arguments:{x-match:all,qpid.subject:'abc',my-property:abc}}]}}");
+    Sender sender = fix.session.createSender("amq.match");
+    Message out("test-message");
+    out.setSubject("abc");
+    Variant& property = out.getProperties()["my-property"];
+    property = "abc";
+    property.setEncoding("utf8");
+    sender.send(out, true);
+    Message in;
+    if (receiver.fetch(in, Duration::SECOND)) {
+        fix.session.acknowledge();
+        BOOST_CHECK_EQUAL(in.getContent(), out.getContent());
+    } else {
+        BOOST_FAIL("Message did not match as expected!");
+    }
+}
+
 QPID_AUTO_TEST_SUITE_END()
 
 }} // namespace qpid::tests



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message