Updated Branches:
  refs/heads/master 47b89b958 -> 023192f7e

THRIFT-2358 C++: add compact protocol to cross language test suite
Patch: Roger Meier


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/023192f7
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/023192f7
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/023192f7

Branch: refs/heads/master
Commit: 023192f7e1d3d7698becaf0bd06bff59e4684067
Parents: 47b89b9
Author: Roger Meier <[email protected]>
Authored: Wed Feb 12 09:35:12 2014 +0100
Committer: Roger Meier <[email protected]>
Committed: Wed Feb 12 09:35:12 2014 +0100

----------------------------------------------------------------------
 test/cpp/src/TestClient.cpp | 6 +++++-
 test/cpp/src/TestServer.cpp | 6 +++++-
 test/test.sh                | 4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/023192f7/test/cpp/src/TestClient.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index a0ada14..acb0518 100755
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -22,6 +22,7 @@
 
 #include <iostream>
 #include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/protocol/TCompactProtocol.h>
 #include <thrift/protocol/TJSONProtocol.h>
 #include <thrift/transport/THttpClient.h>
 #include <thrift/transport/TTransportUtils.h>
@@ -109,7 +110,7 @@ int main(int argc, char** argv) {
       ("port", boost::program_options::value<int>(&port)->default_value(port), 
"Port number to connect")
          ("domain-socket", 
boost::program_options::value<string>(&domain_socket)->default_value(domain_socket),
 "Domain Socket (e.g. /tmp/ThriftTest.thrift), instead of host and port")
       ("transport", 
boost::program_options::value<string>(&transport_type)->default_value(transport_type),
 "Transport: buffered, framed, http, evhttp")
-      ("protocol", 
boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
 "Protocol: binary, json")
+      ("protocol", 
boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
 "Protocol: binary, compact, json")
          ("ssl", "Encrypted Transport using SSL")
       ("testloops,n", 
boost::program_options::value<int>(&numTests)->default_value(numTests), "Number 
of Tests")
   ;
@@ -188,6 +189,9 @@ int main(int argc, char** argv) {
   if (protocol_type.compare("json") == 0) {
     boost::shared_ptr<TProtocol> jsonProtocol(new TJSONProtocol(transport));
     protocol = jsonProtocol;
+  } else if (protocol_type.compare("compact") == 0) {
+    boost::shared_ptr<TProtocol> compactProtocol(new 
TCompactProtocol(transport));
+    protocol = compactProtocol;
   } else{
     boost::shared_ptr<TBinaryProtocol> binaryProtocol(new 
TBinaryProtocol(transport));
     protocol = binaryProtocol;

http://git-wip-us.apache.org/repos/asf/thrift/blob/023192f7/test/cpp/src/TestServer.cpp
----------------------------------------------------------------------
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index af43d72..8cf8db1 100755
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -23,6 +23,7 @@
 #include <thrift/concurrency/ThreadManager.h>
 #include <thrift/concurrency/PlatformThreadFactory.h>
 #include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/protocol/TCompactProtocol.h>
 #include <thrift/protocol/TJSONProtocol.h>
 #include <thrift/server/TSimpleServer.h>
 #include <thrift/server/TThreadedServer.h>
@@ -515,7 +516,7 @@ int main(int argc, char **argv) {
       ("transport", 
boost::program_options::value<string>(&transport_type)->default_value(transport_type),
         "transport: buffered, framed, http")
       ("protocol", 
boost::program_options::value<string>(&protocol_type)->default_value(protocol_type),
-        "protocol: binary, json")
+        "protocol: binary, compact, json")
          ("ssl", "Encrypted Transport using SSL")
          ("processor-events", "processor-events")
       ("workers,n", 
boost::program_options::value<size_t>(&workers)->default_value(workers),
@@ -574,6 +575,9 @@ int main(int argc, char **argv) {
   if (protocol_type == "json") {
     boost::shared_ptr<TProtocolFactory> jsonProtocolFactory(new 
TJSONProtocolFactory());
     protocolFactory = jsonProtocolFactory;
+  } else if (protocol_type == "compact") {
+    boost::shared_ptr<TProtocolFactory> compactProtocolFactory(new 
TCompactProtocolFactory());
+    protocolFactory = compactProtocolFactory;
   } else {
     boost::shared_ptr<TProtocolFactory> binaryProtocolFactory(new 
TBinaryProtocolFactoryT<TBufferBase>());
     protocolFactory = binaryProtocolFactory;

http://git-wip-us.apache.org/repos/asf/thrift/blob/023192f7/test/test.sh
----------------------------------------------------------------------
diff --git a/test/test.sh b/test/test.sh
index 5170e13..8a74697 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -91,8 +91,8 @@ print_header
 #TODO add enum for parameters
 #TODO align program arguments across languages
 
-cpp_protocols="binary json"
-java_protocols="binary json compact"
+cpp_protocols="binary compact json"
+java_protocols="binary compact json"
 cpp_transports="buffered framed http"
 java_server_transports="buffered framed fastframed"
 java_client_transports=${java_server_transports}" http"

Reply via email to