THRIFT-5437 Make TProtocolImpl CTOR virtual
Client: Delphi
Patch: Jens Geyer
diff --git a/lib/delphi/test/TestClient.pas b/lib/delphi/test/TestClient.pas
index ebc0796..c8d3fc2 100644
--- a/lib/delphi/test/TestClient.pas
+++ b/lib/delphi/test/TestClient.pas
@@ -1451,14 +1451,7 @@
end;
// create protocol instance, default to BinaryProtocol
- case FSetup.protType of
- prot_Binary : FProtocol := TBinaryProtocolImpl.Create( FTransport, BINARY_STRICT_READ, BINARY_STRICT_WRITE);
- prot_JSON : FProtocol := TJSONProtocolImpl.Create( FTransport);
- prot_Compact : FProtocol := TCompactProtocolImpl.Create( FTransport);
- else
- raise Exception.Create('Unhandled protocol');
- end;
-
+ FProtocol := PROTOCOL_CLASSES[FSetup.protType].Create(FTransport);
ASSERT( (FTransport <> nil) and (FProtocol <> nil));
end;
diff --git a/lib/delphi/test/TestConstants.pas b/lib/delphi/test/TestConstants.pas
index ae3b3e8..9ac4808 100644
--- a/lib/delphi/test/TestConstants.pas
+++ b/lib/delphi/test/TestConstants.pas
@@ -21,7 +21,8 @@
interface
-uses SysUtils;
+uses SysUtils,
+ Thrift.Protocol, Thrift.Protocol.Compact, Thrift.Protocol.JSON;
type
TKnownProtocol = (
@@ -55,6 +56,13 @@
TLayeredTransports = set of TLayeredTransport;
const
+ PROTOCOL_CLASSES : array[TKnownProtocol] of TProtocolImplClass = (
+ TBinaryProtocolImpl,
+ TJSONProtocolImpl,
+ TCompactProtocolImpl
+ );
+
+const
SERVER_TYPES : array[TServerType] of string
= ('Simple', 'Nonblocking', 'Threadpool', 'Threaded');
@@ -67,10 +75,6 @@
ENDPOINT_TRANSPORTS : array[TEndpointTransport] of string
= ('Sockets', 'Http', 'WinHttp', 'Named Pipes','Anon Pipes', 'EvHttp');
- // defaults are: read=false, write=true
- BINARY_STRICT_READ = FALSE;
- BINARY_STRICT_WRITE = FALSE;
-
HUGE_TEST_STRING = 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy '
+ 'eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam '
+ 'voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet '
diff --git a/lib/delphi/test/TestServer.pas b/lib/delphi/test/TestServer.pas
index adbbccf..8aaf9f3 100644
--- a/lib/delphi/test/TestServer.pas
+++ b/lib/delphi/test/TestServer.pas
@@ -567,7 +567,7 @@
// create protocol factory, default to BinaryProtocol
case protType of
- prot_Binary : ProtocolFactory := TBinaryProtocolImpl.TFactory.Create( BINARY_STRICT_READ, BINARY_STRICT_WRITE);
+ prot_Binary : ProtocolFactory := TBinaryProtocolImpl.TFactory.Create;
prot_JSON : ProtocolFactory := TJSONProtocolImpl.TFactory.Create;
prot_Compact : ProtocolFactory := TCompactProtocolImpl.TFactory.Create;
else