Upgrading vendor folder dependencies.

This commit is contained in:
Renan DelValle 2018-12-27 09:58:53 -08:00
parent 4a0cbcd770
commit acbe9ad9e5
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
229 changed files with 10735 additions and 4528 deletions

View file

@ -196,7 +196,7 @@ service ThriftTest
* @return binary - returns the binary 'thing'
*/
binary testBinary(1: binary thing),
/**
* Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values
* @param Xtruct thing - the Xtruct to print

View file

@ -516,8 +516,8 @@ int main(int argc, char** argv) {
BASETYPE_IDENTITY_TEST(testI32, -1);
BASETYPE_IDENTITY_TEST(testI32, 190000013);
BASETYPE_IDENTITY_TEST(testI32, -190000013);
BASETYPE_IDENTITY_TEST(testI32, numeric_limits<int32_t>::max());
BASETYPE_IDENTITY_TEST(testI32, numeric_limits<int32_t>::min());
BASETYPE_IDENTITY_TEST(testI32, (numeric_limits<int32_t>::max)());
BASETYPE_IDENTITY_TEST(testI32, (numeric_limits<int32_t>::min)());
/**
* I64 TEST
@ -530,8 +530,8 @@ int main(int argc, char** argv) {
BASETYPE_IDENTITY_TEST(testI64, (int64_t)-pow(static_cast<double>(2LL), 32));
BASETYPE_IDENTITY_TEST(testI64, (int64_t)pow(static_cast<double>(2LL), 32) + 1);
BASETYPE_IDENTITY_TEST(testI64, (int64_t)-pow(static_cast<double>(2LL), 32) - 1);
BASETYPE_IDENTITY_TEST(testI64, numeric_limits<int64_t>::max());
BASETYPE_IDENTITY_TEST(testI64, numeric_limits<int64_t>::min());
BASETYPE_IDENTITY_TEST(testI64, (numeric_limits<int64_t>::max)());
BASETYPE_IDENTITY_TEST(testI64, (numeric_limits<int64_t>::min)());
/**
* DOUBLE TEST

View file

@ -152,7 +152,7 @@ def exec_context(port, logdir, test, prog, is_server):
return ExecutionContext(prog.command, prog.workdir, prog.env, prog.stop_signal, is_server, report)
def run_test(testdir, logdir, test_dict, max_retry, async=True):
def run_test(testdir, logdir, test_dict, max_retry, async_mode=True):
logger = multiprocessing.get_logger()
def ensure_socket_open(sv, port, test):
@ -255,13 +255,13 @@ def run_test(testdir, logdir, test_dict, max_retry, async=True):
logger.info('[%s-%s]: test failed, retrying...', test.server.name, test.client.name)
retry_count += 1
except Exception:
if not async:
if not async_mode:
raise
logger.warn('Error executing [%s]', test.name, exc_info=True)
return (retry_count, RESULT_ERROR)
except:
logger.info('Interrupted execution', exc_info=True)
if not async:
if not async_mode:
raise
stop.set()
return (retry_count, RESULT_ERROR)
@ -385,7 +385,7 @@ class TestDispatcher(object):
ports = m.ports()
def _dispatch_sync(self, test, cont, max_retry):
r = run_test(self.testdir, self.logdir, test, max_retry, False)
r = run_test(self.testdir, self.logdir, test, max_retry, async_mode=False)
cont(r)
return NonAsyncResult(r)

View file

@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.12.0.0")]
[assembly: AssemblyFileVersion("0.12.0.0")]

View file

@ -46,7 +46,7 @@
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationVersion>0.12.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
@ -138,4 +138,4 @@ for %25%25I in ("%25THRIFT_FILE%25") do set THRIFT_SHORT=%25%25~fsI
"$(ProjectDir)\..\..\compiler\cpp\thrift.exe" --gen csharp -o %25SHORT_DIR%25 %25THRIFT_SHORT%25
$(MSBuildToolsPath)\Csc.exe /t:library /out:"$(ProjectDir)ThriftImpl.dll" /recurse:"$(ProjectDir)gen-csharp"\* /reference:"$(ProjectDir)..\..\lib\csharp\bin\Debug\Thrift.dll"</PreBuildEvent>
</PropertyGroup>
</Project>
</Project>

View file

@ -16,7 +16,7 @@
# under the License.
name: thrift_test_client
version: 1.0.0-dev
version: 0.12.0
description: A client integration test for the Dart Thrift library
author: Apache Thrift Developers <dev@thrift.apache.org>
homepage: http://thrift.apache.org

View file

@ -22,7 +22,7 @@
{description, "Thrift cross language test"},
% The version of the applicaton
{vsn, "1.0.0-dev"},
{vsn, "0.12.0"},
% All modules used by the application.
{modules, [

View file

@ -212,6 +212,7 @@
"d-nodejs_json_framed-ip-ssl",
"d-nodejs_json_http-ip",
"d-nodejs_json_http-ip-ssl",
"d-nodets_binary_buffered-ip",
"d-py3_binary-accel_buffered-ip",
"d-py3_binary-accel_buffered-ip-ssl",
"d-py3_binary-accel_framed-ip",
@ -278,6 +279,7 @@
"erl-csharp_compact_buffered-ip",
"erl-nodejs_binary_buffered-ip",
"erl-nodejs_compact_buffered-ip",
"erl-nodets_binary_buffered-ip",
"erl-rb_binary-accel_buffered-ip",
"erl-rb_binary-accel_buffered-ip-ssl",
"erl-rb_binary-accel_framed-ip",

View file

@ -45,7 +45,7 @@ use ThriftTest::Types;
$|++;
sub usage {
print <<EOF;
print <<"EOF";
Usage: $0 [OPTIONS]
Options: (default)
@ -91,20 +91,24 @@ if ($opts{help}) {
}
my $socket = undef;
if ($opts{"domain-socket"}) {
$socket = new Thrift::UnixSocket($opts{"domain-socket"});
} elsif ($opts{ssl}) {
$socket = new Thrift::SSLSocket(\%opts);
} else {
$socket = new Thrift::Socket($opts{host}, $opts{port});
if ($opts{'domain-socket'}) {
$socket = Thrift::UnixSocket->new($opts{'domain-socket'});
}
elsif ($opts{ssl}) {
$socket = Thrift::SSLSocket->new(\%opts);
}
else {
$socket = Thrift::Socket->new($opts{host}, $opts{port});
}
my $transport;
if ($opts{transport} eq 'buffered') {
$transport = new Thrift::BufferedTransport($socket, 1024, 1024);
} elsif ($opts{transport} eq 'framed') {
$transport = new Thrift::FramedTransport($socket);
} else {
$transport = Thrift::BufferedTransport->new($socket, 1024, 1024);
}
elsif ($opts{transport} eq 'framed') {
$transport = Thrift::FramedTransport->new($socket);
}
else {
usage();
exit 1;
}
@ -112,20 +116,21 @@ if ($opts{transport} eq 'buffered') {
my $protocol;
my $protocol2;
if ($opts{protocol} eq 'binary' || $opts{protocol} eq 'multi') {
$protocol = new Thrift::BinaryProtocol($transport);
} else {
$protocol = Thrift::BinaryProtocol->new($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);
$protocol2 = Thrift::MultiplexedProtocol->new($protocol, 'SecondService');
$protocol = Thrift::MultiplexedProtocol->new($protocol, 'ThriftTest');
$secondService = ThriftTest::SecondServiceClient->new($protocol2);
}
my $testClient = new ThriftTest::ThriftTestClient($protocol);
my $testClient = ThriftTest::ThriftTestClient->new($protocol);
eval {
$transport->open();
@ -146,52 +151,52 @@ my $start = gettimeofday();
#
# VOID TEST
#
print("testVoid()");
print('testVoid()');
$testClient->testVoid();
print(" = void\n");
#
# STRING TEST
#
print("testString(\"Test\")");
my $s = $testClient->testString("Test");
print(" = \"$s\"\n");
print('testString("Test")');
my $s = $testClient->testString('Test');
print(qq| = "$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");
print('secondtestString("Test2")');
$s = $secondService->secondtestString('Test2');
print(qq| = "$s"\n|);
exit(ERR_PROTOCOL) if ($s ne 'testString("Test2")');
}
#
# BOOL TEST
#
print("testBool(1)");
print('testBool(1)');
my $t = $testClient->testBool(1);
print(" = $t\n");
exit(ERR_BASETYPES) if ($t ne 1);
print("testBool(0)");
print('testBool(0)');
my $f = $testClient->testBool(0);
print(" = $f\n");
exit(ERR_BASETYPES) if ($f ne "");
exit(ERR_BASETYPES) if ($f ne q||);
#
# BYTE TEST
#
print("testByte(1)");
print('testByte(1)');
my $u8 = $testClient->testByte(1);
print(" = $u8\n");
#
# I32 TEST
#
print("testI32(-1)");
print('testI32(-1)');
my $i32 = $testClient->testI32(-1);
print(" = $i32\n");
exit(ERR_BASETYPES) if ($i32 ne -1);
@ -199,7 +204,7 @@ exit(ERR_BASETYPES) if ($i32 ne -1);
#
# I64 TEST
#
print("testI64(-34359738368)");
print('testI64(-34359738368)');
my $i64 = $testClient->testI64(-34359738368);
print(" = $i64\n");
exit(ERR_BASETYPES) if ($i64 ne -34359738368);
@ -207,7 +212,7 @@ exit(ERR_BASETYPES) if ($i64 ne -34359738368);
#
# DOUBLE TEST
#
print("testDouble(-852.234234234)");
print('testDouble(-852.234234234)');
my $dub = $testClient->testDouble(-852.234234234);
print(" = $dub\n");
exit(ERR_BASETYPES) if ($dub ne -852.234234234);
@ -220,33 +225,33 @@ exit(ERR_BASETYPES) if ($dub ne -852.234234234);
#
# STRUCT TEST
#
print("testStruct({\"Zero\", 1, -3, -5})");
my $out = new ThriftTest::Xtruct();
$out->string_thing("Zero");
print('testStruct({"Zero", 1, -3, -5})');
my $out = ThriftTest::Xtruct->new();
$out->string_thing('Zero');
$out->byte_thing(1);
$out->i32_thing(-3);
$out->i64_thing(-5);
my $in = $testClient->testStruct($out);
print(" = {\"".$in->string_thing."\", ".
$in->byte_thing.", ".
$in->i32_thing.", ".
print(' = {"'.$in->string_thing.'", '.
$in->byte_thing.', '.
$in->i32_thing.', '.
$in->i64_thing."}\n");
#
# NESTED STRUCT TEST
#
print("testNest({1, {\"Zero\", 1, -3, -5}, 5}");
my $out2 = new ThriftTest::Xtruct2();
print('testNest({1, {"Zero", 1, -3, -5}, 5}');
my $out2 = ThriftTest::Xtruct2->new();
$out2->byte_thing(1);
$out2->struct_thing($out);
$out2->i32_thing(5);
my $in2 = $testClient->testNest($out2);
$in = $in2->struct_thing;
print(" = {".$in2->byte_thing.", {\"".
$in->string_thing."\", ".
$in->byte_thing.", ".
$in->i32_thing.", ".
$in->i64_thing."}, ".
print(' = {'.$in2->byte_thing.', {"'.
$in->string_thing.'", '.
$in->byte_thing.', '.
$in->i32_thing.', '.
$in->i64_thing.'}, '.
$in2->i32_thing."}\n");
#
@ -256,28 +261,30 @@ my $mapout = {};
for (my $i = 0; $i < 5; ++$i) {
$mapout->{$i} = $i-10;
}
print("testMap({");
print('testMap({');
my $first = 1;
while( my($key,$val) = each %$mapout) {
if ($first) {
$first = 0;
} else {
print(", ");
}
else {
print(', ');
}
print("$key => $val");
}
print("})");
print('})');
my $mapin = $testClient->testMap($mapout);
print(" = {");
print(' = {');
$first = 1;
while( my($key,$val) = each %$mapin){
if ($first) {
$first = 0;
} else {
print(", ");
}
else {
print(', ');
}
print("$key => $val");
}
@ -291,11 +298,11 @@ for (my $i = -2; $i < 3; ++$i) {
push(@$setout, $i);
}
print("testSet({".join(",",@$setout)."})");
print('testSet({'.join(',',@$setout).'})');
my $setin = $testClient->testSet($setout);
print(" = {".join(",",@$setout)."}\n");
print(' = {'.join(',',@$setout)."}\n");
#
# LIST TEST
@ -305,111 +312,111 @@ for (my $i = -2; $i < 3; ++$i) {
push(@$listout, $i);
}
print("testList({".join(",",@$listout)."})");
print('testList({'.join(',',@$listout).'})');
my $listin = $testClient->testList($listout);
print(" = {".join(",",@$listin)."}\n");
print(' = {'.join(',',@$listin)."}\n");
#
# ENUM TEST
#
print("testEnum(ONE)");
print('testEnum(ONE)');
my $ret = $testClient->testEnum(ThriftTest::Numberz::ONE);
print(" = $ret\n");
print("testEnum(TWO)");
print('testEnum(TWO)');
$ret = $testClient->testEnum(ThriftTest::Numberz::TWO);
print(" = $ret\n");
print("testEnum(THREE)");
print('testEnum(THREE)');
$ret = $testClient->testEnum(ThriftTest::Numberz::THREE);
print(" = $ret\n");
print("testEnum(FIVE)");
print('testEnum(FIVE)');
$ret = $testClient->testEnum(ThriftTest::Numberz::FIVE);
print(" = $ret\n");
print("testEnum(EIGHT)");
print('testEnum(EIGHT)');
$ret = $testClient->testEnum(ThriftTest::Numberz::EIGHT);
print(" = $ret\n");
#
# TYPEDEF TEST
#
print("testTypedef(309858235082523)");
print('testTypedef(309858235082523)');
my $uid = $testClient->testTypedef(309858235082523);
print(" = $uid\n");
#
# NESTED MAP TEST
#
print("testMapMap(1)");
print('testMapMap(1)');
my $mm = $testClient->testMapMap(1);
print(" = {");
print(' = {');
while( my ($key,$val) = each %$mm) {
print("$key => {");
while( my($k2,$v2) = each %$val) {
print("$k2 => $v2, ");
}
print("}, ");
print('}, ');
}
print("}\n");
#
# INSANITY TEST
#
my $insane = new ThriftTest::Insanity();
my $insane = ThriftTest::Insanity->new();
$insane->{userMap}->{ThriftTest::Numberz::FIVE} = 5000;
my $truck = new ThriftTest::Xtruct();
$truck->string_thing("Hello2");
my $truck = ThriftTest::Xtruct->new();
$truck->string_thing('Hello2');
$truck->byte_thing(2);
$truck->i32_thing(2);
$truck->i64_thing(2);
my $truck2 = new ThriftTest::Xtruct();
$truck2->string_thing("Goodbye4");
my $truck2 = ThriftTest::Xtruct->new();
$truck2->string_thing('Goodbye4');
$truck2->byte_thing(4);
$truck2->i32_thing(4);
$truck2->i64_thing(4);
push(@{$insane->{xtructs}}, $truck);
push(@{$insane->{xtructs}}, $truck2);
print("testInsanity()");
print('testInsanity()');
my $whoa = $testClient->testInsanity($insane);
print(" = {");
print(' = {');
while( my ($key,$val) = each %$whoa) {
print("$key => {");
while( my($k2,$v2) = each %$val) {
print("$k2 => {");
my $userMap = $v2->{userMap};
print("{");
if (ref($userMap) eq "HASH") {
print('{');
if (ref($userMap) eq 'HASH') {
while( my($k3,$v3) = each %$userMap) {
print("$k3 => $v3, ");
}
}
print("}, ");
print('}, ');
my $xtructs = $v2->{xtructs};
print("{");
if (ref($xtructs) eq "ARRAY") {
print('{');
if (ref($xtructs) eq 'ARRAY') {
foreach my $x (@$xtructs) {
print("{\"".$x->{string_thing}."\", ".
$x->{byte_thing}.", ".$x->{i32_thing}.", ".$x->{i64_thing}."}, ");
print('{"'.$x->{string_thing}.'", '.
$x->{byte_thing}.', '.$x->{i32_thing}.', '.$x->{i64_thing}.'}, ');
}
}
print("}");
print('}');
print("}, ");
print('}, ');
}
print("}, ");
print('}, ');
}
print("}\n");
#
# EXCEPTION TEST
#
print("testException('Xception')");
print(q|testException('Xception')|);
eval {
$testClient->testException('Xception');
print(" void\nFAILURE\n");
@ -422,7 +429,7 @@ eval {
# Normal tests done.
#
my $stop = gettimeofday();
my $elp = sprintf("%d",1000*($stop - $start), 0);
my $elp = sprintf('%d',1000*($stop - $start), 0);
print("Total time: $elp ms\n");
#

View file

@ -27,7 +27,7 @@ use Getopt::Long qw(GetOptions);
use Time::HiRes qw(gettimeofday);
$SIG{INT} = \&sigint_handler;
use lib '../../lib/perl/lib';
use lib 'gen-perl';
@ -48,7 +48,7 @@ use ThriftTest::Types;
$|++;
sub usage {
print <<EOF;
print <<"EOF";
Usage: $0 [OPTIONS]
Options: (default)
@ -99,54 +99,60 @@ if ($opts{ssl} and not defined $opts{cert}) {
exit 1;
}
my $handler = new ThriftTestHandler();
my $handler2 = new SecondServiceHandler();
my $processor = new ThriftTest::ThriftTestProcessor($handler);
my $processor2 = new ThriftTest::SecondServiceProcessor($handler2);
my $handler = ThriftTestHandler->new();
my $handler2 = SecondServiceHandler->new();
my $processor = ThriftTest::ThriftTestProcessor->new($handler);
my $processor2 = ThriftTest::SecondServiceProcessor->new($handler2);
my $serversocket;
if ($opts{"domain-socket"}) {
unlink($opts{"domain-socket"});
$serversocket = new Thrift::UnixServerSocket($opts{"domain-socket"});
} elsif ($opts{ssl}) {
$serversocket = new Thrift::SSLServerSocket(\%opts);
} else {
$serversocket = new Thrift::ServerSocket(\%opts);
if ($opts{'domain-socket'}) {
unlink($opts{'domain-socket'});
$serversocket = Thrift::UnixServerSocket->new($opts{'domain-socket'});
}
elsif ($opts{ssl}) {
$serversocket = Thrift::SSLServerSocket->new(\%opts);
}
else {
$serversocket = Thrift::ServerSocket->new(\%opts);
}
my $transport;
if ($opts{transport} eq 'buffered') {
$transport = new Thrift::BufferedTransportFactory();
} elsif ($opts{transport} eq 'framed') {
$transport = new Thrift::FramedTransportFactory();
} else {
$transport = Thrift::BufferedTransportFactory->new();
}
elsif ($opts{transport} eq 'framed') {
$transport = Thrift::FramedTransportFactory->new();
}
else {
usage();
exit 1;
}
my $protocol;
if ($opts{protocol} eq 'binary' || $opts{protocol} eq 'multi') {
$protocol = new Thrift::BinaryProtocolFactory();
} else {
$protocol = Thrift::BinaryProtocolFactory->new();
}
else {
usage();
exit 1;
}
if (index($opts{protocol}, 'multi') == 0) {
my $newProcessor = new Thrift::MultiplexedProcessor($protocol);
my $newProcessor = Thrift::MultiplexedProcessor->new($protocol);
$newProcessor->defaultProcessor($processor);
$newProcessor->registerProcessor("ThriftTest", $processor);
$newProcessor->registerProcessor("SecondService", $processor2);
$newProcessor->registerProcessor('ThriftTest', $processor);
$newProcessor->registerProcessor('SecondService', $processor2);
$processor = $newProcessor;
}
my $ssltag = '';
if ($opts{ssl}) {
$ssltag = "(SSL)";
$ssltag = '(SSL)';
}
my $listening_on = "$opts{port} $ssltag";
if ($opts{"domain-socket"}) {
$listening_on = $opts{"domain-socket"};
if ($opts{'domain-socket'}) {
$listening_on = $opts{'domain-socket'};
}
my $server = new Thrift::SimpleServer($processor, $serversocket, $transport, $protocol);
print "Starting \"simple\" server ($opts{transport}/$opts{protocol}) listen on: $listening_on\n";
my $server = Thrift::SimpleServer->new($processor, $serversocket, $transport, $protocol);
print qq|Starting "simple" server ($opts{transport}/$opts{protocol}) listen on: $listening_on\n|;
$server->serve();
print "done.\n";
@ -169,70 +175,67 @@ sub new {
return bless($self, $classname);
}
sub testVoid() {
sub testVoid {
print("testVoid()\n");
}
sub testString() {
sub testString {
my $self = shift;
my $thing = shift;
print("testString($thing)\n");
return $thing;
}
sub testBool() {
sub testBool {
my $self = shift;
my $thing = shift;
my $str = $thing ? "true" : "false";
my $str = $thing ? 'true' : 'false';
print("testBool($str)\n");
return $thing;
}
sub testByte() {
sub testByte {
my $self = shift;
my $thing = shift;
print("testByte($thing)\n");
return $thing;
}
sub testI32() {
sub testI32 {
my $self = shift;
my $thing = shift;
print("testI32($thing)\n");
return $thing;
}
sub testI64() {
sub testI64 {
my $self = shift;
my $thing = shift;
print("testI64($thing)\n");
return $thing;
}
sub testDouble() {
sub testDouble {
my $self = shift;
my $thing = shift;
print("testDouble($thing)\n");
return $thing;
}
sub testBinary() {
sub testBinary {
my $self = shift;
my $thing = shift;
my @bytes = split //, $thing;
print("testBinary(");
foreach (@bytes)
{
printf "%02lx", ord $_;
}
print(")\n");
print 'testBinary(';
printf( '%02lx', ord $_ ) foreach (@bytes);
print ")\n";
return $thing;
}
sub testStruct() {
sub testStruct {
my $self = shift;
my $thing = shift;
printf("testStruct({\"%s\", %d, %d, %lld})\n",
printf(qq|testStruct({"%s", %d, %d, %lld})\n|,
$thing->{string_thing},
$thing->{byte_thing},
$thing->{i32_thing},
@ -240,11 +243,11 @@ sub testStruct() {
return $thing;
}
sub testNest() {
sub testNest {
my $self = shift;
my $nest = shift;
my $thing = $nest->{struct_thing};
printf("testNest({%d, {\"%s\", %d, %d, %lld}, %d})\n",
printf(qq|testNest({%d, {"%s", %d, %d, %lld}, %d})\n|,
$nest->{byte_thing},
$thing->{string_thing},
$thing->{byte_thing},
@ -254,92 +257,58 @@ sub testNest() {
return $nest;
}
sub testMap() {
sub testMap {
my $self = shift;
my $thing = shift;
print("testMap({");
my $first = 1;
foreach my $key (keys %$thing) {
if ($first) {
$first = 0;
} else {
print(", ");
}
print("$key => $thing->{$key}");
}
print("})\n");
printf "testMap({%s})\n",
join( ', ',
map { $_ . ' => ' . $thing->{$_} }
sort keys %$thing
);
return $thing;
}
sub testStringMap() {
sub testStringMap {
my $self = shift;
my $thing = shift;
print("testStringMap({");
my $first = 1;
foreach my $key (keys %$thing) {
if ($first) {
$first = 0;
} else {
print(", ");
}
print("$key => $thing->{$key}");
}
print("})\n");
printf "testStringMap({%s})\n",
join( ', ',
map { $_ . ' => ' . $thing->{$_} }
sort keys %$thing
);
return $thing;
}
sub testSet() {
sub testSet {
my $self = shift;
my $thing = shift;
my @arr;
my $result = \@arr;
print("testSet({");
my $first = 1;
foreach my $key (keys %$thing) {
if ($first) {
$first = 0;
} else {
print(", ");
}
print("$key");
push(@arr, $key);
}
print("})\n");
return $result;
my @result = sort keys %$thing;
printf "testSet({%s})\n", join(', ', @result );
return \@result;
}
sub testList() {
sub testList {
my $self = shift;
my $thing = shift;
print("testList({");
my $first = 1;
foreach my $key (@$thing) {
if ($first) {
$first = 0;
} else {
print(", ");
}
print("$key");
}
print("})\n");
print "testList({%s})\n", join(', ', @$thing);
return $thing;
}
sub testEnum() {
sub testEnum {
my $self = shift;
my $thing = shift;
print("testEnum($thing)\n");
print "testEnum($thing)\n";
return $thing;
}
sub testTypedef() {
sub testTypedef {
my $self = shift;
my $thing = shift;
print("testTypedef($thing)\n");
return $thing;
}
sub testMapMap() {
sub testMapMap {
my $self = shift;
my $hello = shift;
@ -348,25 +317,25 @@ sub testMapMap() {
return $result;
}
sub testInsanity() {
sub testInsanity {
my $self = shift;
my $argument = shift;
print("testInsanity()\n");
my $hello = new ThriftTest::Xtruct({string_thing => "Hello2", byte_thing => 2, i32_thing => 2, i64_thing => 2});
my $hello = ThriftTest::Xtruct->new({string_thing => 'Hello2', byte_thing => 2, i32_thing => 2, i64_thing => 2});
my @hellos;
push(@hellos, $hello);
my $goodbye = new ThriftTest::Xtruct({string_thing => "Goodbye4", byte_thing => 4, i32_thing => 4, i64_thing => 4});
my $goodbye = ThriftTest::Xtruct->new({string_thing => 'Goodbye4', byte_thing => 4, i32_thing => 4, i64_thing => 4});
my @goodbyes;
push(@goodbyes, $goodbye);
my $crazy = new ThriftTest::Insanity({userMap => { ThriftTest::Numberz::EIGHT => 8 }, xtructs => \@goodbyes});
my $loony = new ThriftTest::Insanity();
my $crazy = ThriftTest::Insanity->new({userMap => { ThriftTest::Numberz::EIGHT => 8 }, xtructs => \@goodbyes});
my $loony = ThriftTest::Insanity->new();
my $result = { 1 => { ThriftTest::Numberz::TWO => $argument, ThriftTest::Numberz::THREE => $argument },
2 => { ThriftTest::Numberz::SIX => $loony } };
return $result;
}
sub testMulti() {
sub testMulti {
my $self = shift;
my $arg0 = shift;
my $arg1 = shift;
@ -376,39 +345,43 @@ sub testMulti() {
my $arg5 = shift;
print("testMulti()\n");
return new ThriftTest::Xtruct({string_thing => "Hello2", byte_thing => $arg0, i32_thing => $arg1, i64_thing => $arg2});
return ThriftTest::Xtruct->new({string_thing => 'Hello2', byte_thing => $arg0, i32_thing => $arg1, i64_thing => $arg2});
}
sub testException() {
sub testException {
my $self = shift;
my $arg = shift;
print("testException($arg)\n");
if ($arg eq "Xception") {
die new ThriftTest::Xception({errorCode => 1001, message => $arg});
} elsif ($arg eq "TException") {
die "astring"; # all unhandled exceptions become TExceptions
} else {
return new ThriftTest::Xtruct({string_thing => $arg});
if ($arg eq 'Xception') {
die ThriftTest::Xception->new({errorCode => 1001, message => $arg});
}
elsif ($arg eq 'TException') {
die 'astring'; # all unhandled exceptions become TExceptions
}
else {
return ThriftTest::Xtruct->new({string_thing => $arg});
}
}
sub testMultiException() {
sub testMultiException {
my $self = shift;
my $arg0 = shift;
my $arg1 = shift;
printf("testMultiException(%s, %s)\n", $arg0, $arg1);
if ($arg0 eq "Xception") {
die new ThriftTest::Xception({errorCode => 1001, message => "This is an Xception"});
} elsif ($arg0 eq "Xception2") {
my $struct_thing = new ThriftTest::Xtruct({string_thing => "This is an Xception2"});
die new ThriftTest::Xception2({errorCode => 2002, struct_thing => $struct_thing});
} else {
return new ThriftTest::Xtruct({string_thing => $arg1});
if ($arg0 eq 'Xception') {
die ThriftTest::Xception->new({errorCode => 1001, message => 'This is an Xception'});
}
elsif ($arg0 eq 'Xception2') {
my $struct_thing = ThriftTest::Xtruct->new({string_thing => 'This is an Xception2'});
die ThriftTest::Xception2->new({errorCode => 2002, struct_thing => $struct_thing});
}
else {
return ThriftTest::Xtruct->new({string_thing => $arg1});
}
}
sub testOneway() {
sub testOneway {
my $self = shift;
my $num = shift;
print("testOneway($num): received\n");
@ -428,11 +401,11 @@ sub new {
return bless($self, $classname);
}
sub secondtestString() {
sub secondtestString {
my $self = shift;
my $thing = shift;
print("testString($thing)\n");
return "testString(\"" . $thing . "\")";
return qq|testString("$thing")|;
}
1;

View file

@ -216,7 +216,7 @@ fn make_thrift_calls(
info!("testEnum");
{
verify_expected_result(thrift_test_client.test_enum(Numberz::TWO), Numberz::TWO)?;
verify_expected_result(thrift_test_client.test_enum(Numberz::Two), Numberz::Two)?;
}
info!("testBinary");
@ -391,7 +391,7 @@ fn make_thrift_calls(
};
verify_expected_result(
thrift_test_client.test_multi(1, -123948, -19234123981, m_snd, Numberz::EIGHT, 81),
thrift_test_client.test_multi(1, -123948, -19234123981, m_snd, Numberz::Eight, 81),
s_cmp,
)?;
}
@ -405,8 +405,8 @@ fn make_thrift_calls(
// }
{
let mut arg_map_usermap: BTreeMap<Numberz, i64> = BTreeMap::new();
arg_map_usermap.insert(Numberz::ONE, 4289);
arg_map_usermap.insert(Numberz::EIGHT, 19);
arg_map_usermap.insert(Numberz::One, 4289);
arg_map_usermap.insert(Numberz::Eight, 19);
let mut arg_vec_xtructs: Vec<Xtruct> = Vec::new();
arg_vec_xtructs.push(
@ -439,15 +439,15 @@ fn make_thrift_calls(
user_map: Some(arg_map_usermap),
xtructs: Some(arg_vec_xtructs),
};
s_cmp_nested_1.insert(Numberz::TWO, insanity.clone());
s_cmp_nested_1.insert(Numberz::THREE, insanity.clone());
s_cmp_nested_1.insert(Numberz::Two, insanity.clone());
s_cmp_nested_1.insert(Numberz::Three, insanity.clone());
let mut s_cmp_nested_2: BTreeMap<Numberz, Insanity> = BTreeMap::new();
let empty_insanity = Insanity {
user_map: Some(BTreeMap::new()),
xtructs: Some(Vec::new()),
};
s_cmp_nested_2.insert(Numberz::SIX, empty_insanity);
s_cmp_nested_2.insert(Numberz::Six, empty_insanity);
let mut s_cmp: BTreeMap<UserId, BTreeMap<Numberz, Insanity>> = BTreeMap::new();
s_cmp.insert(1 as UserId, s_cmp_nested_1);

View file

@ -273,15 +273,15 @@ impl ThriftTestSyncHandler for ThriftTestSyncHandlerImpl {
) -> thrift::Result<BTreeMap<UserId, BTreeMap<Numberz, Insanity>>> {
info!("testInsanity({:?})", argument);
let mut map_0: BTreeMap<Numberz, Insanity> = BTreeMap::new();
map_0.insert(Numberz::TWO, argument.clone());
map_0.insert(Numberz::THREE, argument.clone());
map_0.insert(Numberz::Two, argument.clone());
map_0.insert(Numberz::Three, argument.clone());
let mut map_1: BTreeMap<Numberz, Insanity> = BTreeMap::new();
let insanity = Insanity {
user_map: None,
xtructs: None,
};
map_1.insert(Numberz::SIX, insanity);
map_1.insert(Numberz::Six, insanity);
let mut ret: BTreeMap<UserId, BTreeMap<Numberz, Insanity>> = BTreeMap::new();
ret.insert(1, map_0);

View file

@ -718,5 +718,32 @@
"multic"
],
"workdir": "rs/bin"
},
{
"name": "nodets",
"env": {
"NODE_PATH": "../lib"
},
"server": {
"command": [
"runServer.sh"
]
},
"client": {
"timeout": 6,
"command": [
"runClient.sh"
]
},
"protocols": [
"binary"
],
"sockets": [
"ip"
],
"transports": [
"buffered"
],
"workdir": "../lib/nodets/test"
}
]