THRIFT-4318 Delphi performance improvements
Client: Delphi
Patch: Jens Geyer
This closes #1348
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index 043ff33..ee17657 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -22,7 +22,8 @@
{$I ../src/Thrift.Defines.inc}
{.$DEFINE StressTest} // activate to stress-test the server with frequent connects/disconnects
-{.$DEFINE PerfTest} // activate to activate the performance test
+{.$DEFINE PerfTest} // activate the performance test
+{$DEFINE Exceptions} // activate the exceptions test (or disable while debugging)
interface
@@ -462,6 +463,7 @@
StressTest( client);
{$ENDIF StressTest}
+ {$IFDEF Exceptions}
// in-depth exception test
// (1) do we get an exception at all?
// (2) do we get the right exception?
@@ -510,6 +512,7 @@
on e:TTransportException do Expect( FALSE, 'Unexpected : "'+e.ToString+'"');
on e:Exception do Expect( FALSE, 'Unexpected exception "'+e.ClassName+'"');
end;
+ {$ENDIF Exceptions}
// simple things
@@ -1037,7 +1040,7 @@
// other clients or servers expect as the real JSON. This is beyond the scope of this test.
var prot : IProtocol;
stm : TStringStream;
- list : IList;
+ list : TThriftList;
binary, binRead : TBytes;
i,iErr : Integer;
const
@@ -1068,7 +1071,8 @@
nil, TThriftStreamAdapterDelphi.Create( stm, FALSE)));
// write
- prot.WriteListBegin( TListImpl.Create( TType.String_, 9));
+ Init( list, TType.String_, 9);
+ prot.WriteListBegin( list);
prot.WriteBool( TRUE);
prot.WriteBool( FALSE);
prot.WriteByte( TEST_SHORT);
diff --git a/lib/delphi/test/serializer/TestSerializer.Data.pas b/lib/delphi/test/serializer/TestSerializer.Data.pas
index 30d9dd4..5fc0070 100644
--- a/lib/delphi/test/serializer/TestSerializer.Data.pas
+++ b/lib/delphi/test/serializer/TestSerializer.Data.pas
@@ -22,6 +22,7 @@
interface
uses
+ SysUtils,
Thrift.Collections,
DebugProtoTest;
@@ -194,7 +195,7 @@
{$IF cDebugProtoTest_Option_AnsiStr_Binary}
result.SetBase64('base64');
{$ELSE}
- not yet impl
+ result.SetBase64( TEncoding.UTF8.GetBytes('base64'));
{$IFEND}
// byte, i16, and i64 lists are populated by default constructor
@@ -338,7 +339,7 @@
{$IF cDebugProtoTest_Option_AnsiStr_Binary}
result.A_binary := AnsiString( #0#1#2#3#4#5#6#7#8);
{$ELSE}
- not yet impl
+ result.A_binary := TEncoding.UTF8.GetBytes( #0#1#2#3#4#5#6#7#8);
{$IFEND}
end;
diff --git a/lib/delphi/test/skip/skiptest_version1.dpr b/lib/delphi/test/skip/skiptest_version1.dpr
index c7092c9..40d025f 100644
--- a/lib/delphi/test/skip/skiptest_version1.dpr
+++ b/lib/delphi/test/skip/skiptest_version1.dpr
@@ -44,7 +44,7 @@
function CreatePing : IPing;
begin
result := TPingImpl.Create;
- result.Version1 := Skiptest.One.TConstants.SKIPTESTSERVICE_VERSION;
+ result.Version1 := Tskiptest_version_1Constants.SKIPTESTSERVICE_VERSION;
end;
@@ -179,7 +179,7 @@
FILE_JSON = 'pingpong.json';
begin
try
- Writeln( 'Delphi SkipTest '+IntToStr(TConstants.SKIPTESTSERVICE_VERSION)+' using '+Thrift.Version);
+ Writeln( 'Delphi SkipTest '+IntToStr(Tskiptest_version_1Constants.SKIPTESTSERVICE_VERSION)+' using '+Thrift.Version);
Writeln;
Writeln('Binary protocol');
diff --git a/lib/delphi/test/skip/skiptest_version2.dpr b/lib/delphi/test/skip/skiptest_version2.dpr
index e99e62e..9cb6ff6 100644
--- a/lib/delphi/test/skip/skiptest_version2.dpr
+++ b/lib/delphi/test/skip/skiptest_version2.dpr
@@ -45,7 +45,7 @@
set_ : IHashSet<string>;
begin
result := TPingImpl.Create;
- result.Version1 := Skiptest.Two.TConstants.SKIPTESTSERVICE_VERSION;
+ result.Version1 := Tskiptest_version_2Constants.SKIPTESTSERVICE_VERSION;
result.BoolVal := TRUE;
result.ByteVal := 2;
result.DbVal := 3;
@@ -206,7 +206,7 @@
FILE_JSON = 'pingpong.json';
begin
try
- Writeln( 'Delphi SkipTest '+IntToStr(TConstants.SKIPTESTSERVICE_VERSION)+' using '+Thrift.Version);
+ Writeln( 'Delphi SkipTest '+IntToStr(Tskiptest_version_2Constants.SKIPTESTSERVICE_VERSION)+' using '+Thrift.Version);
Writeln;
Writeln('Binary protocol');