Upgrading dependencies to gorealis v2 and thrift 0.12.0

This commit is contained in:
Renan DelValle 2018-12-26 17:25:59 -08:00
parent 7cbbea498b
commit 54b8d7942a
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
1327 changed files with 137391 additions and 61476 deletions

View file

@ -44,10 +44,10 @@
var parseArgs = function(args) {
var skips = [
'--transport=http',
'--protocol=json',
'--protocol=json'
];
var opts = {
port: '9090',
port: '9090'
// protocol: 'json',
};
var keys = {};
@ -90,8 +90,8 @@
var opts = parseArgs(system.args.slice(1));
var port = opts.port;
var transport = new Thrift.Transport('http://localhost:' + port + '/service');
var protocol = new Thrift.Protocol(transport);
var client = new ThriftTest.ThriftTestClient(protocol);
var protocol = new Thrift.Protocol(transport);
var client = new ThriftTest.ThriftTestClient(protocol);
// TODO: Remove duplicate code with test.js.
@ -110,17 +110,17 @@
}
}
test("Void", function() {
test('Void', function() {
equal(client.testVoid(), undefined);
});
test("Binary (String)", function() {
test('Binary (String)', function() {
var binary = '';
for (var v = 255; v >= 0; --v) {
binary += String.fromCharCode(v);
}
equal(client.testBinary(binary), binary);
});
test("Binary (Uint8Array)", function() {
test('Binary (Uint8Array)', function() {
var binary = '';
for (var v = 255; v >= 0; --v) {
binary += String.fromCharCode(v);
@ -131,7 +131,7 @@
}
equal(client.testBinary(arr), binary);
});
test("String", function() {
test('String', function() {
equal(client.testString(''), '');
equal(client.testString(stringTest), stringTest);
@ -140,41 +140,41 @@
' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
' now-all-of-them-together: "\\\/\b\n\r\t' +
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><';
equal(client.testString(specialCharacters),specialCharacters);
equal(client.testString(specialCharacters), specialCharacters);
});
test("Double", function() {
test('Double', function() {
equal(client.testDouble(0), 0);
equal(client.testDouble(-1), -1);
equal(client.testDouble(3.14), 3.14);
equal(client.testDouble(Math.pow(2,60)), Math.pow(2,60));
equal(client.testDouble(Math.pow(2, 60)), Math.pow(2, 60));
});
test("Bool", function() {
test('Bool', function() {
equal(client.testBool(true), true);
equal(client.testBool(false), false);
});
test("I8", function() {
test('I8', function() {
equal(client.testByte(0), 0);
equal(client.testByte(0x01), 0x01);
});
test("I32", function() {
test('I32', function() {
equal(client.testI32(0), 0);
equal(client.testI32(Math.pow(2,30)), Math.pow(2,30));
equal(client.testI32(-Math.pow(2,30)), -Math.pow(2,30));
equal(client.testI32(Math.pow(2, 30)), Math.pow(2, 30));
equal(client.testI32(-Math.pow(2, 30)), -Math.pow(2, 30));
});
test("I64", function() {
test('I64', function() {
equal(client.testI64(0), 0);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
equal(client.testI64(Math.pow(2,52)), Math.pow(2,52));
equal(client.testI64(-Math.pow(2,52)), -Math.pow(2,52));
equal(client.testI64(Math.pow(2, 52)), Math.pow(2, 52));
equal(client.testI64(-Math.pow(2, 52)), -Math.pow(2, 52));
});
test("Struct", function() {
test('Struct', function() {
var structTestInput = new ThriftTest.Xtruct();
structTestInput.string_thing = 'worked';
structTestInput.byte_thing = 0x01;
structTestInput.i32_thing = Math.pow(2,30);
structTestInput.i32_thing = Math.pow(2, 30);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
structTestInput.i64_thing = Math.pow(2,52);
structTestInput.i64_thing = Math.pow(2, 52);
var structTestOutput = client.testStruct(structTestInput);
@ -186,18 +186,18 @@
equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
});
test("Nest", function() {
test('Nest', function() {
var xtrTestInput = new ThriftTest.Xtruct();
xtrTestInput.string_thing = 'worked';
xtrTestInput.byte_thing = 0x01;
xtrTestInput.i32_thing = Math.pow(2,30);
xtrTestInput.i32_thing = Math.pow(2, 30);
//This is usually 2^60 but JS cannot represent anything over 2^52 accurately
xtrTestInput.i64_thing = Math.pow(2,52);
xtrTestInput.i64_thing = Math.pow(2, 52);
var nestTestInput = new ThriftTest.Xtruct2();
nestTestInput.byte_thing = 0x02;
nestTestInput.struct_thing = xtrTestInput;
nestTestInput.i32_thing = Math.pow(2,15);
nestTestInput.i32_thing = Math.pow(2, 15);
var nestTestOutput = client.testNest(nestTestInput);
@ -211,8 +211,8 @@
equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
});
test("Map", function() {
var mapTestInput = {7:77, 8:88, 9:99};
test('Map', function() {
var mapTestInput = {7: 77, 8: 88, 9: 99};
var mapTestOutput = client.testMap(mapTestInput);
@ -221,10 +221,10 @@
}
});
test("StringMap", function() {
test('StringMap', function() {
var mapTestInput = {
"a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
"longValue":stringTest, stringTest:"long key"
'a': '123', 'a b': 'with spaces ', 'same': 'same', '0': 'numeric key',
'longValue': stringTest, stringTest: 'long key'
};
var mapTestOutput = client.testStringMap(mapTestInput);
@ -234,30 +234,30 @@
}
});
test("Set", function() {
var setTestInput = [1,2,3];
test('Set', function() {
var setTestInput = [1, 2, 3];
ok(client.testSet(setTestInput), setTestInput);
});
test("List", function() {
var listTestInput = [1,2,3];
test('List', function() {
var listTestInput = [1, 2, 3];
ok(client.testList(listTestInput), listTestInput);
});
test("Enum", function() {
test('Enum', function() {
equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
});
test("TypeDef", function() {
test('TypeDef', function() {
equal(client.testTypedef(69), 69);
});
test("Skip", function() {
test('Skip', function() {
var structTestInput = new ThriftTest.Xtruct();
var modifiedClient = new ThriftTest.ThriftTestClient(protocol);
modifiedClient.recv_testStruct = function() {
var input = modifiedClient.input;
var input = modifiedClient.input;
var xtruct3 = new ThriftTest.Xtruct3();
input.readMessageBegin();
@ -278,9 +278,9 @@
};
structTestInput.string_thing = 'worked';
structTestInput.byte_thing = 0x01;
structTestInput.i32_thing = Math.pow(2,30);
structTestInput.i64_thing = Math.pow(2,52);
structTestInput.byte_thing = 0x01;
structTestInput.i32_thing = Math.pow(2, 30);
structTestInput.i64_thing = Math.pow(2, 52);
var structTestOutput = modifiedClient.testStruct(structTestInput);
@ -291,10 +291,10 @@
equal(structTestOutput.i64_thing, structTestInput.i64_thing);
});
test("MapMap", function() {
test('MapMap', function() {
var mapMapTestExpectedResult = {
"4":{"1":1,"2":2,"3":3,"4":4},
"-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
'4': {'1': 1, '2': 2, '3': 3, '4': 4},
'-4': {'-4': -4, '-3': -3, '-2': -2, '-1': -1}
};
var mapMapTestOutput = client.testMapMap(1);
@ -309,55 +309,55 @@
checkRecursively(mapMapTestOutput, mapMapTestExpectedResult);
});
test("Xception", function() {
test('Xception', function() {
try {
client.testException("Xception");
client.testException('Xception');
ok(false);
} catch (e) {
equal(e.errorCode, 1001);
equal(e.message, "Xception");
equal(e.message, 'Xception');
}
});
test("no Exception", function() {
test('no Exception', function() {
try {
client.testException("no Exception");
client.testException('no Exception');
} catch (e) {
ok(false);
}
});
test("TException", function() {
test('TException', function() {
try {
client.testException("TException");
client.testException('TException');
ok(false);
} catch(e) {
} catch (e) {
ok(ok);
}
});
var crazy = {
"userMap":{ "5":5, "8":8 },
"xtructs":[{
"string_thing":"Goodbye4",
"byte_thing":4,
"i32_thing":4,
"i64_thing":4
'userMap': { '5': 5, '8': 8 },
'xtructs': [{
'string_thing': 'Goodbye4',
'byte_thing': 4,
'i32_thing': 4,
'i64_thing': 4
},
{
"string_thing":"Hello2",
"byte_thing":2,
"i32_thing":2,
"i64_thing":2
'string_thing': 'Hello2',
'byte_thing': 2,
'i32_thing': 2,
'i64_thing': 2
}]
};
test("Insanity", function() {
test('Insanity', function() {
var insanity = {
"1":{
"2":crazy,
"3":crazy
'1': {
'2': crazy,
'3': crazy
},
"2":{ "6":{ "userMap":null, "xtructs":null } }
'2': { '6': { 'userMap': null, 'xtructs': null } }
};
var res = client.testInsanity(new ThriftTest.Insanity(crazy));
ok(res, JSON.stringify(res));