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
60
vendor/git.apache.org/thrift.git/test/perl/TestClient.pl
generated
vendored
60
vendor/git.apache.org/thrift.git/test/perl/TestClient.pl
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
# under the License.
|
||||
#
|
||||
|
||||
require 5.6.0;
|
||||
use 5.10.0;
|
||||
use strict;
|
||||
use warnings;
|
||||
use Data::Dumper;
|
||||
|
@ -33,10 +33,12 @@ use Thrift;
|
|||
use Thrift::BinaryProtocol;
|
||||
use Thrift::BufferedTransport;
|
||||
use Thrift::FramedTransport;
|
||||
use Thrift::MultiplexedProtocol;
|
||||
use Thrift::SSLSocket;
|
||||
use Thrift::Socket;
|
||||
use Thrift::UnixSocket;
|
||||
|
||||
use ThriftTest::SecondService;
|
||||
use ThriftTest::ThriftTest;
|
||||
use ThriftTest::Types;
|
||||
|
||||
|
@ -47,15 +49,19 @@ sub usage {
|
|||
Usage: $0 [OPTIONS]
|
||||
|
||||
Options: (default)
|
||||
--ca CA to validate server with.
|
||||
--cert Certificate to use.
|
||||
Required if using --ssl.
|
||||
--ciphers Acceptable cipher list.
|
||||
--domain-socket <file> Use a unix domain socket.
|
||||
--help Show usage.
|
||||
--key Certificate key.
|
||||
Required if using --ssl.
|
||||
--port <portnum> 9090 Port to use.
|
||||
--protocol {binary} binary Protocol to use.
|
||||
--ssl If present, use SSL.
|
||||
--transport {buffered|framed} buffered Transport to use.
|
||||
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
|
@ -66,7 +72,10 @@ my %opts = (
|
|||
);
|
||||
|
||||
GetOptions(\%opts, qw (
|
||||
ca=s
|
||||
cert=s
|
||||
ciphers=s
|
||||
key=s
|
||||
domain-socket=s
|
||||
help
|
||||
host=s
|
||||
|
@ -81,18 +90,13 @@ if ($opts{help}) {
|
|||
exit 0;
|
||||
}
|
||||
|
||||
if ($opts{ssl} and not defined $opts{cert}) {
|
||||
usage();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $socket = undef;
|
||||
if ($opts{"domain-socket"}) {
|
||||
$socket = new Thrift::UnixSocket($opts{"domain-socket"});
|
||||
} elsif ($opts{ssl}) {
|
||||
$socket = new Thrift::SSLSocket($opts{host}, $opts{port});
|
||||
$socket = new Thrift::SSLSocket(\%opts);
|
||||
} else {
|
||||
$socket = new Thrift::Socket($opts{host}, $opts{port});
|
||||
$socket = new Thrift::Socket($opts{host}, $opts{port});
|
||||
}
|
||||
|
||||
my $transport;
|
||||
|
@ -106,21 +110,37 @@ if ($opts{transport} eq 'buffered') {
|
|||
}
|
||||
|
||||
my $protocol;
|
||||
if ($opts{protocol} eq 'binary') {
|
||||
my $protocol2;
|
||||
if ($opts{protocol} eq 'binary' || $opts{protocol} eq 'multi') {
|
||||
$protocol = new Thrift::BinaryProtocol($transport);
|
||||
} else {
|
||||
usage();
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my $secondService = undef;
|
||||
if (index($opts{protocol}, 'multi') == 0) {
|
||||
$protocol2 = new Thrift::MultiplexedProtocol($protocol, "SecondService");
|
||||
$protocol = new Thrift::MultiplexedProtocol($protocol, "ThriftTest");
|
||||
$secondService = new ThriftTest::SecondServiceClient($protocol2);
|
||||
}
|
||||
|
||||
my $testClient = new ThriftTest::ThriftTestClient($protocol);
|
||||
|
||||
eval {
|
||||
$transport->open();
|
||||
};
|
||||
};
|
||||
if($@){
|
||||
die(Dumper($@));
|
||||
}
|
||||
|
||||
use constant ERR_BASETYPES => 1;
|
||||
use constant ERR_STRUCTS => 2;
|
||||
use constant ERR_CONTAINERS => 4;
|
||||
use constant ERR_EXCEPTIONS => 8;
|
||||
use constant ERR_PROTOCOL => 16;
|
||||
use constant ERR_UNKNOWN => 64;
|
||||
|
||||
my $start = gettimeofday();
|
||||
|
||||
#
|
||||
|
@ -136,6 +156,17 @@ print(" = void\n");
|
|||
print("testString(\"Test\")");
|
||||
my $s = $testClient->testString("Test");
|
||||
print(" = \"$s\"\n");
|
||||
exit(ERR_BASETYPES) if ($s ne 'Test');
|
||||
|
||||
#
|
||||
# MULTIPLEXED TEST
|
||||
#
|
||||
if (index($opts{protocol}, 'multi') == 0) {
|
||||
print("secondtestString(\"Test2\")");
|
||||
$s = $secondService->secondtestString("Test2");
|
||||
print(" = \"$s\"\n");
|
||||
exit(ERR_PROTOCOL) if ($s ne 'testString("Test2")');
|
||||
}
|
||||
|
||||
#
|
||||
# BOOL TEST
|
||||
|
@ -143,9 +174,11 @@ print(" = \"$s\"\n");
|
|||
print("testBool(1)");
|
||||
my $t = $testClient->testBool(1);
|
||||
print(" = $t\n");
|
||||
exit(ERR_BASETYPES) if ($t ne 1);
|
||||
print("testBool(0)");
|
||||
my $f = $testClient->testBool(0);
|
||||
print(" = $f\n");
|
||||
exit(ERR_BASETYPES) if ($f ne "");
|
||||
|
||||
|
||||
#
|
||||
|
@ -161,13 +194,15 @@ print(" = $u8\n");
|
|||
print("testI32(-1)");
|
||||
my $i32 = $testClient->testI32(-1);
|
||||
print(" = $i32\n");
|
||||
exit(ERR_BASETYPES) if ($i32 ne -1);
|
||||
|
||||
#
|
||||
#I64 TEST
|
||||
# I64 TEST
|
||||
#
|
||||
print("testI64(-34359738368)");
|
||||
my $i64 = $testClient->testI64(-34359738368);
|
||||
print(" = $i64\n");
|
||||
exit(ERR_BASETYPES) if ($i64 ne -34359738368);
|
||||
|
||||
#
|
||||
# DOUBLE TEST
|
||||
|
@ -175,6 +210,7 @@ print(" = $i64\n");
|
|||
print("testDouble(-852.234234234)");
|
||||
my $dub = $testClient->testDouble(-852.234234234);
|
||||
print(" = $dub\n");
|
||||
exit(ERR_BASETYPES) if ($dub ne -852.234234234);
|
||||
|
||||
#
|
||||
# BINARY TEST --- TODO
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue