1(*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *)
19
20
21program client;
22
23{$APPTYPE CONSOLE}
24
25uses
26  SysUtils,
27  TestClient in 'TestClient.pas',
28  Thrift.Test, // in 'gen-delphi\Thrift.Test.pas',
29  Thrift in '..\src\Thrift.pas',
30  Thrift.Transport in '..\src\Thrift.Transport.pas',
31  Thrift.Socket in '..\src\Thrift.Socket.pas',
32  Thrift.Exception in '..\src\Thrift.Exception.pas',
33  Thrift.Transport.Pipes in '..\src\Thrift.Transport.Pipes.pas',
34  Thrift.Protocol in '..\src\Thrift.Protocol.pas',
35  Thrift.Protocol.JSON in '..\src\Thrift.Protocol.JSON.pas',
36  Thrift.Protocol.Compact in '..\src\Thrift.Protocol.Compact.pas',
37  Thrift.Protocol.Multiplex in '..\src\Thrift.Protocol.Multiplex.pas',
38  Thrift.Collections in '..\src\Thrift.Collections.pas',
39  Thrift.Server in '..\src\Thrift.Server.pas',
40  Thrift.Stream in '..\src\Thrift.Stream.pas',
41  Thrift.TypeRegistry in '..\src\Thrift.TypeRegistry.pas',
42  Thrift.Utils in '..\src\Thrift.Utils.pas';
43
44var
45  nParamCount : Integer;
46  args : array of string;
47  i : Integer;
48  arg : string;
49
50begin
51  try
52    Writeln( 'Delphi TestClient '+Thrift.Version);
53    nParamCount := ParamCount;
54    SetLength( args, nParamCount);
55    for i := 1 to nParamCount do begin
56      arg := ParamStr( i );
57      args[i-1] := arg;
58    end;
59
60    ExitCode := TTestClient.Execute( args);
61
62  except
63    on E: EAbort do begin
64      ExitCode := $FF;
65    end;
66    on E: Exception do begin
67      Writeln(E.ClassName, ': ', E.Message);
68      ExitCode := $FF;
69    end;
70  end;
71end.
72
73