THRIFT-847 Test Framework harmonization across all languages
THRIFT-2946 Enhance usability of cross test framework
Patch: Nobuaki Sukegawa
This closes: #358
diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs
index 2096cf8..0e9fe05 100644
--- a/lib/csharp/test/ThriftTest/TestServer.cs
+++ b/lib/csharp/test/ThriftTest/TestServer.cs
@@ -358,13 +358,14 @@
} // class TestHandler
- public static void Execute(string[] args)
+ public static bool Execute(string[] args)
{
try
{
bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false;
int port = 9090;
string pipe = null;
+ string certPath = "../../../../../keys/server.pem";
for (int i = 0; i < args.Length; i++)
{
if (args[i] == "-pipe") // -pipe name
@@ -395,6 +396,10 @@
{
useEncryption = true;
}
+ else if (args[i].StartsWith("--cert="))
+ {
+ certPath = args[i].Substring("--cert=".Length);
+ }
}
// Processor
@@ -411,7 +416,7 @@
{
if (useEncryption)
{
- trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2("../../../../../keys/server.pem"));
+ trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2(certPath));
}
else
{
@@ -461,8 +466,10 @@
catch (Exception x)
{
Console.Error.Write(x);
+ return false;
}
Console.WriteLine("done.");
+ return true;
}
}
}