THRIFT-2768: Whitespace Fixup
Client: C#, Delphi
Patch: Jens Geyer
diff --git a/lib/csharp/test/JSON/JSONTest.csproj b/lib/csharp/test/JSON/JSONTest.csproj
index 61e8e6c..f07d43e 100644
--- a/lib/csharp/test/JSON/JSONTest.csproj
+++ b/lib/csharp/test/JSON/JSONTest.csproj
@@ -75,7 +75,7 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
diff --git a/lib/csharp/test/JSON/Program.cs b/lib/csharp/test/JSON/Program.cs
index d66c78a..9823221 100644
--- a/lib/csharp/test/JSON/Program.cs
+++ b/lib/csharp/test/JSON/Program.cs
@@ -28,55 +28,55 @@
namespace JSONTest
{
- class Program
- {
- static void Main(string[] args)
- {
- TestThrift2365(); // JSON binary decodes too much data
- TestThrift2336(); // hex encoding using \uXXXX where 0xXXXX > 0xFF
- }
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ TestThrift2365(); // JSON binary decodes too much data
+ TestThrift2336(); // hex encoding using \uXXXX where 0xXXXX > 0xFF
+ }
- public static void TestThrift2365()
- {
- var rnd = new Random();
- for (var len = 0; len < 10; ++len)
- {
- byte[] dataWritten = new byte[len];
- rnd.NextBytes(dataWritten);
+ public static void TestThrift2365()
+ {
+ var rnd = new Random();
+ for (var len = 0; len < 10; ++len)
+ {
+ byte[] dataWritten = new byte[len];
+ rnd.NextBytes(dataWritten);
- Stream stm = new MemoryStream();
- TTransport trans = new TStreamTransport(null, stm);
- TProtocol prot = new TJSONProtocol(trans);
- prot.WriteBinary(dataWritten);
+ Stream stm = new MemoryStream();
+ TTransport trans = new TStreamTransport(null, stm);
+ TProtocol prot = new TJSONProtocol(trans);
+ prot.WriteBinary(dataWritten);
- stm.Position = 0;
- trans = new TStreamTransport(stm, null);
- prot = new TJSONProtocol(trans);
- byte[] dataRead = prot.ReadBinary();
+ stm.Position = 0;
+ trans = new TStreamTransport(stm, null);
+ prot = new TJSONProtocol(trans);
+ byte[] dataRead = prot.ReadBinary();
- Debug.Assert(dataRead.Length == dataWritten.Length);
- for (var i = 0; i < dataRead.Length; ++i)
- Debug.Assert(dataRead[i] == dataWritten[i]);
- }
- }
+ Debug.Assert(dataRead.Length == dataWritten.Length);
+ for (var i = 0; i < dataRead.Length; ++i)
+ Debug.Assert(dataRead[i] == dataWritten[i]);
+ }
+ }
- public static void TestThrift2336()
- {
- const string RUSSIAN_TEXT = "\u0420\u0443\u0441\u0441\u043a\u043e\u0435 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435";
- const string RUSSIAN_JSON = "\"\\u0420\\u0443\\u0441\\u0441\\u043a\\u043e\\u0435 \\u041d\\u0430\\u0437\\u0432\\u0430\\u043d\\u0438\\u0435\"";
-
- // prepare buffer with JSON data
- byte[] rawBytes = new byte[RUSSIAN_JSON.Length];
- for (var i = 0; i < RUSSIAN_JSON.Length; ++i)
- rawBytes[i] = (byte)(RUSSIAN_JSON[i] & (char)0xFF); // only low bytes
+ public static void TestThrift2336()
+ {
+ const string RUSSIAN_TEXT = "\u0420\u0443\u0441\u0441\u043a\u043e\u0435 \u041d\u0430\u0437\u0432\u0430\u043d\u0438\u0435";
+ const string RUSSIAN_JSON = "\"\\u0420\\u0443\\u0441\\u0441\\u043a\\u043e\\u0435 \\u041d\\u0430\\u0437\\u0432\\u0430\\u043d\\u0438\\u0435\"";
- // parse and check
- var stm = new MemoryStream(rawBytes);
- var trans = new TStreamTransport(stm, null);
- var prot = new TJSONProtocol(trans);
- Debug.Assert(prot.ReadString() == RUSSIAN_TEXT, "reading JSON with hex-encoded chars > 8 bit");
- }
- }
+ // prepare buffer with JSON data
+ byte[] rawBytes = new byte[RUSSIAN_JSON.Length];
+ for (var i = 0; i < RUSSIAN_JSON.Length; ++i)
+ rawBytes[i] = (byte)(RUSSIAN_JSON[i] & (char)0xFF); // only low bytes
+
+ // parse and check
+ var stm = new MemoryStream(rawBytes);
+ var trans = new TStreamTransport(stm, null);
+ var prot = new TJSONProtocol(trans);
+ Debug.Assert(prot.ReadString() == RUSSIAN_TEXT, "reading JSON with hex-encoded chars > 8 bit");
+ }
+ }
}
diff --git a/lib/csharp/test/JSON/Properties/AssemblyInfo.cs b/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
index 8629f6f..6788bc3 100644
--- a/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
+++ b/lib/csharp/test/JSON/Properties/AssemblyInfo.cs
@@ -21,7 +21,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
-// Allgemeine Informationen über eine Assembly werden über die folgenden
+// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die mit einer Assembly verknüpft sind.
[assembly: AssemblyTitle("JSONTest")]
@@ -33,8 +33,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
-// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
-// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
+// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
+// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
[assembly: ComVisible(false)]
@@ -44,11 +44,11 @@
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
-// Nebenversion
+// Nebenversion
// Buildnummer
// Revision
//
-// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
+// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
diff --git a/lib/csharp/test/JSON/app.config b/lib/csharp/test/JSON/app.config
index bc39140..9c1919d 100644
--- a/lib/csharp/test/JSON/app.config
+++ b/lib/csharp/test/JSON/app.config
@@ -1,21 +1,21 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- 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
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
--->
-<configuration>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ 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
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
diff --git a/lib/csharp/test/Multiplex/Client/Multiplex.Test.Client.cs b/lib/csharp/test/Multiplex/Client/Multiplex.Test.Client.cs
index 95ba5a4..ccfe21d 100644
--- a/lib/csharp/test/Multiplex/Client/Multiplex.Test.Client.cs
+++ b/lib/csharp/test/Multiplex/Client/Multiplex.Test.Client.cs
@@ -29,8 +29,8 @@
namespace Test.Multiplex.Client
{
- public class TestClient
- {
+ public class TestClient
+ {
private void Run()
{
try
@@ -49,7 +49,7 @@
multiplex = new TMultiplexedProtocol( Protocol, Constants.NAME_AGGR);
Aggr.Iface aggr = new Aggr.Client( multiplex);
-
+
sbyte i;
for( i = 1; 10 >= i; ++i)
{
diff --git a/lib/csharp/test/Multiplex/Multiplex.Test.Common.cs b/lib/csharp/test/Multiplex/Multiplex.Test.Common.cs
index 5296b68..a687852 100644
--- a/lib/csharp/test/Multiplex/Multiplex.Test.Common.cs
+++ b/lib/csharp/test/Multiplex/Multiplex.Test.Common.cs
@@ -30,8 +30,8 @@
namespace Test.Multiplex
{
- public class Constants
- {
+ public class Constants
+ {
public const string NAME_BENCHMARKSERVICE = "BenchmarkService";
public const string NAME_AGGR = "Aggr";
}
diff --git a/lib/csharp/test/Multiplex/Server/Multiplex.Test.Server.cs b/lib/csharp/test/Multiplex/Server/Multiplex.Test.Server.cs
index fbec1b7..61c2d7c 100644
--- a/lib/csharp/test/Multiplex/Server/Multiplex.Test.Server.cs
+++ b/lib/csharp/test/Multiplex/Server/Multiplex.Test.Server.cs
@@ -28,8 +28,8 @@
namespace Test.Multiplex.Server
{
- public class TestServer
- {
+ public class TestServer
+ {
public interface ITestHandler
{
void SetServer( TServer aServer);
@@ -38,7 +38,7 @@
protected class TestHandlerImpl : ITestHandler
{
private TServer Server;
-
+
public void SetServer( TServer aServer)
{
Server = aServer;
@@ -53,7 +53,7 @@
int prev, next, result;
prev = 0;
result = 1;
- while( n > 0)
+ while( n > 0)
{
next = result + prev;
prev = result;
@@ -110,7 +110,7 @@
(benchHandler as ITestHandler).SetServer(null);
(aggrHandler as ITestHandler).SetServer(null);
- }
+ }
catch( Exception e)
{
Console.WriteLine( e.Message);
@@ -118,7 +118,7 @@
Console.WriteLine( "done.");
}
-
+
static void Main(string[] args)
{
Execute();
diff --git a/lib/csharp/test/Multiplex/maketest.sh b/lib/csharp/test/Multiplex/maketest.sh
index a2bcde4..1f29ee2 100755
--- a/lib/csharp/test/Multiplex/maketest.sh
+++ b/lib/csharp/test/Multiplex/maketest.sh
@@ -22,13 +22,13 @@
../../../../compiler/cpp/thrift --gen csharp ../../../../contrib/async-test/aggr.thrift
../../../../compiler/cpp/thrift --gen csharp ../../../rb/benchmark/Benchmark.thrift
gmcs /t:library /out:./ThriftImpl.dll /recurse:./gen-csharp/* /reference:../../Thrift.dll Multiplex.Test.Common.cs
-gmcs /out:MultiplexClient.exe /reference:../../Thrift.dll /reference:ThriftImpl.dll Client/Multiplex.Test.Client.cs
-gmcs /out:MultiplexServer.exe /reference:../../Thrift.dll /reference:ThriftImpl.dll Server/Multiplex.Test.Server.cs
+gmcs /out:MultiplexClient.exe /reference:../../Thrift.dll /reference:ThriftImpl.dll Client/Multiplex.Test.Client.cs
+gmcs /out:MultiplexServer.exe /reference:../../Thrift.dll /reference:ThriftImpl.dll Server/Multiplex.Test.Server.cs
export MONO_PATH=../../
-timeout 120 ./MultiplexServer.exe &
+timeout 120 ./MultiplexServer.exe &
sleep 3;
./MultiplexClient.exe
diff --git a/lib/csharp/test/ThriftTest/Program.cs b/lib/csharp/test/ThriftTest/Program.cs
index 4c63ca4..3bf6796 100644
--- a/lib/csharp/test/ThriftTest/Program.cs
+++ b/lib/csharp/test/ThriftTest/Program.cs
@@ -29,33 +29,33 @@
namespace Test
{
- class Program
- {
- static void Main(string[] args)
- {
- if (args.Length == 0)
- {
- Console.WriteLine("must provide 'server' or 'client' arg");
- return;
- }
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ if (args.Length == 0)
+ {
+ Console.WriteLine("must provide 'server' or 'client' arg");
+ return;
+ }
- string[] subArgs = new string[args.Length - 1];
- for(int i = 1; i < args.Length; i++)
- {
- subArgs[i-1] = args[i];
- }
- if (args[0] == "client")
- {
- TestClient.Execute(subArgs);
- }
- else if (args[0] == "server")
- {
- TestServer.Execute(subArgs);
- }
- else
- {
- Console.WriteLine("first argument must be 'server' or 'client'");
- }
- }
- }
+ string[] subArgs = new string[args.Length - 1];
+ for(int i = 1; i < args.Length; i++)
+ {
+ subArgs[i-1] = args[i];
+ }
+ if (args[0] == "client")
+ {
+ TestClient.Execute(subArgs);
+ }
+ else if (args[0] == "server")
+ {
+ TestServer.Execute(subArgs);
+ }
+ else
+ {
+ Console.WriteLine("first argument must be 'server' or 'client'");
+ }
+ }
+ }
}
diff --git a/lib/csharp/test/ThriftTest/TestClient.cs b/lib/csharp/test/ThriftTest/TestClient.cs
index db0fe63..cb33473 100644
--- a/lib/csharp/test/ThriftTest/TestClient.cs
+++ b/lib/csharp/test/ThriftTest/TestClient.cs
@@ -27,453 +27,453 @@
namespace Test
{
- public class TestClient
- {
- private static int numIterations = 1;
- private static string protocol = "";
+ public class TestClient
+ {
+ private static int numIterations = 1;
+ private static string protocol = "";
- public static void Execute(string[] args)
- {
- try
- {
- string host = "localhost";
- int port = 9090;
- string url = null, pipe = null;
- int numThreads = 1;
- bool buffered = false, framed = false, encrypted = false;
+ public static void Execute(string[] args)
+ {
+ try
+ {
+ string host = "localhost";
+ int port = 9090;
+ string url = null, pipe = null;
+ int numThreads = 1;
+ bool buffered = false, framed = false, encrypted = false;
- try
- {
- for (int i = 0; i < args.Length; i++)
- {
- if (args[i] == "-u")
- {
- url = args[++i];
- }
- else if (args[i] == "-n")
- {
- numIterations = Convert.ToInt32(args[++i]);
- }
- 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" || args[i] == "--transport=framed")
- {
- framed = true;
- Console.WriteLine("Using framed transport");
- }
- else if (args[i] == "-t")
- {
- numThreads = Convert.ToInt32(args[++i]);
- }
- else if (args[i] == "--compact" || args[i] == "--protocol=compact")
- {
- protocol = "compact";
- Console.WriteLine("Using compact protocol");
- }
- 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)
- {
- Console.WriteLine(e.StackTrace);
- }
+ try
+ {
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i] == "-u")
+ {
+ url = args[++i];
+ }
+ else if (args[i] == "-n")
+ {
+ numIterations = Convert.ToInt32(args[++i]);
+ }
+ 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" || args[i] == "--transport=framed")
+ {
+ framed = true;
+ Console.WriteLine("Using framed transport");
+ }
+ else if (args[i] == "-t")
+ {
+ numThreads = Convert.ToInt32(args[++i]);
+ }
+ else if (args[i] == "--compact" || args[i] == "--protocol=compact")
+ {
+ protocol = "compact";
+ Console.WriteLine("Using compact protocol");
+ }
+ 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)
+ {
+ Console.WriteLine(e.StackTrace);
+ }
- //issue tests on separate threads simultaneously
- Thread[] threads = new Thread[numThreads];
- DateTime start = DateTime.Now;
- for (int test = 0; test < numThreads; test++)
- {
- Thread t = new Thread(new ParameterizedThreadStart(ClientThread));
- threads[test] = t;
- if (url == null)
- {
- // endpoint transport
- TTransport trans = null;
- if (pipe != null)
- trans = new TNamedPipeClientTransport(pipe);
- else
- {
- if (encrypted)
- trans = new TTLSSocket(host, port, "../../../../../keys/client.pem");
- else
- trans = new TSocket(host, port);
- }
+ //issue tests on separate threads simultaneously
+ Thread[] threads = new Thread[numThreads];
+ DateTime start = DateTime.Now;
+ for (int test = 0; test < numThreads; test++)
+ {
+ Thread t = new Thread(new ParameterizedThreadStart(ClientThread));
+ threads[test] = t;
+ if (url == null)
+ {
+ // endpoint transport
+ TTransport trans = null;
+ if (pipe != null)
+ trans = new TNamedPipeClientTransport(pipe);
+ else
+ {
+ if (encrypted)
+ trans = new TTLSSocket(host, port, "../../../../../keys/client.pem");
+ else
+ trans = new TSocket(host, port);
+ }
- // layered transport
- if (buffered)
- trans = new TBufferedTransport(trans as TStreamTransport);
- if (framed)
- trans = new TFramedTransport(trans);
+ // layered transport
+ if (buffered)
+ trans = new TBufferedTransport(trans as TStreamTransport);
+ if (framed)
+ trans = new TFramedTransport(trans);
- //ensure proper open/close of transport
- trans.Open();
- trans.Close();
- t.Start(trans);
- }
- else
- {
- THttpClient http = new THttpClient(new Uri(url));
- t.Start(http);
- }
- }
+ //ensure proper open/close of transport
+ trans.Open();
+ trans.Close();
+ t.Start(trans);
+ }
+ else
+ {
+ THttpClient http = new THttpClient(new Uri(url));
+ t.Start(http);
+ }
+ }
- for (int test = 0; test < numThreads; test++)
- {
- threads[test].Join();
- }
- Console.Write("Total time: " + (DateTime.Now - start));
- }
- catch (Exception outerEx)
- {
- Console.WriteLine(outerEx.Message + " ST: " + outerEx.StackTrace);
- }
+ for (int test = 0; test < numThreads; test++)
+ {
+ threads[test].Join();
+ }
+ Console.Write("Total time: " + (DateTime.Now - start));
+ }
+ catch (Exception outerEx)
+ {
+ Console.WriteLine(outerEx.Message + " ST: " + outerEx.StackTrace);
+ }
- Console.WriteLine();
- Console.WriteLine();
- }
+ Console.WriteLine();
+ Console.WriteLine();
+ }
- public static void ClientThread(object obj)
- {
- TTransport transport = (TTransport)obj;
- for (int i = 0; i < numIterations; i++)
- {
- ClientTest(transport);
- }
- transport.Close();
- }
+ public static void ClientThread(object obj)
+ {
+ TTransport transport = (TTransport)obj;
+ for (int i = 0; i < numIterations; i++)
+ {
+ ClientTest(transport);
+ }
+ transport.Close();
+ }
- public static void ClientTest(TTransport transport)
- {
- TProtocol proto;
- if (protocol == "compact")
- proto = new TCompactProtocol(transport);
- else if (protocol == "json")
- proto = new TJSONProtocol(transport);
- else
- proto = new TBinaryProtocol(transport);
+ public static void ClientTest(TTransport transport)
+ {
+ TProtocol proto;
+ if (protocol == "compact")
+ proto = new TCompactProtocol(transport);
+ else if (protocol == "json")
+ proto = new TJSONProtocol(transport);
+ else
+ proto = new TBinaryProtocol(transport);
- ThriftTest.Client client = new ThriftTest.Client(proto);
- try
- {
- if (!transport.IsOpen)
- {
- transport.Open();
- }
- }
- catch (TTransportException ttx)
- {
- Console.WriteLine("Connect failed: " + ttx.Message);
- return;
- }
+ ThriftTest.Client client = new ThriftTest.Client(proto);
+ try
+ {
+ if (!transport.IsOpen)
+ {
+ transport.Open();
+ }
+ }
+ catch (TTransportException ttx)
+ {
+ Console.WriteLine("Connect failed: " + ttx.Message);
+ return;
+ }
- long start = DateTime.Now.ToFileTime();
+ long start = DateTime.Now.ToFileTime();
- Console.Write("testVoid()");
- client.testVoid();
- Console.WriteLine(" = void");
+ Console.Write("testVoid()");
+ client.testVoid();
+ Console.WriteLine(" = void");
- Console.Write("testString(\"Test\")");
- string s = client.testString("Test");
- Console.WriteLine(" = \"" + s + "\"");
+ Console.Write("testString(\"Test\")");
+ string s = client.testString("Test");
+ Console.WriteLine(" = \"" + s + "\"");
- Console.Write("testByte(1)");
- sbyte i8 = client.testByte((sbyte)1);
- Console.WriteLine(" = " + i8);
+ Console.Write("testByte(1)");
+ sbyte i8 = client.testByte((sbyte)1);
+ Console.WriteLine(" = " + i8);
- Console.Write("testI32(-1)");
- int i32 = client.testI32(-1);
- Console.WriteLine(" = " + i32);
+ Console.Write("testI32(-1)");
+ int i32 = client.testI32(-1);
+ Console.WriteLine(" = " + i32);
- Console.Write("testI64(-34359738368)");
- long i64 = client.testI64(-34359738368);
- Console.WriteLine(" = " + i64);
+ Console.Write("testI64(-34359738368)");
+ long i64 = client.testI64(-34359738368);
+ Console.WriteLine(" = " + i64);
- Console.Write("testDouble(5.325098235)");
- double dub = client.testDouble(5.325098235);
- Console.WriteLine(" = " + dub);
+ Console.Write("testDouble(5.325098235)");
+ double dub = client.testDouble(5.325098235);
+ Console.WriteLine(" = " + dub);
- Console.Write("testStruct({\"Zero\", 1, -3, -5})");
- Xtruct o = new Xtruct();
- o.String_thing = "Zero";
- o.Byte_thing = (sbyte)1;
- o.I32_thing = -3;
- o.I64_thing = -5;
- Xtruct i = client.testStruct(o);
- Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
+ Console.Write("testStruct({\"Zero\", 1, -3, -5})");
+ Xtruct o = new Xtruct();
+ o.String_thing = "Zero";
+ o.Byte_thing = (sbyte)1;
+ o.I32_thing = -3;
+ o.I64_thing = -5;
+ Xtruct i = client.testStruct(o);
+ Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
- Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
- Xtruct2 o2 = new Xtruct2();
- o2.Byte_thing = (sbyte)1;
- o2.Struct_thing = o;
- o2.I32_thing = 5;
- Xtruct2 i2 = client.testNest(o2);
- i = i2.Struct_thing;
- Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
+ Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
+ Xtruct2 o2 = new Xtruct2();
+ o2.Byte_thing = (sbyte)1;
+ o2.Struct_thing = o;
+ o2.I32_thing = 5;
+ Xtruct2 i2 = client.testNest(o2);
+ i = i2.Struct_thing;
+ Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
- Dictionary<int, int> mapout = new Dictionary<int, int>();
- for (int j = 0; j < 5; j++)
- {
- mapout[j] = j - 10;
- }
- Console.Write("testMap({");
- bool first = true;
- foreach (int key in mapout.Keys)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(key + " => " + mapout[key]);
- }
- Console.Write("})");
+ Dictionary<int, int> mapout = new Dictionary<int, int>();
+ for (int j = 0; j < 5; j++)
+ {
+ mapout[j] = j - 10;
+ }
+ Console.Write("testMap({");
+ bool first = true;
+ foreach (int key in mapout.Keys)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(key + " => " + mapout[key]);
+ }
+ Console.Write("})");
- Dictionary<int, int> mapin = client.testMap(mapout);
+ Dictionary<int, int> mapin = client.testMap(mapout);
- Console.Write(" = {");
- first = true;
- foreach (int key in mapin.Keys)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(key + " => " + mapin[key]);
- }
- Console.WriteLine("}");
+ Console.Write(" = {");
+ first = true;
+ foreach (int key in mapin.Keys)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(key + " => " + mapin[key]);
+ }
+ Console.WriteLine("}");
- List<int> listout = new List<int>();
- for (int j = -2; j < 3; j++)
- {
- listout.Add(j);
- }
- Console.Write("testList({");
- first = true;
- foreach (int j in listout)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(j);
- }
- Console.Write("})");
+ List<int> listout = new List<int>();
+ for (int j = -2; j < 3; j++)
+ {
+ listout.Add(j);
+ }
+ Console.Write("testList({");
+ first = true;
+ foreach (int j in listout)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(j);
+ }
+ Console.Write("})");
- List<int> listin = client.testList(listout);
+ List<int> listin = client.testList(listout);
- Console.Write(" = {");
- first = true;
- foreach (int j in listin)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(j);
- }
- Console.WriteLine("}");
+ Console.Write(" = {");
+ first = true;
+ foreach (int j in listin)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(j);
+ }
+ Console.WriteLine("}");
- //set
- THashSet<int> setout = new THashSet<int>();
- for (int j = -2; j < 3; j++)
- {
- setout.Add(j);
- }
- Console.Write("testSet({");
- first = true;
- foreach (int j in setout)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(j);
- }
- Console.Write("})");
+ //set
+ THashSet<int> setout = new THashSet<int>();
+ for (int j = -2; j < 3; j++)
+ {
+ setout.Add(j);
+ }
+ Console.Write("testSet({");
+ first = true;
+ foreach (int j in setout)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(j);
+ }
+ Console.Write("})");
- THashSet<int> setin = client.testSet(setout);
+ THashSet<int> setin = client.testSet(setout);
- Console.Write(" = {");
- first = true;
- foreach (int j in setin)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.Write(", ");
- }
- Console.Write(j);
- }
- Console.WriteLine("}");
+ Console.Write(" = {");
+ first = true;
+ foreach (int j in setin)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.Write(", ");
+ }
+ Console.Write(j);
+ }
+ Console.WriteLine("}");
- Console.Write("testEnum(ONE)");
- Numberz ret = client.testEnum(Numberz.ONE);
- Console.WriteLine(" = " + ret);
+ Console.Write("testEnum(ONE)");
+ Numberz ret = client.testEnum(Numberz.ONE);
+ Console.WriteLine(" = " + ret);
- Console.Write("testEnum(TWO)");
- ret = client.testEnum(Numberz.TWO);
- Console.WriteLine(" = " + ret);
+ Console.Write("testEnum(TWO)");
+ ret = client.testEnum(Numberz.TWO);
+ Console.WriteLine(" = " + ret);
- Console.Write("testEnum(THREE)");
- ret = client.testEnum(Numberz.THREE);
- Console.WriteLine(" = " + ret);
+ Console.Write("testEnum(THREE)");
+ ret = client.testEnum(Numberz.THREE);
+ Console.WriteLine(" = " + ret);
- Console.Write("testEnum(FIVE)");
- ret = client.testEnum(Numberz.FIVE);
- Console.WriteLine(" = " + ret);
+ Console.Write("testEnum(FIVE)");
+ ret = client.testEnum(Numberz.FIVE);
+ Console.WriteLine(" = " + ret);
- Console.Write("testEnum(EIGHT)");
- ret = client.testEnum(Numberz.EIGHT);
- Console.WriteLine(" = " + ret);
+ Console.Write("testEnum(EIGHT)");
+ ret = client.testEnum(Numberz.EIGHT);
+ Console.WriteLine(" = " + ret);
- Console.Write("testTypedef(309858235082523)");
- long uid = client.testTypedef(309858235082523L);
- Console.WriteLine(" = " + uid);
+ Console.Write("testTypedef(309858235082523)");
+ long uid = client.testTypedef(309858235082523L);
+ Console.WriteLine(" = " + uid);
- Console.Write("testMapMap(1)");
- Dictionary<int, Dictionary<int, int>> mm = client.testMapMap(1);
- Console.Write(" = {");
- foreach (int key in mm.Keys)
- {
- Console.Write(key + " => {");
- Dictionary<int, int> m2 = mm[key];
- foreach (int k2 in m2.Keys)
- {
- Console.Write(k2 + " => " + m2[k2] + ", ");
- }
- Console.Write("}, ");
- }
- Console.WriteLine("}");
+ Console.Write("testMapMap(1)");
+ Dictionary<int, Dictionary<int, int>> mm = client.testMapMap(1);
+ Console.Write(" = {");
+ foreach (int key in mm.Keys)
+ {
+ Console.Write(key + " => {");
+ Dictionary<int, int> m2 = mm[key];
+ foreach (int k2 in m2.Keys)
+ {
+ Console.Write(k2 + " => " + m2[k2] + ", ");
+ }
+ Console.Write("}, ");
+ }
+ Console.WriteLine("}");
- Insanity insane = new Insanity();
- insane.UserMap = new Dictionary<Numberz, long>();
- insane.UserMap[Numberz.FIVE] = 5000L;
- Xtruct truck = new Xtruct();
- truck.String_thing = "Truck";
- truck.Byte_thing = (sbyte)8;
- truck.I32_thing = 8;
- truck.I64_thing = 8;
- insane.Xtructs = new List<Xtruct>();
- insane.Xtructs.Add(truck);
- Console.Write("testInsanity()");
- Dictionary<long, Dictionary<Numberz, Insanity>> whoa = client.testInsanity(insane);
- Console.Write(" = {");
- foreach (long key in whoa.Keys)
- {
- Dictionary<Numberz, Insanity> val = whoa[key];
- Console.Write(key + " => {");
+ Insanity insane = new Insanity();
+ insane.UserMap = new Dictionary<Numberz, long>();
+ insane.UserMap[Numberz.FIVE] = 5000L;
+ Xtruct truck = new Xtruct();
+ truck.String_thing = "Truck";
+ truck.Byte_thing = (sbyte)8;
+ truck.I32_thing = 8;
+ truck.I64_thing = 8;
+ insane.Xtructs = new List<Xtruct>();
+ insane.Xtructs.Add(truck);
+ Console.Write("testInsanity()");
+ Dictionary<long, Dictionary<Numberz, Insanity>> whoa = client.testInsanity(insane);
+ Console.Write(" = {");
+ foreach (long key in whoa.Keys)
+ {
+ Dictionary<Numberz, Insanity> val = whoa[key];
+ Console.Write(key + " => {");
- foreach (Numberz k2 in val.Keys)
- {
- Insanity v2 = val[k2];
+ foreach (Numberz k2 in val.Keys)
+ {
+ Insanity v2 = val[k2];
- Console.Write(k2 + " => {");
- Dictionary<Numberz, long> userMap = v2.UserMap;
+ Console.Write(k2 + " => {");
+ Dictionary<Numberz, long> userMap = v2.UserMap;
- Console.Write("{");
- if (userMap != null)
- {
- foreach (Numberz k3 in userMap.Keys)
- {
- Console.Write(k3 + " => " + userMap[k3] + ", ");
- }
- }
- else
- {
- Console.Write("null");
- }
- Console.Write("}, ");
+ Console.Write("{");
+ if (userMap != null)
+ {
+ foreach (Numberz k3 in userMap.Keys)
+ {
+ Console.Write(k3 + " => " + userMap[k3] + ", ");
+ }
+ }
+ else
+ {
+ Console.Write("null");
+ }
+ Console.Write("}, ");
- List<Xtruct> xtructs = v2.Xtructs;
+ List<Xtruct> xtructs = v2.Xtructs;
- Console.Write("{");
- if (xtructs != null)
- {
- foreach (Xtruct x in xtructs)
- {
- Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, ");
- }
- }
- else
- {
- Console.Write("null");
- }
- Console.Write("}");
+ Console.Write("{");
+ if (xtructs != null)
+ {
+ foreach (Xtruct x in xtructs)
+ {
+ Console.Write("{\"" + x.String_thing + "\", " + x.Byte_thing + ", " + x.I32_thing + ", " + x.I32_thing + "}, ");
+ }
+ }
+ else
+ {
+ Console.Write("null");
+ }
+ Console.Write("}");
- Console.Write("}, ");
- }
- Console.Write("}, ");
- }
- Console.WriteLine("}");
+ Console.Write("}, ");
+ }
+ Console.Write("}, ");
+ }
+ Console.WriteLine("}");
- sbyte arg0 = 1;
- int arg1 = 2;
- long arg2 = long.MaxValue;
- Dictionary<short, string> multiDict = new Dictionary<short, string>();
- multiDict[1] = "one";
- Numberz arg4 = Numberz.FIVE;
- long arg5 = 5000000;
- Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
- Xtruct multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
- Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing
- + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n");
+ sbyte arg0 = 1;
+ int arg1 = 2;
+ long arg2 = long.MaxValue;
+ Dictionary<short, string> multiDict = new Dictionary<short, string>();
+ multiDict[1] = "one";
+ Numberz arg4 = Numberz.FIVE;
+ long arg5 = 5000000;
+ Console.Write("Test Multi(" + arg0 + "," + arg1 + "," + arg2 + "," + multiDict + "," + arg4 + "," + arg5 + ")");
+ Xtruct multiResponse = client.testMulti(arg0, arg1, arg2, multiDict, arg4, arg5);
+ Console.Write(" = Xtruct(byte_thing:" + multiResponse.Byte_thing + ",String_thing:" + multiResponse.String_thing
+ + ",i32_thing:" + multiResponse.I32_thing + ",i64_thing:" + multiResponse.I64_thing + ")\n");
- Console.WriteLine("Test Oneway(1)");
- client.testOneway(1);
+ Console.WriteLine("Test Oneway(1)");
+ client.testOneway(1);
- Console.Write("Test Calltime()");
- var startt = DateTime.UtcNow;
- for ( int k=0; k<1000; ++k )
- client.testVoid();
- Console.WriteLine(" = " + (DateTime.UtcNow - startt).TotalSeconds.ToString() + " ms a testVoid() call" );
- }
- }
+ Console.Write("Test Calltime()");
+ var startt = DateTime.UtcNow;
+ for ( int k=0; k<1000; ++k )
+ client.testVoid();
+ Console.WriteLine(" = " + (DateTime.UtcNow - startt).TotalSeconds.ToString() + " ms a testVoid() call" );
+ }
+ }
}
diff --git a/lib/csharp/test/ThriftTest/TestServer.cs b/lib/csharp/test/ThriftTest/TestServer.cs
index 92ef374..d944e72 100644
--- a/lib/csharp/test/ThriftTest/TestServer.cs
+++ b/lib/csharp/test/ThriftTest/TestServer.cs
@@ -32,8 +32,8 @@
namespace Test
{
- public class TestServer
- {
+ public class TestServer
+ {
public class TradeServerEventHandler : TServerEventHandler
{
public int callCount = 0;
@@ -56,395 +56,395 @@
}
};
- public class TestHandler : ThriftTest.Iface
- {
- public TServer server;
+ public class TestHandler : ThriftTest.Iface
+ {
+ public TServer server;
- public TestHandler() { }
+ public TestHandler() { }
- public void testVoid()
- {
- Console.WriteLine("testVoid()");
- }
+ public void testVoid()
+ {
+ Console.WriteLine("testVoid()");
+ }
- public string testString(string thing)
- {
- Console.WriteLine("teststring(\"" + thing + "\")");
- return thing;
- }
+ public string testString(string thing)
+ {
+ Console.WriteLine("teststring(\"" + thing + "\")");
+ return thing;
+ }
- public sbyte testByte(sbyte thing)
- {
- Console.WriteLine("testByte(" + thing + ")");
- return thing;
- }
+ public sbyte testByte(sbyte thing)
+ {
+ Console.WriteLine("testByte(" + thing + ")");
+ return thing;
+ }
- public int testI32(int thing)
- {
- Console.WriteLine("testI32(" + thing + ")");
- return thing;
- }
+ public int testI32(int thing)
+ {
+ Console.WriteLine("testI32(" + thing + ")");
+ return thing;
+ }
- public long testI64(long thing)
- {
- Console.WriteLine("testI64(" + thing + ")");
- return thing;
- }
+ public long testI64(long thing)
+ {
+ Console.WriteLine("testI64(" + thing + ")");
+ return thing;
+ }
- public double testDouble(double thing)
- {
- Console.WriteLine("testDouble(" + thing + ")");
- return thing;
- }
+ public double testDouble(double thing)
+ {
+ Console.WriteLine("testDouble(" + thing + ")");
+ return thing;
+ }
- public Xtruct testStruct(Xtruct thing)
- {
- Console.WriteLine("testStruct({" +
- "\"" + thing.String_thing + "\", " +
- thing.Byte_thing + ", " +
- thing.I32_thing + ", " +
- thing.I64_thing + "})");
- return thing;
- }
+ public Xtruct testStruct(Xtruct thing)
+ {
+ Console.WriteLine("testStruct({" +
+ "\"" + thing.String_thing + "\", " +
+ thing.Byte_thing + ", " +
+ thing.I32_thing + ", " +
+ thing.I64_thing + "})");
+ return thing;
+ }
- public Xtruct2 testNest(Xtruct2 nest)
- {
- Xtruct thing = nest.Struct_thing;
- Console.WriteLine("testNest({" +
- nest.Byte_thing + ", {" +
- "\"" + thing.String_thing + "\", " +
- thing.Byte_thing + ", " +
- thing.I32_thing + ", " +
- thing.I64_thing + "}, " +
- nest.I32_thing + "})");
- return nest;
- }
+ public Xtruct2 testNest(Xtruct2 nest)
+ {
+ Xtruct thing = nest.Struct_thing;
+ Console.WriteLine("testNest({" +
+ nest.Byte_thing + ", {" +
+ "\"" + thing.String_thing + "\", " +
+ thing.Byte_thing + ", " +
+ thing.I32_thing + ", " +
+ thing.I64_thing + "}, " +
+ nest.I32_thing + "})");
+ return nest;
+ }
- public Dictionary<int, int> testMap(Dictionary<int, int> thing)
- {
- Console.WriteLine("testMap({");
- bool first = true;
- foreach (int key in thing.Keys)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.WriteLine(", ");
- }
- Console.WriteLine(key + " => " + thing[key]);
- }
- Console.WriteLine("})");
- return thing;
- }
+ public Dictionary<int, int> testMap(Dictionary<int, int> thing)
+ {
+ Console.WriteLine("testMap({");
+ bool first = true;
+ foreach (int key in thing.Keys)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.WriteLine(", ");
+ }
+ Console.WriteLine(key + " => " + thing[key]);
+ }
+ Console.WriteLine("})");
+ return thing;
+ }
- public Dictionary<string, string> testStringMap(Dictionary<string, string> thing)
- {
- Console.WriteLine("testStringMap({");
- bool first = true;
- foreach (string key in thing.Keys)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.WriteLine(", ");
- }
- Console.WriteLine(key + " => " + thing[key]);
- }
- Console.WriteLine("})");
- return thing;
- }
+ public Dictionary<string, string> testStringMap(Dictionary<string, string> thing)
+ {
+ Console.WriteLine("testStringMap({");
+ bool first = true;
+ foreach (string key in thing.Keys)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.WriteLine(", ");
+ }
+ Console.WriteLine(key + " => " + thing[key]);
+ }
+ Console.WriteLine("})");
+ return thing;
+ }
- public THashSet<int> testSet(THashSet<int> thing)
- {
- Console.WriteLine("testSet({");
- bool first = true;
- foreach (int elem in thing)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.WriteLine(", ");
- }
- Console.WriteLine(elem);
- }
- Console.WriteLine("})");
- return thing;
- }
+ public THashSet<int> testSet(THashSet<int> thing)
+ {
+ Console.WriteLine("testSet({");
+ bool first = true;
+ foreach (int elem in thing)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.WriteLine(", ");
+ }
+ Console.WriteLine(elem);
+ }
+ Console.WriteLine("})");
+ return thing;
+ }
- public List<int> testList(List<int> thing)
- {
- Console.WriteLine("testList({");
- bool first = true;
- foreach (int elem in thing)
- {
- if (first)
- {
- first = false;
- }
- else
- {
- Console.WriteLine(", ");
- }
- Console.WriteLine(elem);
- }
- Console.WriteLine("})");
- return thing;
- }
+ public List<int> testList(List<int> thing)
+ {
+ Console.WriteLine("testList({");
+ bool first = true;
+ foreach (int elem in thing)
+ {
+ if (first)
+ {
+ first = false;
+ }
+ else
+ {
+ Console.WriteLine(", ");
+ }
+ Console.WriteLine(elem);
+ }
+ Console.WriteLine("})");
+ return thing;
+ }
- public Numberz testEnum(Numberz thing)
- {
- Console.WriteLine("testEnum(" + thing + ")");
- return thing;
- }
+ public Numberz testEnum(Numberz thing)
+ {
+ Console.WriteLine("testEnum(" + thing + ")");
+ return thing;
+ }
- public long testTypedef(long thing)
- {
- Console.WriteLine("testTypedef(" + thing + ")");
- return thing;
- }
+ public long testTypedef(long thing)
+ {
+ Console.WriteLine("testTypedef(" + thing + ")");
+ return thing;
+ }
- public Dictionary<int, Dictionary<int, int>> testMapMap(int hello)
- {
- Console.WriteLine("testMapMap(" + hello + ")");
- Dictionary<int, Dictionary<int, int>> mapmap =
- new Dictionary<int, Dictionary<int, int>>();
+ public Dictionary<int, Dictionary<int, int>> testMapMap(int hello)
+ {
+ Console.WriteLine("testMapMap(" + hello + ")");
+ Dictionary<int, Dictionary<int, int>> mapmap =
+ new Dictionary<int, Dictionary<int, int>>();
- Dictionary<int, int> pos = new Dictionary<int, int>();
- Dictionary<int, int> neg = new Dictionary<int, int>();
- for (int i = 1; i < 5; i++)
- {
- pos[i] = i;
- neg[-i] = -i;
- }
+ Dictionary<int, int> pos = new Dictionary<int, int>();
+ Dictionary<int, int> neg = new Dictionary<int, int>();
+ for (int i = 1; i < 5; i++)
+ {
+ pos[i] = i;
+ neg[-i] = -i;
+ }
- mapmap[4] = pos;
- mapmap[-4] = neg;
+ mapmap[4] = pos;
+ mapmap[-4] = neg;
- return mapmap;
- }
+ return mapmap;
+ }
- public Dictionary<long, Dictionary<Numberz, Insanity>> testInsanity(Insanity argument)
- {
- Console.WriteLine("testInsanity()");
+ public Dictionary<long, Dictionary<Numberz, Insanity>> testInsanity(Insanity argument)
+ {
+ Console.WriteLine("testInsanity()");
- Xtruct hello = new Xtruct();
- hello.String_thing = "Hello2";
- hello.Byte_thing = 2;
- hello.I32_thing = 2;
- hello.I64_thing = 2;
+ Xtruct hello = new Xtruct();
+ hello.String_thing = "Hello2";
+ hello.Byte_thing = 2;
+ hello.I32_thing = 2;
+ hello.I64_thing = 2;
- Xtruct goodbye = new Xtruct();
- goodbye.String_thing = "Goodbye4";
- goodbye.Byte_thing = (sbyte)4;
- goodbye.I32_thing = 4;
- goodbye.I64_thing = (long)4;
+ Xtruct goodbye = new Xtruct();
+ goodbye.String_thing = "Goodbye4";
+ goodbye.Byte_thing = (sbyte)4;
+ goodbye.I32_thing = 4;
+ goodbye.I64_thing = (long)4;
- Insanity crazy = new Insanity();
- crazy.UserMap = new Dictionary<Numberz, long>();
- crazy.UserMap[Numberz.EIGHT] = (long)8;
- crazy.Xtructs = new List<Xtruct>();
- crazy.Xtructs.Add(goodbye);
+ Insanity crazy = new Insanity();
+ crazy.UserMap = new Dictionary<Numberz, long>();
+ crazy.UserMap[Numberz.EIGHT] = (long)8;
+ crazy.Xtructs = new List<Xtruct>();
+ crazy.Xtructs.Add(goodbye);
- Insanity looney = new Insanity();
- crazy.UserMap[Numberz.FIVE] = (long)5;
- crazy.Xtructs.Add(hello);
+ Insanity looney = new Insanity();
+ crazy.UserMap[Numberz.FIVE] = (long)5;
+ crazy.Xtructs.Add(hello);
- Dictionary<Numberz, Insanity> first_map = new Dictionary<Numberz, Insanity>();
- Dictionary<Numberz, Insanity> second_map = new Dictionary<Numberz, Insanity>(); ;
+ Dictionary<Numberz, Insanity> first_map = new Dictionary<Numberz, Insanity>();
+ Dictionary<Numberz, Insanity> second_map = new Dictionary<Numberz, Insanity>(); ;
- first_map[Numberz.TWO] = crazy;
- first_map[Numberz.THREE] = crazy;
+ first_map[Numberz.TWO] = crazy;
+ first_map[Numberz.THREE] = crazy;
- second_map[Numberz.SIX] = looney;
+ second_map[Numberz.SIX] = looney;
- Dictionary<long, Dictionary<Numberz, Insanity>> insane =
- new Dictionary<long, Dictionary<Numberz, Insanity>>();
- insane[(long)1] = first_map;
- insane[(long)2] = second_map;
+ Dictionary<long, Dictionary<Numberz, Insanity>> insane =
+ new Dictionary<long, Dictionary<Numberz, Insanity>>();
+ insane[(long)1] = first_map;
+ insane[(long)2] = second_map;
- return insane;
- }
+ return insane;
+ }
- public Xtruct testMulti(sbyte arg0, int arg1, long arg2, Dictionary<short, string> arg3, Numberz arg4, long arg5)
- {
- Console.WriteLine("testMulti()");
+ public Xtruct testMulti(sbyte arg0, int arg1, long arg2, Dictionary<short, string> arg3, Numberz arg4, long arg5)
+ {
+ Console.WriteLine("testMulti()");
- Xtruct hello = new Xtruct(); ;
- hello.String_thing = "Hello2";
- hello.Byte_thing = arg0;
- hello.I32_thing = arg1;
- hello.I64_thing = arg2;
- return hello;
- }
+ Xtruct hello = new Xtruct(); ;
+ hello.String_thing = "Hello2";
+ hello.Byte_thing = arg0;
+ hello.I32_thing = arg1;
+ hello.I64_thing = arg2;
+ return hello;
+ }
- public void testException(string arg)
- {
- Console.WriteLine("testException(" + arg + ")");
- if (arg == "Xception")
- {
- Xception x = new Xception();
- x.ErrorCode = 1001;
- x.Message = "This is an Xception";
- throw x;
- }
- return;
- }
+ public void testException(string arg)
+ {
+ Console.WriteLine("testException(" + arg + ")");
+ if (arg == "Xception")
+ {
+ Xception x = new Xception();
+ x.ErrorCode = 1001;
+ x.Message = "This is an Xception";
+ throw x;
+ }
+ return;
+ }
- public Xtruct testMultiException(string arg0, string arg1)
- {
- Console.WriteLine("testMultiException(" + arg0 + ", " + arg1 + ")");
- if (arg0 == "Xception")
- {
- Xception x = new Xception();
- x.ErrorCode = 1001;
- x.Message = "This is an Xception";
- throw x;
- }
- else if (arg0 == "Xception2")
- {
- Xception2 x = new Xception2();
- x.ErrorCode = 2002;
- x.Struct_thing = new Xtruct();
- x.Struct_thing.String_thing = "This is an Xception2";
- throw x;
- }
+ public Xtruct testMultiException(string arg0, string arg1)
+ {
+ Console.WriteLine("testMultiException(" + arg0 + ", " + arg1 + ")");
+ if (arg0 == "Xception")
+ {
+ Xception x = new Xception();
+ x.ErrorCode = 1001;
+ x.Message = "This is an Xception";
+ throw x;
+ }
+ else if (arg0 == "Xception2")
+ {
+ Xception2 x = new Xception2();
+ x.ErrorCode = 2002;
+ x.Struct_thing = new Xtruct();
+ x.Struct_thing.String_thing = "This is an Xception2";
+ throw x;
+ }
- Xtruct result = new Xtruct();
- result.String_thing = arg1;
- return result;
- }
+ Xtruct result = new Xtruct();
+ result.String_thing = arg1;
+ return result;
+ }
- public void testStop()
- {
- if (server != null)
- {
- server.Stop();
- }
- }
+ public void testStop()
+ {
+ if (server != null)
+ {
+ server.Stop();
+ }
+ }
- public void testOneway(int arg)
- {
- Console.WriteLine("testOneway(" + arg + "), sleeping...");
- System.Threading.Thread.Sleep(arg * 1000);
- Console.WriteLine("testOneway finished");
- }
+ public void testOneway(int arg)
+ {
+ Console.WriteLine("testOneway(" + arg + "), sleeping...");
+ System.Threading.Thread.Sleep(arg * 1000);
+ Console.WriteLine("testOneway finished");
+ }
- } // class TestHandler
+ } // class TestHandler
- public static void Execute(string[] args)
- {
- try
- {
- bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false;
- int port = 9090;
- string pipe = null;
- for (int i = 0; i < args.Length; i++)
- {
- if (args[i] == "-pipe") // -pipe name
- {
- pipe = args[++i];
- }
- 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")
- {
- 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")
- {
- useEncryption = true;
- }
- }
+ public static void Execute(string[] args)
+ {
+ try
+ {
+ bool useBufferedSockets = false, useFramed = false, useEncryption = false, compact = false, json = false;
+ int port = 9090;
+ string pipe = null;
+ for (int i = 0; i < args.Length; i++)
+ {
+ if (args[i] == "-pipe") // -pipe name
+ {
+ pipe = args[++i];
+ }
+ 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")
+ {
+ 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")
+ {
+ useEncryption = true;
+ }
+ }
- // Processor
- TestHandler testHandler = new TestHandler();
- ThriftTest.Processor testProcessor = new ThriftTest.Processor(testHandler);
+ // Processor
+ TestHandler testHandler = new TestHandler();
+ ThriftTest.Processor testProcessor = new ThriftTest.Processor(testHandler);
- // Transport
- TServerTransport trans;
- if( pipe != null)
- {
- trans = new TNamedPipeServerTransport(pipe);
- }
- else
- {
- if (useEncryption)
- {
- trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2("../../../../../keys/server.pem"));
- }
- else
- {
- trans = new TServerSocket(port, 0, useBufferedSockets);
- }
- }
+ // Transport
+ TServerTransport trans;
+ if( pipe != null)
+ {
+ trans = new TNamedPipeServerTransport(pipe);
+ }
+ else
+ {
+ if (useEncryption)
+ {
+ trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2("../../../../../keys/server.pem"));
+ }
+ else
+ {
+ trans = new TServerSocket(port, 0, useBufferedSockets);
+ }
+ }
- TProtocolFactory proto;
- if ( compact )
- proto = new TCompactProtocol.Factory();
- else if ( json )
- proto = new TJSONProtocol.Factory();
- else
- proto = new TBinaryProtocol.Factory();
-
- // Simple Server
- TServer serverEngine;
- if ( useFramed )
- serverEngine = new TSimpleServer(testProcessor, trans, new TFramedTransport.Factory(), proto);
- else
- serverEngine = new TSimpleServer(testProcessor, trans, new TTransportFactory(), proto);
+ TProtocolFactory proto;
+ if ( compact )
+ proto = new TCompactProtocol.Factory();
+ else if ( json )
+ proto = new TJSONProtocol.Factory();
+ else
+ proto = new TBinaryProtocol.Factory();
- // ThreadPool Server
- // serverEngine = new TThreadPoolServer(testProcessor, tServerSocket);
+ // Simple Server
+ TServer serverEngine;
+ if ( useFramed )
+ serverEngine = new TSimpleServer(testProcessor, trans, new TFramedTransport.Factory(), proto);
+ else
+ serverEngine = new TSimpleServer(testProcessor, trans, new TTransportFactory(), proto);
- // Threaded Server
- // serverEngine = new TThreadedServer(testProcessor, tServerSocket);
+ // ThreadPool Server
+ // serverEngine = new TThreadPoolServer(testProcessor, tServerSocket);
+
+ // Threaded Server
+ // serverEngine = new TThreadedServer(testProcessor, tServerSocket);
//Server event handler
TradeServerEventHandler serverEvents = new TradeServerEventHandler();
serverEngine.setEventHandler(serverEvents);
- testHandler.server = serverEngine;
+ testHandler.server = serverEngine;
- // 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" : "") +
- (json ? " with json protocol" : "") +
- "...");
- serverEngine.Serve();
+ // 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" : "") +
+ (json ? " with json protocol" : "") +
+ "...");
+ serverEngine.Serve();
- }
- catch (Exception x)
- {
- Console.Error.Write(x);
- }
- Console.WriteLine("done.");
- }
- }
+ }
+ catch (Exception x)
+ {
+ Console.Error.Write(x);
+ }
+ Console.WriteLine("done.");
+ }
+ }
}