diff options
author | Jens Geyer <jensg@apache.org> | 2014-05-02 22:23:15 +0200 |
---|---|---|
committer | Jens Geyer <jensg@apache.org> | 2014-05-02 22:23:15 +0200 |
commit | 2a9e6a491e2c6e97bd35f715f39788582eb8b027 (patch) | |
tree | b36af2ff35ed07e6c060818aab5ca2fde44c663f /lib | |
parent | 885c6791235e011794a0b65c00f1d9fdf3d233e3 (diff) | |
download | thrift-2a9e6a491e2c6e97bd35f715f39788582eb8b027.tar.gz |
THRIFT-2501: C# The test parameters from the TestServer and TestClient are different from the http://thrift.apache.org/test/
Client: C#
Patch: Beat Kaeslin
This closes #108
commit 0fb9ff4ae19702ffe6d098a6515f6a23d60e88d5
Author: Beat Kaeslin <beat.kaeslin@siemens.com>
Date: 2014-04-23T06:33:59Z
Parameter aligned with thrift.apache.org/test/
Diffstat (limited to 'lib')
-rw-r--r-- | lib/csharp/test/ThriftTest/TestClient.cs | 47 | ||||
-rw-r--r-- | lib/csharp/test/ThriftTest/TestServer.cs | 68 |
2 files changed, 50 insertions, 65 deletions
diff --git a/lib/csharp/test/ThriftTest/TestClient.cs b/lib/csharp/test/ThriftTest/TestClient.cs index 593169f0a..db0fe63e6 100644 --- a/lib/csharp/test/ThriftTest/TestClient.cs +++ b/lib/csharp/test/ThriftTest/TestClient.cs @@ -46,16 +46,7 @@ namespace Test { for (int i = 0; i < args.Length; i++) { - if (args[i] == "-h") - { - string[] hostport = args[++i].Split(':'); - host = hostport[0]; - if (hostport.Length > 1) - { - port = Convert.ToInt32(hostport[1]); - } - } - else if (args[i] == "-u") + if (args[i] == "-u") { url = args[++i]; } @@ -63,40 +54,48 @@ namespace Test { numIterations = Convert.ToInt32(args[++i]); } - else if (args[i] == "-b" || args[i] == "-buffered") + else if (args[i] == "-pipe") // -pipe <name> + { + pipe = args[++i]; + Console.WriteLine("Using named pipes transport"); + } + else if (args[i].Contains("--host=")) + { + host = args[i].Substring(args[i].IndexOf("=") + 1); + } + else if (args[i].Contains("--port=")) + { + port = int.Parse(args[i].Substring(args[i].IndexOf("=")+1)); + } + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") { buffered = true; Console.WriteLine("Using buffered sockets"); } - else if (args[i] == "-f" || args[i] == "-framed") + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") { framed = true; Console.WriteLine("Using framed transport"); } - else if (args[i] == "-pipe") // -pipe <name> - { - pipe = args[++i]; - Console.WriteLine("Using named pipes transport"); - } else if (args[i] == "-t") { numThreads = Convert.ToInt32(args[++i]); } - else if (args[i] == "-ssl") - { - encrypted = true; - Console.WriteLine("Using encrypted transport"); - } - else if (args[i] == "-compact") + else if (args[i] == "--compact" || args[i] == "--protocol=compact") { protocol = "compact"; Console.WriteLine("Using compact protocol"); } - else if (args[i] == "-json") + else if (args[i] == "--json" || args[i] == "--protocol=json") { protocol = "json"; Console.WriteLine("Using JSON protocol"); } + else if (args[i] == "--ssl") + { + encrypted = true; + Console.WriteLine("Using encrypted transport"); + } } } catch (Exception e) diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs index f0e9abbf7..f0f539fa3 100644 --- a/lib/csharp/test/ThriftTest/TestServer.cs +++ b/lib/csharp/test/ThriftTest/TestServer.cs @@ -323,52 +323,37 @@ namespace Test try { bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false; - int port = 9090, i = 0; + int port = 9090; string pipe = null; - if (args.Length > 0) + for (int i = 0; i < args.Length; i++) { - i = 0; if (args[i] == "-pipe") // -pipe name { pipe = args[++i]; } - else // default to port number (compatibility) + else if (args[i].Contains("--port=")) { - port = int.Parse(args[i]); + port = int.Parse(args[i].Substring(args[i].IndexOf("=")+1)); } - - ++i; - if (args.Length > i) + else if (args[i] == "-b" || args[i] == "--buffered" || args[i] == "--transport=buffered") + { + useBufferedSockets = true; + } + else if (args[i] == "-f" || args[i] == "--framed" || args[i] == "--transport=framed") + { + useFramed = true; + } + else if (args[i] == "--compact" || args[i] == "--protocol=compact") + { + compact = true; + } + else if (args[i] == "--json" || args[i] == "--protocol=json") + { + json = true; + } + else if (args[i] == "--ssl") { - if ( args[i] == "raw" ) - { - // as default - } - else if (args[i] == "buffered") - { - useBufferedSockets = true; - } - else if (args[i] == "framed") - { - useFramed = true; - } - else if (args[i] == "ssl") - { - useEncryption = true; - } - else if (args[i] == "compact" ) - { - compact = true; - } - else if (args[i] == "json" ) - { - json = true; - } - else - { - // Fall back to the older boolean syntax - bool.TryParse(args[i], out useBufferedSockets); - } + useEncryption = true; } } @@ -420,10 +405,11 @@ namespace Test // Run it string where = ( pipe != null ? "on pipe "+pipe : "on port " + port); Console.WriteLine("Starting the server " + where + - (useBufferedSockets ? " with buffered socket" : "") + - (useFramed ? " with framed transport" : "") + - (useEncryption ? " with encryption" : "") + - (compact ? " with compact protocol" : "") + + (useBufferedSockets ? " with buffered socket" : "") + + (useFramed ? " with framed transport" : "") + + (useEncryption ? " with encryption" : "") + + (compact ? " with compact protocol" : "") + + (json ? " with json protocol" : "") + "..."); serverEngine.Serve(); |