Upgrading dependency to Thrift 0.12.0
This commit is contained in:
parent
3e4590dcc0
commit
356978cb42
1302 changed files with 101701 additions and 26784 deletions
8
vendor/git.apache.org/thrift.git/test/csharp/Makefile.am
generated
vendored
8
vendor/git.apache.org/thrift.git/test/csharp/Makefile.am
generated
vendored
|
@ -85,3 +85,11 @@ check-local: TestClientServer.exe
|
|||
MONO_PATH=$(LIBDIR) timeout 10 mono TestClientServer.exe server --port=$(TESTPORT) &
|
||||
sleep 1
|
||||
MONO_PATH=$(LIBDIR) mono TestClientServer.exe client --port=$(TESTPORT)
|
||||
|
||||
EXTRA_DIST = \
|
||||
Properties/AssemblyInfo.cs \
|
||||
ThriftTest.csproj \
|
||||
ThriftTest.sln \
|
||||
Program.cs \
|
||||
TestServer.cs \
|
||||
TestClient.cs
|
||||
|
|
6
vendor/git.apache.org/thrift.git/test/csharp/Properties/AssemblyInfo.cs
generated
vendored
6
vendor/git.apache.org/thrift.git/test/csharp/Properties/AssemblyInfo.cs
generated
vendored
|
@ -27,9 +27,9 @@ using System.Runtime.InteropServices;
|
|||
[assembly: AssemblyTitle("ThriftTest")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ThriftTest")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2009 The Apache Software Foundation")]
|
||||
[assembly: AssemblyCompany("The Apache Software Foundation")]
|
||||
[assembly: AssemblyProduct("Thrift")]
|
||||
[assembly: AssemblyCopyright("The Apache Software Foundation")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
|
90
vendor/git.apache.org/thrift.git/test/csharp/TestClient.cs
generated
vendored
90
vendor/git.apache.org/thrift.git/test/csharp/TestClient.cs
generated
vendored
|
@ -33,7 +33,7 @@ namespace Test
|
|||
{
|
||||
public class TestClient
|
||||
{
|
||||
private class TestParams
|
||||
public class TestParams
|
||||
{
|
||||
public int numIterations = 1;
|
||||
public string host = "localhost";
|
||||
|
@ -44,6 +44,7 @@ namespace Test
|
|||
public bool framed;
|
||||
public string protocol;
|
||||
public bool encrypted = false;
|
||||
public bool multiplexed = false;
|
||||
protected bool _isFirstTransport = true;
|
||||
|
||||
|
||||
|
@ -61,7 +62,9 @@ namespace Test
|
|||
{
|
||||
string certPath = "../keys/client.p12";
|
||||
X509Certificate cert = new X509Certificate2(certPath, "thrift");
|
||||
trans = new TTLSSocket(host, port, 0, cert, (o, c, chain, errors) => true, null, SslProtocols.Tls);
|
||||
trans = new TTLSSocket(host, port, 0, cert,
|
||||
(o, c, chain, errors) => true,
|
||||
null, SslProtocols.Tls);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,21 +108,30 @@ namespace Test
|
|||
private const int ErrorStructs = 2;
|
||||
private const int ErrorContainers = 4;
|
||||
private const int ErrorExceptions = 8;
|
||||
private const int ErrorProtocol = 16;
|
||||
private const int ErrorUnknown = 64;
|
||||
|
||||
private class ClientTest
|
||||
{
|
||||
private readonly TestParams param;
|
||||
private readonly TTransport transport;
|
||||
private readonly SecondService.Client second;
|
||||
private readonly ThriftTest.Client client;
|
||||
private readonly int numIterations;
|
||||
private bool done;
|
||||
|
||||
public int ReturnCode { get; set; }
|
||||
|
||||
public ClientTest(TestParams param)
|
||||
public ClientTest(TestParams paramin)
|
||||
{
|
||||
param = paramin;
|
||||
transport = param.CreateTransport();
|
||||
client = new ThriftTest.Client(param.CreateProtocol(transport));
|
||||
TProtocol protocol = param.CreateProtocol(transport);
|
||||
if (param.multiplexed)
|
||||
{
|
||||
second = new SecondService.Client(new TMultiplexedProtocol(protocol, "SecondService"));
|
||||
}
|
||||
client = new ThriftTest.Client(protocol);
|
||||
numIterations = param.numIterations;
|
||||
}
|
||||
public void Execute()
|
||||
|
@ -148,7 +160,7 @@ namespace Test
|
|||
|
||||
try
|
||||
{
|
||||
ReturnCode |= ExecuteClientTest(client);
|
||||
ReturnCode |= ExecuteClientTest(client, second, param);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -215,12 +227,12 @@ namespace Test
|
|||
{
|
||||
numThreads = Convert.ToInt32(args[++i]);
|
||||
}
|
||||
else if (args[i] == "--compact" || args[i] == "--protocol=compact")
|
||||
else if (args[i] == "--compact" || args[i] == "--protocol=compact" || args[i] == "--protocol=multic")
|
||||
{
|
||||
param.protocol = "compact";
|
||||
Console.WriteLine("Using compact protocol");
|
||||
}
|
||||
else if (args[i] == "--json" || args[i] == "--protocol=json")
|
||||
else if (args[i] == "--json" || args[i] == "--protocol=json" || args[i] == "--protocol=multij")
|
||||
{
|
||||
param.protocol = "json";
|
||||
Console.WriteLine("Using JSON protocol");
|
||||
|
@ -230,6 +242,11 @@ namespace Test
|
|||
param.encrypted = true;
|
||||
Console.WriteLine("Using encrypted transport");
|
||||
}
|
||||
|
||||
if (args[i].StartsWith("--protocol=multi"))
|
||||
{
|
||||
param.multiplexed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -265,10 +282,11 @@ namespace Test
|
|||
return BitConverter.ToString(data).Replace("-", string.Empty);
|
||||
}
|
||||
|
||||
public static byte[] PrepareTestData(bool randomDist)
|
||||
public static byte[] PrepareTestData(bool randomDist, bool huge)
|
||||
{
|
||||
byte[] retval = new byte[0x100];
|
||||
int initLen = Math.Min(0x100,retval.Length);
|
||||
// huge = true tests for THRIFT-4372
|
||||
byte[] retval = new byte[huge ? 0x12345 : 0x100];
|
||||
int initLen = retval.Length;
|
||||
|
||||
// linear distribution, unless random is requested
|
||||
if (!randomDist) {
|
||||
|
@ -295,7 +313,7 @@ namespace Test
|
|||
return retval;
|
||||
}
|
||||
|
||||
public static int ExecuteClientTest(ThriftTest.Client client)
|
||||
public static int ExecuteClientTest(ThriftTest.Client client, SecondService.Client second, TestParams param)
|
||||
{
|
||||
int returnCode = 0;
|
||||
|
||||
|
@ -312,6 +330,18 @@ namespace Test
|
|||
returnCode |= ErrorBaseTypes;
|
||||
}
|
||||
|
||||
if (param.multiplexed)
|
||||
{
|
||||
Console.WriteLine("secondTestString(\"Test2\")");
|
||||
s = second.secondtestString("Test2");
|
||||
Console.WriteLine(" = \"" + s + "\"");
|
||||
if ("testString(\"Test2\")" != s)
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorProtocol;
|
||||
}
|
||||
}
|
||||
|
||||
Console.Write("testBool(true)");
|
||||
bool t = client.testBool((bool)true);
|
||||
Console.WriteLine(" = " + t);
|
||||
|
@ -374,29 +404,33 @@ namespace Test
|
|||
returnCode |= ErrorBaseTypes;
|
||||
}
|
||||
|
||||
byte[] binOut = PrepareTestData(true);
|
||||
Console.Write("testBinary(" + BytesToHex(binOut) + ")");
|
||||
try
|
||||
for (i32 = 0; i32 < 2; ++i32)
|
||||
{
|
||||
byte[] binIn = client.testBinary(binOut);
|
||||
Console.WriteLine(" = " + BytesToHex(binIn));
|
||||
if (binIn.Length != binOut.Length)
|
||||
var huge = (i32 > 0);
|
||||
byte[] binOut = PrepareTestData(false,huge);
|
||||
Console.Write("testBinary(" + BytesToHex(binOut) + ")");
|
||||
try
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorBaseTypes;
|
||||
}
|
||||
for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
|
||||
if (binIn[ofs] != binOut[ofs])
|
||||
byte[] binIn = client.testBinary(binOut);
|
||||
Console.WriteLine(" = " + BytesToHex(binIn));
|
||||
if (binIn.Length != binOut.Length)
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorBaseTypes;
|
||||
}
|
||||
}
|
||||
catch (Thrift.TApplicationException ex)
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorBaseTypes;
|
||||
Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
|
||||
for (int ofs = 0; ofs < Math.Min(binIn.Length, binOut.Length); ++ofs)
|
||||
if (binIn[ofs] != binOut[ofs])
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorBaseTypes;
|
||||
}
|
||||
}
|
||||
catch (Thrift.TApplicationException ex)
|
||||
{
|
||||
Console.WriteLine("*** FAILED ***");
|
||||
returnCode |= ErrorBaseTypes;
|
||||
Console.WriteLine(ex.Message + " ST: " + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
|
||||
// binary equals? only with hashcode option enabled ...
|
||||
|
|
82
vendor/git.apache.org/thrift.git/test/csharp/TestServer.cs
generated
vendored
82
vendor/git.apache.org/thrift.git/test/csharp/TestServer.cs
generated
vendored
|
@ -41,27 +41,28 @@ namespace Test
|
|||
public static int _clientID = -1;
|
||||
public delegate void TestLogDelegate(string msg, params object[] values);
|
||||
|
||||
public class TradeServerEventHandler : TServerEventHandler
|
||||
{
|
||||
public int callCount = 0;
|
||||
public void preServe()
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
|
||||
{
|
||||
callCount++;
|
||||
return null;
|
||||
}
|
||||
public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
public class TradeServerEventHandler : TServerEventHandler
|
||||
{
|
||||
public int callCount = 0;
|
||||
public void preServe()
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
public Object createContext(Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
|
||||
{
|
||||
callCount++;
|
||||
return null;
|
||||
}
|
||||
public void deleteContext(Object serverContext, Thrift.Protocol.TProtocol input, Thrift.Protocol.TProtocol output)
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
public void processContext(Object serverContext, Thrift.Transport.TTransport transport)
|
||||
{
|
||||
callCount++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
public class TestHandler : ThriftTest.Iface, Thrift.TControllingHandler
|
||||
{
|
||||
|
@ -273,39 +274,24 @@ namespace Test
|
|||
return mapmap;
|
||||
}
|
||||
|
||||
// Insanity
|
||||
// returns:
|
||||
// { 1 => { 2 => argument,
|
||||
// 3 => argument,
|
||||
// },
|
||||
// 2 => { 6 => <empty Insanity struct>, },
|
||||
// }
|
||||
public Dictionary<long, Dictionary<Numberz, Insanity>> testInsanity(Insanity argument)
|
||||
{
|
||||
testLogDelegate.Invoke("testInsanity()");
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
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] = argument;
|
||||
first_map[Numberz.THREE] = argument;
|
||||
|
||||
second_map[Numberz.SIX] = looney;
|
||||
second_map[Numberz.SIX] = new Insanity();
|
||||
|
||||
Dictionary<long, Dictionary<Numberz, Insanity>> insane =
|
||||
new Dictionary<long, Dictionary<Numberz, Insanity>>();
|
||||
|
@ -469,7 +455,9 @@ namespace Test
|
|||
if (useEncryption)
|
||||
{
|
||||
string certPath = "../keys/server.p12";
|
||||
trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2(certPath, "thrift"), null, null, SslProtocols.Tls);
|
||||
trans = new TTLSServerSocket(port, 0, useBufferedSockets, new X509Certificate2(certPath, "thrift"),
|
||||
null,
|
||||
null, SslProtocols.Tls);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue