Repository: thrift Updated Branches: refs/heads/master 3641b5435 -> b909a3897
THRIFT-3627 fix missing basic code style consistency of JavaScript. Client: js This closes #858 This closes #1243 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/b909a389 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/b909a389 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/b909a389 Branch: refs/heads/master Commit: b909a3897b72fee7f1d9957df5d6702e5f06b442 Parents: 3641b54 Author: Kazuki Matsuda <[email protected]> Authored: Sat Feb 13 19:36:09 2016 +0900 Committer: James E. King, III <[email protected]> Committed: Thu Apr 6 19:12:28 2017 -0400 ---------------------------------------------------------------------- lib/js/src/thrift.js | 236 ++++++++++++++--------------- lib/js/test/deep-constructor.test.js | 28 ++-- lib/js/test/phantom-client.js | 136 ++++++++--------- lib/js/test/phantomjs-qunit.js | 24 +-- lib/js/test/server_http.js | 12 +- lib/js/test/server_https.js | 18 +-- lib/js/test/test-async.js | 242 +++++++++++++++--------------- lib/js/test/test-jq.js | 90 +++++------ lib/js/test/test-nojq.js | 14 +- lib/js/test/test.js | 188 +++++++++++------------ lib/js/test/test_handler.js | 4 +- 11 files changed, 496 insertions(+), 496 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/src/thrift.js ---------------------------------------------------------------------- diff --git a/lib/js/src/thrift.js b/lib/js/src/thrift.js index 3ea57c8..37ba690 100644 --- a/lib/js/src/thrift.js +++ b/lib/js/src/thrift.js @@ -20,21 +20,21 @@ /*jshint evil:true*/ /** - * The Thrift namespace houses the Apache Thrift JavaScript library - * elements providing JavaScript bindings for the Apache Thrift RPC - * system. End users will typically only directly make use of the - * Transport (TXHRTransport/TWebSocketTransport) and Protocol + * The Thrift namespace houses the Apache Thrift JavaScript library + * elements providing JavaScript bindings for the Apache Thrift RPC + * system. End users will typically only directly make use of the + * Transport (TXHRTransport/TWebSocketTransport) and Protocol * (TJSONPRotocol/TBinaryProtocol) constructors. - * - * Object methods beginning with a __ (e.g. __onOpen()) are internal + * + * Object methods beginning with a __ (e.g. __onOpen()) are internal * and should not be called outside of the object's own methods. - * + * * This library creates one global object: Thrift * Code in this library must never create additional global identifiers, * all features must be scoped within the Thrift namespace. * @namespace * @example - * var transport = new Thrift.Transport("http://localhost:8585"); + * var transport = new Thrift.Transport('http://localhost:8585'); * var protocol = new Thrift.Protocol(transport); * var client = new MyThriftSvcClient(protocol); * var result = client.MyMethod(); @@ -55,7 +55,7 @@ var Thrift = { * @property {number} VOID - No value (only legal for return types). * @property {number} BOOL - True/False integer. * @property {number} BYTE - Signed 8 bit integer. - * @property {number} I08 - Signed 8 bit integer. + * @property {number} I08 - Signed 8 bit integer. * @property {number} DOUBLE - 64 bit IEEE 854 floating point. * @property {number} I16 - Signed 16 bit integer. * @property {number} I32 - Signed 32 bit integer. @@ -70,23 +70,23 @@ var Thrift = { * @property {number} UTF16 - Array of bytes representing a string of UTF16 encoded characters. */ Type: { - 'STOP' : 0, - 'VOID' : 1, - 'BOOL' : 2, - 'BYTE' : 3, - 'I08' : 3, - 'DOUBLE' : 4, - 'I16' : 6, - 'I32' : 8, - 'I64' : 10, - 'STRING' : 11, - 'UTF7' : 11, - 'STRUCT' : 12, - 'MAP' : 13, - 'SET' : 14, - 'LIST' : 15, - 'UTF8' : 16, - 'UTF16' : 17 + STOP: 0, + VOID: 1, + BOOL: 2, + BYTE: 3, + I08: 3, + DOUBLE: 4, + I16: 6, + I32: 8, + I64: 10, + STRING: 11, + UTF7: 11, + STRUCT: 12, + MAP: 13, + SET: 14, + LIST: 15, + UTF8: 16, + UTF16: 17 }, /** @@ -98,10 +98,10 @@ var Thrift = { * @property {number} ONEWAY - Oneway RPC call from client to server with no response. */ MessageType: { - 'CALL' : 1, - 'REPLY' : 2, - 'EXCEPTION' : 3, - 'ONEWAY' : 4 + CALL: 1, + REPLY: 2, + EXCEPTION: 3, + ONEWAY: 4 }, /** @@ -130,7 +130,7 @@ var Thrift = { function F() {} F.prototype = superConstructor.prototype; constructor.prototype = new F(); - constructor.prototype.name = name || ""; + constructor.prototype.name = name || ''; } }; @@ -171,17 +171,17 @@ Thrift.TException.prototype.getMessage = function() { * @property {number} UNSUPPORTED_CLIENT_TYPE - Unused. */ Thrift.TApplicationExceptionType = { - 'UNKNOWN' : 0, - 'UNKNOWN_METHOD' : 1, - 'INVALID_MESSAGE_TYPE' : 2, - 'WRONG_METHOD_NAME' : 3, - 'BAD_SEQUENCE_ID' : 4, - 'MISSING_RESULT' : 5, - 'INTERNAL_ERROR' : 6, - 'PROTOCOL_ERROR' : 7, - 'INVALID_TRANSFORM' : 8, - 'INVALID_PROTOCOL' : 9, - 'UNSUPPORTED_CLIENT_TYPE' : 10 + UNKNOWN: 0, + UNKNOWN_METHOD: 1, + INVALID_MESSAGE_TYPE: 2, + WRONG_METHOD_NAME: 3, + BAD_SEQUENCE_ID: 4, + MISSING_RESULT: 5, + INTERNAL_ERROR: 6, + PROTOCOL_ERROR: 7, + INVALID_TRANSFORM: 8, + INVALID_PROTOCOL: 9, + UNSUPPORTED_CLIENT_TYPE: 10 }; /** @@ -194,7 +194,7 @@ Thrift.TApplicationExceptionType = { */ Thrift.TApplicationException = function(message, code) { this.message = message; - this.code = typeof code === "number" ? code : 0; + this.code = typeof code === 'number' ? code : 0; }; Thrift.inherits(Thrift.TApplicationException, Thrift.TException, 'TApplicationException'); @@ -298,8 +298,8 @@ Thrift.inherits(Thrift.TProtocolException, Thrift.TException, 'TProtocolExceptio * for backward compatibility. * @constructor * @param {string} [url] - The URL to connect to. - * @classdesc The Apache Thrift Transport layer performs byte level I/O - * between RPC clients and servers. The JavaScript TXHRTransport object + * @classdesc The Apache Thrift Transport layer performs byte level I/O + * between RPC clients and servers. The JavaScript TXHRTransport object * uses Http[s]/XHR. Target servers must implement the http[s] transport * (see: node.js example server_http.js). * @example @@ -329,12 +329,12 @@ Thrift.TXHRTransport.prototype = { }, /** - * Sends the current XRH request if the transport was created with a URL + * Sends the current XRH request if the transport was created with a URL * and the async parameter is false. If the transport was not created with - * a URL, or the async parameter is True and no callback is provided, or + * a URL, or the async parameter is True and no callback is provided, or * the URL is an empty string, the current send buffer is returned. * @param {object} async - If true the current send buffer is returned. - * @param {object} callback - Optional async completion callback + * @param {object} callback - Optional async completion callback * @returns {undefined|string} Nothing or the current send buffer. * @throws {string} If XHR fails. */ @@ -353,9 +353,9 @@ Thrift.TXHRTransport.prototype = { if (callback) { //Ignore XHR callbacks until the data arrives, then call the // client's callback - xreq.onreadystatechange = + xreq.onreadystatechange = (function() { - var clientCallback = callback; + var clientCallback = callback; return function() { if (this.readyState == 4 && this.status == 200) { self.setRecvBuffer(this.responseText); @@ -459,19 +459,19 @@ Thrift.TXHRTransport.prototype = { * Returns true if the transport is open, XHR always returns true. * @readonly * @returns {boolean} Always True. - */ + */ isOpen: function() { return true; }, /** * Opens the transport connection, with XHR this is a nop. - */ + */ open: function() {}, /** * Closes the transport connection, with XHR this is a nop. - */ + */ close: function() {}, /** @@ -511,7 +511,7 @@ Thrift.TXHRTransport.prototype = { /** * Sets the send buffer to buf. * @param {string} buf - The buffer to send. - */ + */ write: function(buf) { this.send_buf = buf; }, @@ -520,7 +520,7 @@ Thrift.TXHRTransport.prototype = { * Returns the send buffer. * @readonly * @returns {string} The send buffer. - */ + */ getSendBuffer: function() { return this.send_buf; } @@ -532,8 +532,8 @@ Thrift.TXHRTransport.prototype = { * Constructor Function for the WebSocket transport. * @constructor * @param {string} [url] - The URL to connect to. - * @classdesc The Apache Thrift Transport layer performs byte level I/O - * between RPC clients and servers. The JavaScript TWebSocketTransport object + * @classdesc The Apache Thrift Transport layer performs byte level I/O + * between RPC clients and servers. The JavaScript TWebSocketTransport object * uses the WebSocket protocol. Target servers must implement WebSocket. * (see: node.js example server_http.js). * @example @@ -556,20 +556,20 @@ Thrift.TWebSocketTransport.prototype = { }, /** - * Sends the current WS request and registers callback. The async - * parameter is ignored (WS flush is always async) and the callback + * Sends the current WS request and registers callback. The async + * parameter is ignored (WS flush is always async) and the callback * function parameter is required. * @param {object} async - Ignored. * @param {object} callback - The client completion callback. - * @returns {undefined|string} Nothing (undefined) + * @returns {undefined|string} Nothing (undefined) */ flush: function(async, callback) { var self = this; if (this.isOpen()) { //Send data and register a callback to invoke the client callback - this.socket.send(this.send_buf); + this.socket.send(this.send_buf); this.callbacks.push((function() { - var clientCallback = callback; + var clientCallback = callback; return function(msg) { self.setRecvBuffer(msg); clientCallback(); @@ -579,20 +579,20 @@ Thrift.TWebSocketTransport.prototype = { //Queue the send to go out __onOpen this.send_pending.push({ buf: this.send_buf, - cb: callback + cb: callback }); } }, - __onOpen: function() { + __onOpen: function() { var self = this; if (this.send_pending.length > 0) { - //If the user made calls before the connection was fully + //If the user made calls before the connection was fully //open, send them now this.send_pending.forEach(function(elem) { this.socket.send(elem.buf); this.callbacks.push((function() { - var clientCallback = elem.cb; + var clientCallback = elem.cb; return function(msg) { self.setRecvBuffer(msg); clientCallback(); @@ -602,19 +602,19 @@ Thrift.TWebSocketTransport.prototype = { this.send_pending = []; } }, - - __onClose: function(evt) { + + __onClose: function(evt) { this.__reset(this.url); }, - + __onMessage: function(evt) { if (this.callbacks.length) { this.callbacks.shift()(evt.data); } }, - - __onError: function(evt) { - console.log("Thrift WebSocket Error: " + evt.toString()); + + __onError: function(evt) { + console.log('Thrift WebSocket Error: ' + evt.toString()); this.socket.close(); }, @@ -632,15 +632,15 @@ Thrift.TWebSocketTransport.prototype = { /** * Returns true if the transport is open * @readonly - * @returns {boolean} - */ + * @returns {boolean} + */ isOpen: function() { return this.socket && this.socket.readyState == this.socket.OPEN; }, /** * Opens the transport connection - */ + */ open: function() { //If OPEN/CONNECTING/CLOSING ignore additional opens if (this.socket && this.socket.readyState != this.socket.CLOSED) { @@ -648,15 +648,15 @@ Thrift.TWebSocketTransport.prototype = { } //If there is no socket or the socket is closed: this.socket = new WebSocket(this.url); - this.socket.onopen = this.__onOpen.bind(this); - this.socket.onmessage = this.__onMessage.bind(this); - this.socket.onerror = this.__onError.bind(this); - this.socket.onclose = this.__onClose.bind(this); + this.socket.onopen = this.__onOpen.bind(this); + this.socket.onmessage = this.__onMessage.bind(this); + this.socket.onerror = this.__onError.bind(this); + this.socket.onclose = this.__onClose.bind(this); }, /** * Closes the transport connection - */ + */ close: function() { this.socket.close(); }, @@ -698,7 +698,7 @@ Thrift.TWebSocketTransport.prototype = { /** * Sets the send buffer to buf. * @param {string} buf - The buffer to send. - */ + */ write: function(buf) { this.send_buf = buf; }, @@ -707,7 +707,7 @@ Thrift.TWebSocketTransport.prototype = { * Returns the send buffer. * @readonly * @returns {string} The send buffer. - */ + */ getSendBuffer: function() { return this.send_buf; } @@ -718,8 +718,8 @@ Thrift.TWebSocketTransport.prototype = { * Initializes a Thrift JSON protocol instance. * @constructor * @param {Thrift.Transport} transport - The transport to serialize to/from. - * @classdesc Apache Thrift Protocols perform serialization which enables cross - * language RPC. The Protocol type is the JavaScript browser implementation + * @classdesc Apache Thrift Protocols perform serialization which enables cross + * language RPC. The Protocol type is the JavaScript browser implementation * of the Apache Thrift TJSONProtocol. * @example * var protocol = new Thrift.Protocol(transport); @@ -779,7 +779,7 @@ Thrift.Protocol.prototype = { * Returns the underlying transport. * @readonly * @returns {Thrift.Transport} The underlying transport. - */ + */ getTransport: function() { return this.transport; }, @@ -1021,7 +1021,7 @@ Thrift.Protocol.prototype = { if (ch === '\"') { escapedString += '\\\"'; // write out as: \" } else if (ch === '\\') { // a single backslash - escapedString += '\\\\'; // write out as double backslash + escapedString += '\\\\'; // write out as double backslash } else if (ch === '\b') { // a single backspace: invisible escapedString += '\\b'; // write out as: \b" } else if (ch === '\f') { // a single formfeed: invisible @@ -1063,8 +1063,8 @@ Thrift.Protocol.prototype = { @property {Thrift.MessageType} mtype - The type of message call. @property {number} rseqid - The sequence number of the message (0 in Thrift RPC). */ - /** - * Deserializes the beginning of a message. + /** + * Deserializes the beginning of a message. * @returns {AnonReadMessageBeginReturn} */ readMessageBegin: function() { @@ -1101,11 +1101,11 @@ Thrift.Protocol.prototype = { readMessageEnd: function() { }, - /** - * Deserializes the beginning of a struct. + /** + * Deserializes the beginning of a struct. * @param {string} [name] - The name of the struct (ignored) * @returns {object} - An object with an empty string fname property - */ + */ readStructBegin: function(name) { var r = {}; r.fname = ''; @@ -1132,8 +1132,8 @@ Thrift.Protocol.prototype = { @property {Thrift.Type} ftype - The data type of the field. @property {number} fid - The unique identifier of the field. */ - /** - * Deserializes the beginning of a field. + /** + * Deserializes the beginning of a field. * @returns {AnonReadFieldBeginReturn} */ readFieldBegin: function() { @@ -1201,8 +1201,8 @@ Thrift.Protocol.prototype = { @property {Thrift.Type} vtype - The data type of the value. @property {number} size - The number of elements in the map. */ - /** - * Deserializes the beginning of a map. + /** + * Deserializes the beginning of a map. * @returns {AnonReadMapBeginReturn} */ readMapBegin: function() { @@ -1237,8 +1237,8 @@ Thrift.Protocol.prototype = { @property {Thrift.Type} etype - The data type of the element. @property {number} size - The number of elements in the collection. */ - /** - * Deserializes the beginning of a list. + /** + * Deserializes the beginning of a list. * @returns {AnonReadColBeginReturn} */ readListBegin: function() { @@ -1259,8 +1259,8 @@ Thrift.Protocol.prototype = { this.readFieldEnd(); }, - /** - * Deserializes the beginning of a set. + /** + * Deserializes the beginning of a set. * @returns {AnonReadColBeginReturn} */ readSetBegin: function(elemType, size) { @@ -1272,8 +1272,8 @@ Thrift.Protocol.prototype = { return this.readListEnd(); }, - /** Returns an object with a value property set to - * False unless the next number in the protocol buffer + /** Returns an object with a value property set to + * False unless the next number in the protocol buffer * is 1, in which case the value property is True */ readBool: function() { var r = this.readI32(); @@ -1287,19 +1287,19 @@ Thrift.Protocol.prototype = { return r; }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readByte: function() { return this.readI32(); }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readI16: function() { return this.readI32(); }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readI32: function(f) { if (f === undefined) { @@ -1333,26 +1333,26 @@ Thrift.Protocol.prototype = { return r; }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readI64: function() { return this.readI32(); }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readDouble: function() { return this.readI32(); }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readString: function() { var r = this.readI32(); return r; }, - /** Returns the an object with a value property set to the + /** Returns the an object with a value property set to the next value found in the protocol buffer */ readBinary: function() { var r = this.readI32(); @@ -1360,7 +1360,7 @@ Thrift.Protocol.prototype = { return r; }, - /** + /** * Method to arbitrarily skip over data */ skip: function(type) { var ret, i; @@ -1440,23 +1440,23 @@ Thrift.Protocol.prototype = { * Initializes a MutilplexProtocol Implementation as a Wrapper for Thrift.Protocol * @constructor */ -Thrift.MultiplexProtocol = function (srvName, trans, strictRead, strictWrite) { +Thrift.MultiplexProtocol = function(srvName, trans, strictRead, strictWrite) { Thrift.Protocol.call(this, trans, strictRead, strictWrite); this.serviceName = srvName; }; Thrift.inherits(Thrift.MultiplexProtocol, Thrift.Protocol, 'multiplexProtocol'); /** Override writeMessageBegin method of prototype*/ -Thrift.MultiplexProtocol.prototype.writeMessageBegin = function (name, type, seqid) { +Thrift.MultiplexProtocol.prototype.writeMessageBegin = function(name, type, seqid) { if (type === Thrift.MessageType.CALL || type === Thrift.MessageType.ONEWAY) { - Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ":" + name, type, seqid); + Thrift.Protocol.prototype.writeMessageBegin.call(this, this.serviceName + ':' + name, type, seqid); } else { Thrift.Protocol.prototype.writeMessageBegin.call(this, name, type, seqid); } }; -Thrift.Multiplexer = function () { +Thrift.Multiplexer = function() { this.seqid = 0; }; @@ -1471,12 +1471,12 @@ Thrift.Multiplexer = function () { * var protocol = new Thrift.Protocol(transport); * var client = mp.createClient('AuthService', AuthServiceClient, transport); */ -Thrift.Multiplexer.prototype.createClient = function (serviceName, SCl, transport) { +Thrift.Multiplexer.prototype.createClient = function(serviceName, SCl, transport) { if (SCl.Client) { SCl = SCl.Client; } var self = this; - SCl.prototype.new_seqid = function () { + SCl.prototype.new_seqid = function() { self.seqid += 1; return self.seqid; }; @@ -1519,7 +1519,7 @@ copyList = function(lst, types) { return result; }; -copyMap = function(obj, types){ +copyMap = function(obj, types) { if (!obj) {return obj; } @@ -1534,8 +1534,8 @@ copyMap = function(obj, types){ var Type = type; var result = {}, val; - for(var prop in obj) { - if(obj.hasOwnProperty(prop)) { + for (var prop in obj) { + if (obj.hasOwnProperty(prop)) { val = obj[prop]; if (type === null) { result[prop] = val; http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/deep-constructor.test.js ---------------------------------------------------------------------- diff --git a/lib/js/test/deep-constructor.test.js b/lib/js/test/deep-constructor.test.js index 9a19809..336fc15 100644 --- a/lib/js/test/deep-constructor.test.js +++ b/lib/js/test/deep-constructor.test.js @@ -1,16 +1,16 @@ function serialize(data) { - var transport = new Thrift.Transport("/service"); - var protocol = new Thrift.Protocol(transport); - protocol.writeMessageBegin("", 0, 0); + var transport = new Thrift.Transport('/service'); + var protocol = new Thrift.Protocol(transport); + protocol.writeMessageBegin('', 0, 0); data.write(protocol); protocol.writeMessageEnd(); return transport.send_buf; } function deserialize(serialized, type) { - var transport = new Thrift.Transport("/service"); + var transport = new Thrift.Transport('/service'); transport.setRecvBuffer(serialized); - var protocol = new Thrift.Protocol(transport); + var protocol = new Thrift.Protocol(transport); protocol.readMessageBegin(); var data = new type(); data.read(protocol); @@ -27,12 +27,12 @@ function createThriftObj() { struct_list_field: [ new Simple({value: 'b'}), - new Simple({value: 'c'}), + new Simple({value: 'c'}) ], struct_set_field: [ new Simple({value: 'd'}), - new Simple({value: 'e'}), + new Simple({value: 'e'}) ], struct_map_field: { @@ -75,12 +75,12 @@ function createJsObj() { struct_list_field: [ {value: 'b'}, - {value: 'c'}, + {value: 'c'} ], struct_set_field: [ {value: 'd'}, - {value: 'e'}, + {value: 'e'} ], struct_map_field: { @@ -129,7 +129,7 @@ function assertValues(obj, assert) { var cases = { - "Serialize/deserialize simple struct should return equal object": function(assert){ + 'Serialize/deserialize simple struct should return equal object': function(assert) { var tObj = new Simple({value: 'a'}); var received = deserialize(serialize(tObj), Simple); assert.ok(tObj !== received); @@ -137,21 +137,21 @@ var cases = { }, - "Serialize/deserialize should return equal object": function(assert){ + 'Serialize/deserialize should return equal object': function(assert) { var tObj = createThriftObj(); var received = deserialize(serialize(tObj), Complex); assert.ok(tObj !== received); assert.deepEqual(received, tObj); }, - "Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects": function(assert) { + 'Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects': function(assert) { var tObj1 = createThriftObj(); var tObj2 = new Complex(createJsObj()); assertValues(tObj2, assert); assert.equal(serialize(tObj2), serialize(tObj1)); }, - "Modifications to args object should not affect constructed Thrift object": function (assert) { + 'Modifications to args object should not affect constructed Thrift object': function(assert) { var args = createJsObj(); assertValues(args, assert); @@ -174,7 +174,7 @@ var cases = { assertValues(tObj, assert); }, - "nulls are ok": function(assert) { + 'nulls are ok': function(assert) { var tObj = new Complex({ struct_field: null, struct_list_field: null, http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/phantom-client.js ---------------------------------------------------------------------- diff --git a/lib/js/test/phantom-client.js b/lib/js/test/phantom-client.js index f75b256..d517e71 100644 --- a/lib/js/test/phantom-client.js +++ b/lib/js/test/phantom-client.js @@ -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)); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/phantomjs-qunit.js ---------------------------------------------------------------------- diff --git a/lib/js/test/phantomjs-qunit.js b/lib/js/test/phantomjs-qunit.js index a840db6..c1d7a5b 100755 --- a/lib/js/test/phantomjs-qunit.js +++ b/lib/js/test/phantomjs-qunit.js @@ -28,18 +28,18 @@ function waitFor(testFx, onReady, timeOutMillis) { start = new Date().getTime(), condition = false, interval = setInterval(function() { - if ( (new Date().getTime() - start < maxtimeOutMillis) && !condition ) { + if ((new Date().getTime() - start < maxtimeOutMillis) && !condition) { // If not time-out yet and condition not yet fulfilled - condition = (typeof(testFx) === "string" ? eval(testFx) : testFx()); //< defensive code + condition = (typeof(testFx) === 'string' ? eval(testFx) : testFx()); //< defensive code } else { - if(!condition) { + if (!condition) { // If condition still not fulfilled (timeout but condition is 'false') console.log("'waitFor()' timeout"); phantom.exit(1); } else { // Condition fulfilled (timeout and/or condition is 'true') - console.log("'waitFor()' finished in " + (new Date().getTime() - start) + "ms."); - if (typeof(onReady) === "string") { + console.log("'waitFor()' finished in " + (new Date().getTime() - start) + 'ms.'); + if (typeof(onReady) === 'string') { eval(onReady); } else { onReady(); //< Do what it's supposed to do once the condition is fulfilled @@ -63,21 +63,21 @@ page.onConsoleMessage = function(msg) { console.log(msg); }; -page.open(system.args[1], function(status){ - if (status !== "success") { - console.log("Unable to access network"); +page.open(system.args[1], function(status) { + if (status !== 'success') { + console.log('Unable to access network'); phantom.exit(1); } else { - waitFor(function(){ - return page.evaluate(function(){ + waitFor(function() { + return page.evaluate(function() { var el = document.getElementById('qunit-testresult'); if (el && el.innerText.match('completed')) { return true; } return false; }); - }, function(){ - var failedNum = page.evaluate(function(){ + }, function() { + var failedNum = page.evaluate(function() { var el = document.getElementById('qunit-testresult'); console.log(el.innerText); try { http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/server_http.js ---------------------------------------------------------------------- diff --git a/lib/js/test/server_http.js b/lib/js/test/server_http.js index e195e80..1115474 100644 --- a/lib/js/test/server_http.js +++ b/lib/js/test/server_http.js @@ -18,11 +18,11 @@ */ //This HTTP server is designed to serve the test.html browser -// based JavaScript test page (which must be in the current directory). +// based JavaScript test page (which must be in the current directory). // This server also supplies the Thrift based test service, which depends // on the standard ThriftTest.thrift IDL service (which must be compiled // for Node and browser based JavaScript in ./gen-nodejs and ./gen-js -// respectively). +// respectively). var thrift = require('../../nodejs/lib/thrift'); var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js'); @@ -36,14 +36,14 @@ var ThriftTestSvcOpt = { }; var ThriftWebServerOptions = { - files: ".", + files: '.', services: { - "/service": ThriftTestSvcOpt + '/service': ThriftTestSvcOpt } }; var server = thrift.createWebServer(ThriftWebServerOptions); var port = 8088; server.listen(port); -console.log("Serving files from: " + __dirname); -console.log("Http/Thrift Server running on port: " + port); +console.log('Serving files from: ' + __dirname); +console.log('Http/Thrift Server running on port: ' + port); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/server_https.js ---------------------------------------------------------------------- diff --git a/lib/js/test/server_https.js b/lib/js/test/server_https.js index af1745b..7e78d9e 100644 --- a/lib/js/test/server_https.js +++ b/lib/js/test/server_https.js @@ -18,7 +18,7 @@ */ //This HTTP server is designed to server the test.html browser -// based JavaScript test page (which must be in the current directory). +// based JavaScript test page (which must be in the current directory). // This server also supplies the Thrift based test service, which depends // on the standard ThriftTest.thrift IDL service (which must be compiled // for Node and browser based JavaScript in ./gen-nodejs and ./gen-js @@ -26,7 +26,7 @@ // support libraries for test.html (jquery.js, qunit.js and qunit.css // in ./build/js/lib). -var fs = require("fs"); +var fs = require('fs'); var thrift = require('../../nodejs/lib/thrift'); var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js'); var ThriftTestHandler = require('./test_handler').ThriftTestHandler; @@ -40,18 +40,18 @@ var ThriftTestSvcOpt = { }; var ThriftWebServerOptions = { - files: ".", + files: '.', tls: { - key: fs.readFileSync("../../../test/keys/server.key"), - cert: fs.readFileSync("../../../test/keys/server.crt") - }, + key: fs.readFileSync('../../../test/keys/server.key'), + cert: fs.readFileSync('../../../test/keys/server.crt') + }, services: { - "/service": ThriftTestSvcOpt + '/service': ThriftTestSvcOpt } }; var server = thrift.createWebServer(ThriftWebServerOptions); var port = 8089; server.listen(port); -console.log("Serving files from: " + __dirname); -console.log("Http/Thrift Server running on port: " + port); +console.log('Serving files from: ' + __dirname); +console.log('Http/Thrift Server running on port: ' + port); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/test-async.js ---------------------------------------------------------------------- diff --git a/lib/js/test/test-async.js b/lib/js/test/test-async.js index 336e2bc..b56f2a2 100644 --- a/lib/js/test/test-async.js +++ b/lib/js/test/test-async.js @@ -17,9 +17,9 @@ * under the License. */ /* jshint -W100 */ - + /* - * Fully Async JavaScript test suite for ThriftTest.thrift. + * Fully Async JavaScript test suite for ThriftTest.thrift. * These tests are designed to exercise the WebSocket transport * (which is exclusively async). * @@ -31,7 +31,7 @@ // all Languages in UTF-8 var stringTest = "Afrikaans, Alemannisch, Aragonés, Ø§ÙØ¹Ø±Ø¨ÙØ©, ٠صرÙ, Asturianu, Aymar aru, AzÉrbaycan, ÐаÑҡоÑÑ, Boarisch, ŽemaitÄÅ¡ka, ÐелаÑÑÑкаÑ, ÐелаÑÑÑÐºÐ°Ñ (ÑаÑаÑкевÑÑа), ÐÑлгаÑÑки, Bamanankan, বাà¦à¦²à¦¾, Brezhoneg, Bosanski, Català , Mìng-dÄ̤ng-ngá¹³Ì, ÐÐ¾Ñ Ñийн, Cebuano, á£á³á©, Äesky, СловѣÌнÑÑÐºÑ / â°â°â°â°â°¡â°â° â°â°â°, ЧÓваÑла, Cymraeg, Dansk, Zazaki, ÞÞ¨ÞÞ¬ÞÞ¨ÞÞ¦ÞÞ°, Îλληνικά, Emilià n e rumagnòl, English, Esperanto, Español, Eesti, Euskara, ÙØ§Ø±Ø³Û, Suomi, Võro, Føroyskt, Français, Arpetan, Furlan, Frysk, Gaeilge, è´èª, Gà idhlig, Galego, Avañe'ẽ, àªà«àªàª°àª¾àª¤à«, Gaelg, ×¢×ר×ת, हिनà¥à¤¦à¥, Fiji Hindi, Hrvatski, Kreyòl ayisyen, Magyar, ÕÕ¡ÕµÕ¥ÖÕ¥Õ¶, Interlingua, Bahasa Indonesia, Ilokano, Ido, Ãslenska, Italiano, æ¥æ¬èª, Lojban, Basa Jawa, á¥áá áá£áá, Kongo, Kalaallisut, à²à²¨à³à²¨à²¡, íêµì´, ÐÑаÑа Ñай-ÐалкÑаÑ, Ripoarisch, Kurdî, Ðоми, Kernewek, ÐÑÑгÑзÑа, Latina, Ladino, Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, LatvieÅ¡u, Basa Banyumasan, Malagasy, ÐакедонÑки, മലയാളà´, मराठà¥, Bahasa Melayu, Ù Ø§Ø²ÙØ±ÙÙÛ, Nnapulitano, Nedersaksisch, नà¥à¤ªà¤¾à¤² à¤à¤¾à¤·à¤¾, Nederlands, âªNorsk (nynorsk)â¬, âªNorsk (bokmÃ¥l)â¬, Nouormand, Diné bizaad, Occitan, ÐÑонаÑ, Papiamentu, Deitsch, Norfuk / Pitkern, Polski, Ù¾ÙØ¬Ø§Ø¨Û, Ù¾ÚØªÙ, Português, Runa Simi, Rumantsch, Romani, RomânÄ, Ð ÑÑÑкий, Ð¡Ð°Ñ Ð° ÑÑла, Sardu, Sicilianu, Scots, Sámegiella, Simple English, SlovenÄina, SlovenÅ¡Äina, СÑпÑки / Srpski, Seeltersk, Svenska, Kiswahili, தமிழà¯, à°¤à±à°²à±à°à±, Тоҷикӣ, à¹à¸à¸¢, Türkmençe, Tagalog, Türkçe, ТаÑаÑÑа/Tatarça, УкÑаÑнÑÑка, اردÙ, Tiếng Viá»t, Volapük, Walon, Winaray, å´è¯, isiXhosa, ××Ö´××ש, Yorùbá, Zeêuws, 䏿, B ân-lâm-gú, ç²µèª"; - + function checkRecursively(map1, map2) { if (typeof map1 !== 'function' && typeof map2 !== 'function') { if (!map1 || typeof map1 !== 'object') { @@ -44,25 +44,25 @@ function checkRecursively(map1, map2) { } } -module("Base Types"); +module('Base Types'); - asyncTest("Void", function() { - expect( 1 ); + asyncTest('Void', function() { + expect(1); client.testVoid(function(result) { equal(result, undefined); QUnit.start(); }); }); - - - asyncTest("String", function() { - expect( 3 ); + + + asyncTest('String', function() { + expect(3); QUnit.stop(2); - client.testString('', function(result){ + client.testString('', function(result) { equal(result, ''); QUnit.start(); }); - client.testString(stringTest, function(result){ + client.testString(stringTest, function(result) { equal(result, stringTest); QUnit.start(); }); @@ -72,34 +72,34 @@ module("Base Types"); ' backspace: \b formfeed: \f newline: \n return: \r tab: ' + ' now-all-of-them-together: "\\\/\b\n\r\t' + ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><'; - client.testString(specialCharacters, function(result){ + client.testString(specialCharacters, function(result) { equal(result, specialCharacters); QUnit.start(); }); }); - asyncTest("Double", function() { - expect( 4 ); + asyncTest('Double', function() { + expect(4); QUnit.stop(3); - client.testDouble(0, function(result){ + client.testDouble(0, function(result) { equal(result, 0); QUnit.start(); }); - client.testDouble(-1, function(result){ + client.testDouble(-1, function(result) { equal(result, -1); QUnit.start(); }); - client.testDouble(3.14, function(result){ + client.testDouble(3.14, function(result) { equal(result, 3.14); QUnit.start(); }); - client.testDouble(Math.pow(2,60), function(result){ - equal(result, Math.pow(2,60)); + client.testDouble(Math.pow(2, 60), function(result) { + equal(result, Math.pow(2, 60)); QUnit.start(); }); }); - // TODO: add testBinary() - asyncTest("Byte", function() { - expect( 2 ); + // TODO: add testBinary() + asyncTest('Byte', function() { + expect(2); QUnit.stop(); client.testByte(0, function(result) { equal(result, 0); @@ -110,110 +110,110 @@ module("Base Types"); QUnit.start(); }); }); - asyncTest("I32", function() { - expect( 3 ); + asyncTest('I32', function() { + expect(3); QUnit.stop(2); - client.testI32(0, function(result){ + client.testI32(0, function(result) { equal(result, 0); QUnit.start(); }); - client.testI32(Math.pow(2,30), function(result){ - equal(result, Math.pow(2,30)); + client.testI32(Math.pow(2, 30), function(result) { + equal(result, Math.pow(2, 30)); QUnit.start(); }); - client.testI32(-Math.pow(2,30), function(result){ - equal(result, -Math.pow(2,30)); + client.testI32(-Math.pow(2, 30), function(result) { + equal(result, -Math.pow(2, 30)); QUnit.start(); }); }); - asyncTest("I64", function() { - expect( 3 ); + asyncTest('I64', function() { + expect(3); QUnit.stop(2); - client.testI64(0, function(result){ + client.testI64(0, function(result) { equal(result, 0); QUnit.start(); }); //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - client.testI64(Math.pow(2,52), function(result){ - equal(result, Math.pow(2,52)); + client.testI64(Math.pow(2, 52), function(result) { + equal(result, Math.pow(2, 52)); QUnit.start(); }); - client.testI64(-Math.pow(2,52), function(result){ - equal(result, -Math.pow(2,52)); + client.testI64(-Math.pow(2, 52), function(result) { + equal(result, -Math.pow(2, 52)); QUnit.start(); }); }); - - -module("Structured Types"); - asyncTest("Struct", function() { - expect( 5 ); + +module('Structured Types'); + + asyncTest('Struct', function() { + expect(5); 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); - client.testStruct(structTestInput, function(result){ + client.testStruct(structTestInput, function(result) { equal(result.string_thing, structTestInput.string_thing); equal(result.byte_thing, structTestInput.byte_thing); equal(result.i32_thing, structTestInput.i32_thing); equal(result.i64_thing, structTestInput.i64_thing); equal(JSON.stringify(result), JSON.stringify(structTestInput)); - QUnit.start(); + QUnit.start(); }); }); - asyncTest("Nest", function() { - expect( 7 ); + asyncTest('Nest', function() { + expect(7); 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); - - client.testNest(nestTestInput, function(result){ + nestTestInput.i32_thing = Math.pow(2, 15); + + client.testNest(nestTestInput, function(result) { equal(result.byte_thing, nestTestInput.byte_thing); equal(result.struct_thing.string_thing, nestTestInput.struct_thing.string_thing); equal(result.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing); equal(result.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing); equal(result.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing); - equal(result.i32_thing, nestTestInput.i32_thing); + equal(result.i32_thing, nestTestInput.i32_thing); equal(JSON.stringify(result), JSON.stringify(nestTestInput)); - QUnit.start(); + QUnit.start(); }); }); - asyncTest("Map", function() { - expect( 3 ); - var mapTestInput = {7:77, 8:88, 9:99}; + asyncTest('Map', function() { + expect(3); + var mapTestInput = {7: 77, 8: 88, 9: 99}; - client.testMap(mapTestInput, function(result){ + client.testMap(mapTestInput, function(result) { for (var key in result) { equal(result[key], mapTestInput[key]); } - QUnit.start(); + QUnit.start(); }); }); - asyncTest("StringMap", function() { - expect( 6 ); + asyncTest('StringMap', function() { + expect(6); 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' }; - client.testStringMap(mapTestInput, function(result){ + client.testStringMap(mapTestInput, function(result) { for (var key in result) { equal(result[key], mapTestInput[key]); } @@ -221,51 +221,51 @@ module("Structured Types"); }); }); - asyncTest("Set", function() { - expect( 1 ); - var setTestInput = [1,2,3]; - client.testSet(setTestInput, function(result){ + asyncTest('Set', function() { + expect(1); + var setTestInput = [1, 2, 3]; + client.testSet(setTestInput, function(result) { ok(result, setTestInput); QUnit.start(); }); }); - asyncTest("List", function() { - expect( 1 ); - var listTestInput = [1,2,3]; - client.testList(listTestInput, function(result){ + asyncTest('List', function() { + expect(1); + var listTestInput = [1, 2, 3]; + client.testList(listTestInput, function(result) { ok(result, listTestInput); QUnit.start(); }); }); - asyncTest("Enum", function() { - expect( 1 ); - client.testEnum(ThriftTest.Numberz.ONE, function(result){ + asyncTest('Enum', function() { + expect(1); + client.testEnum(ThriftTest.Numberz.ONE, function(result) { equal(result, ThriftTest.Numberz.ONE); QUnit.start(); }); }); - asyncTest("TypeDef", function() { - expect( 1 ); - client.testTypedef(69, function(result){ + asyncTest('TypeDef', function() { + expect(1); + client.testTypedef(69, function(result) { equal(result, 69); QUnit.start(); }); }); -module("deeper!"); +module('deeper!'); - asyncTest("MapMap", function() { - expect( 16 ); + asyncTest('MapMap', function() { + expect(16); 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} }; - client.testMapMap(1, function(result){ + client.testMapMap(1, function(result) { for (var key in result) { for (var key2 in result[key]) { equal(result[key][key2], mapMapTestExpectedResult[key][key2]); @@ -277,67 +277,67 @@ module("deeper!"); }); -module("Exception"); +module('Exception'); - asyncTest("Xception", function() { + asyncTest('Xception', function() { expect(2); - client.testException("Xception", function(e){ + client.testException('Xception', function(e) { equal(e.errorCode, 1001); - equal(e.message, "Xception"); + equal(e.message, 'Xception'); QUnit.start(); }); }); - asyncTest("no Exception", 0, function() { - expect( 1 ); - client.testException("no Exception", function(e){ + asyncTest('no Exception', 0, function() { + expect(1); + client.testException('no Exception', function(e) { ok(!e); QUnit.start(); }); }); -module("Insanity"); +module('Insanity'); - asyncTest("testInsanity", function() { - expect( 24 ); + asyncTest('testInsanity', function() { + expect(24); var insanity = { - "1":{ - "2":{ - "userMap":{ "5":5, "8":8 }, - "xtructs":[{ - "string_thing":"Goodbye4", - "byte_thing":4, - "i32_thing":4, - "i64_thing":4 + '1': { + '2': { + '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 } ] }, - "3":{ - "userMap":{ "5":5, "8":8 }, - "xtructs":[{ - "string_thing":"Goodbye4", - "byte_thing":4, - "i32_thing":4, - "i64_thing":4 + '3': { + '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 } ] } }, - "2":{ "6":{ "userMap":null, "xtructs":null } } + '2': { '6': { 'userMap': null, 'xtructs': null } } }; - client.testInsanity(new ThriftTest.Insanity(), function(res){ + client.testInsanity(new ThriftTest.Insanity(), function(res) { ok(res, JSON.stringify(res)); ok(insanity, JSON.stringify(insanity)); checkRecursively(res, insanity); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/test-jq.js ---------------------------------------------------------------------- diff --git a/lib/js/test/test-jq.js b/lib/js/test/test-jq.js index 23ed60f..d8649a0 100644 --- a/lib/js/test/test-jq.js +++ b/lib/js/test/test-jq.js @@ -33,27 +33,27 @@ ////////////////////////////////// //jQuery asynchronous tests jQuery.ajaxSetup({ timeout: 0 }); -$(document).ajaxError( function() { QUnit.start(); } ); +$(document).ajaxError(function() { QUnit.start(); }); -module("jQ Async Manual"); +module('jQ Async Manual'); - test("testI32", function() { - expect( 2 ); + test('testI32', function() { + expect(2); QUnit.stop(); var transport = new Thrift.Transport(); - var protocol = new Thrift.Protocol(transport); - var client = new ThriftTest.ThriftTestClient(protocol); + var protocol = new Thrift.Protocol(transport); + var client = new ThriftTest.ThriftTestClient(protocol); var jqxhr = jQuery.ajax({ - url: "/service", - data: client.send_testI32(Math.pow(-2,31)), - type: "POST", + url: '/service', + data: client.send_testI32(Math.pow(-2, 31)), + type: 'POST', cache: false, - dataType: "text", - success: function(res){ - transport.setRecvBuffer( res ); - equal(client.recv_testI32(), Math.pow(-2,31)); + dataType: 'text', + success: function(res) { + transport.setRecvBuffer(res); + equal(client.recv_testI32(), Math.pow(-2, 31)); }, error: function() { ok(false); }, complete: function() { @@ -63,25 +63,25 @@ module("jQ Async Manual"); }); }); - test("testI64", function() { - expect( 2 ); + test('testI64', function() { + expect(2); QUnit.stop(); var transport = new Thrift.Transport(); - var protocol = new Thrift.Protocol(transport); - var client = new ThriftTest.ThriftTestClient(protocol); + var protocol = new Thrift.Protocol(transport); + var client = new ThriftTest.ThriftTestClient(protocol); jQuery.ajax({ - url: "/service", + url: '/service', //This is usually 2^61 but JS cannot represent anything over 2^52 accurately - data: client.send_testI64(Math.pow(-2,52)), - type: "POST", + data: client.send_testI64(Math.pow(-2, 52)), + type: 'POST', cache: false, - dataType: "text", - success: function(res){ - transport.setRecvBuffer( res ); + dataType: 'text', + success: function(res) { + transport.setRecvBuffer(res); //This is usually 2^61 but JS cannot represent anything over 2^52 accurately - equal(client.recv_testI64(), Math.pow(-2,52)); + equal(client.recv_testI64(), Math.pow(-2, 52)); }, error: function() { ok(false); }, complete: function() { @@ -92,46 +92,46 @@ module("jQ Async Manual"); }); -module("jQ Async"); - test("I32", function() { - expect( 3 ); +module('jQ Async'); + test('I32', function() { + expect(3); QUnit.stop(); - client.testI32(Math.pow(2,30), function(result) { - equal(result, Math.pow(2,30)); + client.testI32(Math.pow(2, 30), function(result) { + equal(result, Math.pow(2, 30)); QUnit.start(); }); QUnit.stop(); - var jqxhr = client.testI32(Math.pow(-2,31), function(result) { - equal(result, Math.pow(-2,31)); + var jqxhr = client.testI32(Math.pow(-2, 31), function(result) { + equal(result, Math.pow(-2, 31)); }); jqxhr.success(function(result) { - equal(result, Math.pow(-2,31)); + equal(result, Math.pow(-2, 31)); QUnit.start(); }); }); - test("I64", function() { - expect( 4 ); + test('I64', function() { + expect(4); QUnit.stop(); //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - client.testI64(Math.pow(2,52), function(result) { - equal(result, Math.pow(2,52)); + client.testI64(Math.pow(2, 52), function(result) { + equal(result, Math.pow(2, 52)); QUnit.start(); }); QUnit.stop(); //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - client.testI64(Math.pow(-2,52), function(result) { - equal(result, Math.pow(-2,52)); + client.testI64(Math.pow(-2, 52), function(result) { + equal(result, Math.pow(-2, 52)); }) - .error( function(xhr, status, e) { ok(false, e.message); } ) + .error(function(xhr, status, e) { ok(false, e.message); }) .success(function(result) { //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - equal(result, Math.pow(-2,52)); + equal(result, Math.pow(-2, 52)); }) .complete(function() { ok(true); @@ -139,18 +139,18 @@ module("jQ Async"); }); }); - test("Xception", function() { - expect( 2 ); + test('Xception', function() { + expect(2); QUnit.stop(); - var dfd = client.testException("Xception", function(result) { + var dfd = client.testException('Xception', function(result) { ok(false); QUnit.start(); }) - .error(function(xhr, status, e){ + .error(function(xhr, status, e) { equal(e.errorCode, 1001); - equal(e.message, "Xception"); + equal(e.message, 'Xception'); //QUnit.start(); //Note start is not required here because: //$(document).ajaxError( function() { QUnit.start(); } ); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/test-nojq.js ---------------------------------------------------------------------- diff --git a/lib/js/test/test-nojq.js b/lib/js/test/test-nojq.js index 19f9e61..c4f3cf7 100644 --- a/lib/js/test/test-nojq.js +++ b/lib/js/test/test-nojq.js @@ -17,7 +17,7 @@ * under the License. */ /* jshint -W100 */ - + /* * JavaScript test suite for ThriftTest.thrift. These tests * will run only with normal "-gen js" Apache Thrift interfaces. @@ -25,7 +25,7 @@ * $ thrift -gen js ThriftTest.thrift * * See also: - * ++ test.js for generic tests + * ++ test.js for generic tests * ++ test-jq.js for "-gen js:jquery" only tests */ @@ -33,16 +33,16 @@ ////////////////////////////////// //Async exception tests -module("NojQ Async"); +module('NojQ Async'); - test("Xception", function() { - expect( 2 ); + test('Xception', function() { + expect(2); QUnit.stop(); - client.testException("Xception", function(result) { + client.testException('Xception', function(result) { equal(result.errorCode, 1001); - equal(result.message, "Xception"); + equal(result.message, 'Xception'); QUnit.start(); }); }); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/test.js ---------------------------------------------------------------------- diff --git a/lib/js/test/test.js b/lib/js/test/test.js index 2d8ec9b..e3b8d51 100755 --- a/lib/js/test/test.js +++ b/lib/js/test/test.js @@ -23,7 +23,7 @@ * will run against Normal (-gen js) and jQuery (-gen js:jquery) * Apache Thrift interfaces. * - * Synchronous blocking calls should be identical in both + * Synchronous blocking calls should be identical in both * Normal and jQuery interfaces. All synchronous tests belong * here. * @@ -47,9 +47,9 @@ * ++ test-jq.js for "-gen js:jquery" only tests */ -var transport = new Thrift.Transport("/service"); -var protocol = new Thrift.Protocol(transport); -var client = new ThriftTest.ThriftTestClient(protocol); +var transport = new Thrift.Transport('/service'); +var protocol = new Thrift.Protocol(transport); +var client = new ThriftTest.ThriftTestClient(protocol); // Work around for old API used by QUnitAdapter of jsTestDriver if (typeof QUnit.log == 'function') { @@ -81,19 +81,19 @@ function checkRecursively(map1, map2) { } } -module("Base Types"); +module('Base Types'); - 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); @@ -104,7 +104,7 @@ module("Base Types"); } equal(client.testBinary(arr), binary); }); - test("String", function() { + test('String', function() { equal(client.testString(''), ''); equal(client.testString(stringTest), stringTest); @@ -113,40 +113,40 @@ module("Base Types"); ' 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("Byte", function() { + test('Byte', 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)); }); -module("Structured Types"); +module('Structured Types'); - 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); @@ -158,18 +158,18 @@ module("Structured Types"); 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); @@ -183,8 +183,8 @@ module("Structured Types"); 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); @@ -193,10 +193,10 @@ module("Structured Types"); } }); - 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); @@ -206,30 +206,30 @@ module("Structured Types"); } }); - 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(); @@ -250,9 +250,9 @@ module("Structured Types"); }; 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); @@ -264,12 +264,12 @@ module("Structured Types"); }); -module("deeper!"); +module('deeper!'); - 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); @@ -285,64 +285,64 @@ module("deeper!"); }); -module("Exception"); +module('Exception'); - test("Xception", function() { + test('Xception', function() { expect(2); - try{ - client.testException("Xception"); - }catch(e){ + try { + client.testException('Xception'); + }catch (e) { equal(e.errorCode, 1001); - equal(e.message, "Xception"); + equal(e.message, 'Xception'); } }); - test("no Exception", 0, function() { - try{ - client.testException("no Exception"); - }catch(e){ + test('no Exception', 0, function() { + try { + client.testException('no Exception'); + }catch (e) { ok(false); } }); - test("TException", function() { + test('TException', function() { //ThriftTest does not list TException as a legal exception so it will // generate an exception on the server that does not propagate back to // the client. This test has been modified to equate to "no exception" expect(1); - try{ - client.testException("TException"); - } catch(e) { + try { + client.testException('TException'); + } catch (e) { //ok(false); } ok(true); }); -module("Insanity"); +module('Insanity'); 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("testInsanity", function() { + test('testInsanity', 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)); @@ -355,10 +355,10 @@ module("Insanity"); ////////////////////////////////// //Run same tests asynchronously -module("Async"); +module('Async'); - test("Double", function() { - expect( 1 ); + test('Double', function() { + expect(1); QUnit.stop(); client.testDouble(3.14159265, function(result) { @@ -367,8 +367,8 @@ module("Async"); }); }); - test("Byte", function() { - expect( 1 ); + test('Byte', function() { + expect(1); QUnit.stop(); client.testByte(0x01, function(result) { @@ -377,36 +377,36 @@ module("Async"); }); }); - test("I32", function() { - expect( 2 ); + test('I32', function() { + expect(2); QUnit.stop(); - client.testI32(Math.pow(2,30), function(result) { - equal(result, Math.pow(2,30)); + client.testI32(Math.pow(2, 30), function(result) { + equal(result, Math.pow(2, 30)); QUnit.start(); }); QUnit.stop(); - client.testI32(Math.pow(-2,31), function(result) { - equal(result, Math.pow(-2,31)); + client.testI32(Math.pow(-2, 31), function(result) { + equal(result, Math.pow(-2, 31)); QUnit.start(); }); }); - test("I64", function() { - expect( 2 ); + test('I64', function() { + expect(2); QUnit.stop(); //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - client.testI64(Math.pow(2,52), function(result) { - equal(result, Math.pow(2,52)); + client.testI64(Math.pow(2, 52), function(result) { + equal(result, Math.pow(2, 52)); QUnit.start(); }); QUnit.stop(); //This is usually 2^60 but JS cannot represent anything over 2^52 accurately - client.testI64(Math.pow(-2,52), function(result) { - equal(result, Math.pow(-2,52)); + client.testI64(Math.pow(-2, 52), function(result) { + equal(result, Math.pow(-2, 52)); QUnit.start(); }); }); http://git-wip-us.apache.org/repos/asf/thrift/blob/b909a389/lib/js/test/test_handler.js ---------------------------------------------------------------------- diff --git a/lib/js/test/test_handler.js b/lib/js/test/test_handler.js index e1fa74f..496b5e0 100644 --- a/lib/js/test/test_handler.js +++ b/lib/js/test/test_handler.js @@ -17,7 +17,7 @@ * under the License. */ -//This is the server side Node test handler for the standard +//This is the server side Node test handler for the standard // Apache Thrift test service. var ttypes = require('./gen-nodejs/ThriftTest_types'); @@ -162,7 +162,7 @@ var ThriftTestHandler = exports.ThriftTestHandler = { result(null, hello); }, testException: function(arg, result) { - console.log('testException('+arg+')'); + console.log('testException(' + arg + ')'); if (arg === 'Xception') { var x = new ttypes.Xception(); x.errorCode = 1001;
