line endings fix

git merge on linux can fail due to wrong line endings...
diff --git a/lib/js/test/test_handler.js b/lib/js/test/test_handler.js
index 50ac7ac..e1fa74f 100644
--- a/lib/js/test/test_handler.js
+++ b/lib/js/test/test_handler.js
@@ -1,199 +1,199 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one

- * or more contributor license agreements. See the NOTICE file

- * distributed with this work for additional information

- * regarding copyright ownership. The ASF licenses this file

- * to you under the Apache License, Version 2.0 (the

- * 'License'); you may not use this file except in compliance

- * with the License. You may obtain a copy of the License at

- *

- *   http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing,

- * software distributed under the License is distributed on an

- * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- * KIND, either express or implied. See the License for the

- * specific language governing permissions and limitations

- * under the License.

- */

-

-//This is the server side Node test handler for the standard 

-//  Apache Thrift test service.

-

-var ttypes = require('./gen-nodejs/ThriftTest_types');

-var TException = require('../../nodejs/lib/thrift').TException;

-

-var ThriftTestHandler = exports.ThriftTestHandler = {

-  testVoid: function(result) {

-    console.log('testVoid()');

-    result(null);

-  },

-  testString: function(thing, result) {

-    console.log('testString(\'' + thing + '\')');

-    result(null, thing);

-  },

-  testByte: function(thing, result) {

-    console.log('testByte(' + thing + ')');

-    result(null, thing);

-  },

-  testI32: function(thing, result) {

-    console.log('testI32(' + thing + ')');

-    result(null, thing);

-  },

-  testI64: function(thing, result) {

-    console.log('testI64(' + thing + ')');

-    result(null, thing);

-  },

-  testDouble: function(thing, result) {

-    console.log('testDouble(' + thing + ')');

-    result(null, thing);

-  },

-  testBinary: function(thing, result) {

-    console.log('testBinary(\'' + thing + '\')');

-    result(null, thing);

-  },

-  testStruct: function(thing, result) {

-    console.log('testStruct(');

-    console.log(thing);

-    console.log(')');

-    result(null, thing);

-  },

-  testNest: function(nest, result) {

-    console.log('testNest(');

-    console.log(nest);

-    console.log(')');

-    result(null, nest);

-  },

-  testMap: function(thing, result) {

-    console.log('testMap(');

-    console.log(thing);

-    console.log(')');

-    result(null, thing);

-  },

-  testStringMap: function(thing, result) {

-    console.log('testStringMap(');

-    console.log(thing);

-    console.log(')');

-    result(null, thing);

-  },

-  testSet: function(thing, result) {

-    console.log('testSet(');

-    console.log(thing);

-    console.log(')');

-    result(null, thing);

-  },

-  testList: function(thing, result) {

-    console.log('testList(');

-    console.log(thing);

-    console.log(')');

-    result(null, thing);

-  },

-  testEnum: function(thing, result) {

-    console.log('testEnum(' + thing + ')');

-    result(null, thing);

-  },

-  testTypedef: function(thing, result) {

-    console.log('testTypedef(' + thing + ')');

-    result(null, thing);

-  },

-  testMapMap: function(hello, result) {

-    console.log('testMapMap(' + hello + ')');

-

-    var mapmap = [];

-    var pos = [];

-    var neg = [];

-    for (var i = 1; i < 5; i++) {

-      pos[i] = i;

-      neg[-i] = -i;

-    }

-    mapmap[4] = pos;

-    mapmap[-4] = neg;

-

-    result(null, mapmap);

-  },

-  testInsanity: function(argument, result) {

-    console.log('testInsanity(');

-    console.log(argument);

-    console.log(')');

-

-    var hello = new ttypes.Xtruct();

-    hello.string_thing = 'Hello2';

-    hello.byte_thing = 2;

-    hello.i32_thing = 2;

-    hello.i64_thing = 2;

-

-    var goodbye = new ttypes.Xtruct();

-    goodbye.string_thing = 'Goodbye4';

-    goodbye.byte_thing = 4;

-    goodbye.i32_thing = 4;

-    goodbye.i64_thing = 4;

-

-    var crazy = new ttypes.Insanity();

-    crazy.userMap = [];

-    crazy.userMap[ttypes.Numberz.EIGHT] = 8;

-    crazy.userMap[ttypes.Numberz.FIVE] = 5;

-    crazy.xtructs = [goodbye, hello];

-

-    var first_map = [];

-    var second_map = [];

-

-    first_map[ttypes.Numberz.TWO] = crazy;

-    first_map[ttypes.Numberz.THREE] = crazy;

-

-    var looney = new ttypes.Insanity();

-    second_map[ttypes.Numberz.SIX] = looney;

-

-    var insane = [];

-    insane[1] = first_map;

-    insane[2] = second_map;

-

-    console.log('insane result:');

-    console.log(insane);

-    result(null, insane);

-  },

-  testMulti: function(arg0, arg1, arg2, arg3, arg4, arg5, result) {

-    console.log('testMulti()');

-

-    var hello = new ttypes.Xtruct();

-    hello.string_thing = 'Hello2';

-    hello.byte_thing = arg0;

-    hello.i32_thing = arg1;

-    hello.i64_thing = arg2;

-    result(null, hello);

-  },

-  testException: function(arg, result) {

-    console.log('testException('+arg+')');

-    if (arg === 'Xception') {

-      var x = new ttypes.Xception();

-      x.errorCode = 1001;

-      x.message = arg;

-      result(x);

-    } else if (arg === 'TException') {

-      result(new TException(arg));

-    } else {

-      result(null);

-    }

-  },

-  testMultiException: function(arg0, arg1, result) {

-    console.log('testMultiException(' + arg0 + ', ' + arg1 + ')');

-    if (arg0 === ('Xception')) {

-      var x = new ttypes.Xception();

-      x.errorCode = 1001;

-      x.message = 'This is an Xception';

-      result(x);

-    } else if (arg0 === ('Xception2')) {

-      var x2 = new ttypes.Xception2();

-      x2.errorCode = 2002;

-      x2.struct_thing = new ttypes.Xtruct();

-      x2.struct_thing.string_thing = 'This is an Xception2';

-      result(x2);

-    }

-

-    var res = new ttypes.Xtruct();

-    res.string_thing = arg1;

-    result(null, res);

-  },

-  testOneway: function(sleepFor, result) {

-    console.log('testOneway(' + sleepFor + ') => JavaScript (like Rust) never sleeps!');

-  }

-};   //ThriftTestSvcHandler

+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 'License'); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//This is the server side Node test handler for the standard 
+//  Apache Thrift test service.
+
+var ttypes = require('./gen-nodejs/ThriftTest_types');
+var TException = require('../../nodejs/lib/thrift').TException;
+
+var ThriftTestHandler = exports.ThriftTestHandler = {
+  testVoid: function(result) {
+    console.log('testVoid()');
+    result(null);
+  },
+  testString: function(thing, result) {
+    console.log('testString(\'' + thing + '\')');
+    result(null, thing);
+  },
+  testByte: function(thing, result) {
+    console.log('testByte(' + thing + ')');
+    result(null, thing);
+  },
+  testI32: function(thing, result) {
+    console.log('testI32(' + thing + ')');
+    result(null, thing);
+  },
+  testI64: function(thing, result) {
+    console.log('testI64(' + thing + ')');
+    result(null, thing);
+  },
+  testDouble: function(thing, result) {
+    console.log('testDouble(' + thing + ')');
+    result(null, thing);
+  },
+  testBinary: function(thing, result) {
+    console.log('testBinary(\'' + thing + '\')');
+    result(null, thing);
+  },
+  testStruct: function(thing, result) {
+    console.log('testStruct(');
+    console.log(thing);
+    console.log(')');
+    result(null, thing);
+  },
+  testNest: function(nest, result) {
+    console.log('testNest(');
+    console.log(nest);
+    console.log(')');
+    result(null, nest);
+  },
+  testMap: function(thing, result) {
+    console.log('testMap(');
+    console.log(thing);
+    console.log(')');
+    result(null, thing);
+  },
+  testStringMap: function(thing, result) {
+    console.log('testStringMap(');
+    console.log(thing);
+    console.log(')');
+    result(null, thing);
+  },
+  testSet: function(thing, result) {
+    console.log('testSet(');
+    console.log(thing);
+    console.log(')');
+    result(null, thing);
+  },
+  testList: function(thing, result) {
+    console.log('testList(');
+    console.log(thing);
+    console.log(')');
+    result(null, thing);
+  },
+  testEnum: function(thing, result) {
+    console.log('testEnum(' + thing + ')');
+    result(null, thing);
+  },
+  testTypedef: function(thing, result) {
+    console.log('testTypedef(' + thing + ')');
+    result(null, thing);
+  },
+  testMapMap: function(hello, result) {
+    console.log('testMapMap(' + hello + ')');
+
+    var mapmap = [];
+    var pos = [];
+    var neg = [];
+    for (var i = 1; i < 5; i++) {
+      pos[i] = i;
+      neg[-i] = -i;
+    }
+    mapmap[4] = pos;
+    mapmap[-4] = neg;
+
+    result(null, mapmap);
+  },
+  testInsanity: function(argument, result) {
+    console.log('testInsanity(');
+    console.log(argument);
+    console.log(')');
+
+    var hello = new ttypes.Xtruct();
+    hello.string_thing = 'Hello2';
+    hello.byte_thing = 2;
+    hello.i32_thing = 2;
+    hello.i64_thing = 2;
+
+    var goodbye = new ttypes.Xtruct();
+    goodbye.string_thing = 'Goodbye4';
+    goodbye.byte_thing = 4;
+    goodbye.i32_thing = 4;
+    goodbye.i64_thing = 4;
+
+    var crazy = new ttypes.Insanity();
+    crazy.userMap = [];
+    crazy.userMap[ttypes.Numberz.EIGHT] = 8;
+    crazy.userMap[ttypes.Numberz.FIVE] = 5;
+    crazy.xtructs = [goodbye, hello];
+
+    var first_map = [];
+    var second_map = [];
+
+    first_map[ttypes.Numberz.TWO] = crazy;
+    first_map[ttypes.Numberz.THREE] = crazy;
+
+    var looney = new ttypes.Insanity();
+    second_map[ttypes.Numberz.SIX] = looney;
+
+    var insane = [];
+    insane[1] = first_map;
+    insane[2] = second_map;
+
+    console.log('insane result:');
+    console.log(insane);
+    result(null, insane);
+  },
+  testMulti: function(arg0, arg1, arg2, arg3, arg4, arg5, result) {
+    console.log('testMulti()');
+
+    var hello = new ttypes.Xtruct();
+    hello.string_thing = 'Hello2';
+    hello.byte_thing = arg0;
+    hello.i32_thing = arg1;
+    hello.i64_thing = arg2;
+    result(null, hello);
+  },
+  testException: function(arg, result) {
+    console.log('testException('+arg+')');
+    if (arg === 'Xception') {
+      var x = new ttypes.Xception();
+      x.errorCode = 1001;
+      x.message = arg;
+      result(x);
+    } else if (arg === 'TException') {
+      result(new TException(arg));
+    } else {
+      result(null);
+    }
+  },
+  testMultiException: function(arg0, arg1, result) {
+    console.log('testMultiException(' + arg0 + ', ' + arg1 + ')');
+    if (arg0 === ('Xception')) {
+      var x = new ttypes.Xception();
+      x.errorCode = 1001;
+      x.message = 'This is an Xception';
+      result(x);
+    } else if (arg0 === ('Xception2')) {
+      var x2 = new ttypes.Xception2();
+      x2.errorCode = 2002;
+      x2.struct_thing = new ttypes.Xtruct();
+      x2.struct_thing.string_thing = 'This is an Xception2';
+      result(x2);
+    }
+
+    var res = new ttypes.Xtruct();
+    res.string_thing = arg1;
+    result(null, res);
+  },
+  testOneway: function(sleepFor, result) {
+    console.log('testOneway(' + sleepFor + ') => JavaScript (like Rust) never sleeps!');
+  }
+};   //ThriftTestSvcHandler
diff --git a/lib/nodejs/test/thrift_test_driver.js b/lib/nodejs/test/thrift_test_driver.js
index b8c900b..b7312fa 100644
--- a/lib/nodejs/test/thrift_test_driver.js
+++ b/lib/nodejs/test/thrift_test_driver.js
@@ -1,326 +1,326 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one

- * or more contributor license agreements. See the NOTICE file

- * distributed with this work for additional information

- * regarding copyright ownership. The ASF licenses this file

- * to you under the Apache License, Version 2.0 (the

- * 'License'); you may not use this file except in compliance

- * with the License. You may obtain a copy of the License at

- *

- *   http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing,

- * software distributed under the License is distributed on an

- * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- * KIND, either express or implied. See the License for the

- * specific language governing permissions and limitations

- * under the License.

- */

-

- // This is the Node.js test driver for the standard Apache Thrift 

- // test service. The driver invokes every function defined in the 

- // Thrift Test service with a representative range of parameters.

- //

- // The ThriftTestDriver function requires a client object

- // connected to a server hosting the Thrift Test service and

- // supports an optional callback function which is called with 

- // a status message when the test is complete.

-

-var assert = require('assert');

-var ttypes = require('./gen-nodejs/ThriftTest_types');

-var Int64 = require('node-int64');

-

-var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {

-	

-function checkRecursively(map1, map2) {

-  if (typeof map1 !== 'function' && typeof map2 !== 'function') {

-    if (!map1 || typeof map1 !== 'object') {

-      //Handle int64 types (which use node-int64 in Node.js JavaScript)

-      if ((typeof map1 === "number") && (typeof map2 === "object") && 

-          (map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) {

-        var n = new Int64(map2.buffer);

-        assert.equal(map1, n.toNumber());          

-      } else {

-        assert.equal(map1, map2);

-      }

-    } else {

-      for (var key in map1) {

-        checkRecursively(map1[key], map2[key]);

-      }

-    }

-  }

-}

-

-client.testVoid(function(err, response) {

-  assert( ! err);

-  assert.equal(undefined, response); //void

-});

-

-client.testString("Test", function(err, response) {

-  assert( ! err);

-  assert.equal("Test", response);

-});

-

-client.testString("", function(err, response) {

-  assert( ! err);

-  assert.equal("", response);

-});

-

-//all Languages in UTF-8

-/*jshint -W100 */

-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, Polski, پنجابی, پښتو, " +

-    "Norfuk / Pitkern, 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ú, 粵語";

-/*jshint +W100 */

-

-client.testString(stringTest, function(err, response) {

-  assert( ! err);

-  assert.equal(stringTest, response);

-});

-

-var specialCharacters = 'quote: \" backslash:' +

-    ' forwardslash-escaped: \/ ' +

-    ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +

-    ' now-all-of-them-together: "\\\/\b\n\r\t' +

-    ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><' +

-    ' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';

-client.testString(specialCharacters, function(err, response) {

-  assert( ! err);

-  assert.equal(specialCharacters, response);

-});

-

-client.testByte(1, function(err, response) {

-  assert( ! err);

-  assert.equal(1, response);

-});

-

-client.testByte(0, function(err, response) {

-  assert( ! err);

-  assert.equal(0, response);

-});

-

-client.testByte(-1, function(err, response) {

-  assert( ! err);

-  assert.equal(-1, response);

-});

-

-client.testByte(-127, function(err, response) {

-  assert( ! err);

-  assert.equal(-127, response);

-});

-

-client.testI32(-1, function(err, response) {

-  assert( ! err);

-  assert.equal(-1, response);

-});

-

-client.testI64(5, function(err, response) {

-  assert( ! err);

-  assert.equal(5, response);

-});

-

-client.testI64(-5, function(err, response) {

-  assert( ! err);

-  assert.equal(-5, response);

-});

-

-client.testI64(734359738368, function(err, response) {

-  assert( ! err);

-  assert.equal(734359738368, response);

-});

-

-client.testI64(-34359738368, function(err, response) {

-  assert( ! err);

-  assert.equal(-34359738368, response);

-});

-

-client.testI64(-734359738368, function(err, response) {

-  assert( ! err);

-  assert.equal(-734359738368, response);

-});

-

-client.testDouble(-5.2098523, function(err, response) {

-  assert( ! err);

-  assert.equal(-5.2098523, response);

-});

-

-client.testDouble(7.012052175215044, function(err, response) {

-  assert( ! err);

-  assert.equal(7.012052175215044, response);

-});

-

-// TODO: add testBinary() 

-

-var out = new ttypes.Xtruct({

-  string_thing: 'Zero',

-  byte_thing: 1,

-  i32_thing: -3,

-  i64_thing: 1000000

-});

-client.testStruct(out, function(err, response) {

-  assert( ! err);

-  checkRecursively(out, response);

-});

-

-var out2 = new ttypes.Xtruct2();

-out2.byte_thing = 1;

-out2.struct_thing = out;

-out2.i32_thing = 5;

-client.testNest(out2, function(err, response) {

-  assert( ! err);

-  checkRecursively(out2, response);

-});

-

-var mapout = {};

-for (var i = 0; i < 5; ++i) {

-  mapout[i] = i-10;

-}

-client.testMap(mapout, function(err, response) {

-  assert( ! err);

-  assert.deepEqual(mapout, response);

-});

-

-var mapTestInput = {

-  "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",

-  "longValue":stringTest, "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, ":"long key"

-};

-client.testStringMap(mapTestInput, function(err, response) {

-  assert( ! err);

-  assert.deepEqual(mapTestInput, response);

-});

-

-var setTestSetInput = [1,2,3];

-client.testSet(setTestSetInput, function(err, response) {

-  assert( ! err);

-  assert.deepEqual(setTestSetInput, response);

-});

-var setTestListInput = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];

-client.testList(setTestListInput, function(err, response) {

-  assert( ! err);

-  assert.deepEqual(setTestListInput, response);

-});

-

-client.testEnum(ttypes.Numberz.ONE, function(err, response) {

-  assert( ! err);

-  assert.equal(ttypes.Numberz.ONE, response);

-});

-

-client.testTypedef(69, function(err, response) {

-  assert( ! err);

-  assert.equal(69, response);

-});

-

-var mapMapTest = {

-  "4": {"1":1, "2":2, "3":3, "4":4},

-  "-4": {"-4":-4, "-3":-3, "-2":-2, "-1":-1}

-};

-client.testMapMap(1, function(err, response) {

-  assert( ! err);

-  assert.deepEqual(mapMapTest, response);

-});

-

-var crazy = new ttypes.Insanity({

-  "userMap":{ "5":5, "8":8 },

-  "xtructs":[new ttypes.Xtruct({

-      "string_thing":"Goodbye4",

-      "byte_thing":4,

-      "i32_thing":4,

-      "i64_thing":4

-    }), new ttypes.Xtruct({

-      "string_thing":"Hello2",

-      "byte_thing":2,

-      "i32_thing":2,

-      "i64_thing":2

-    })]

-});

-var insanity = {

-  "1":{ "2": crazy, "3": crazy },

-  "2":{ "6":{ "userMap":{}, "xtructs":[] } }

-};

-client.testInsanity(crazy, function(err, response) {

-  assert( ! err);

-  checkRecursively(insanity, response);

-});

-

-client.testException('TException', function(err, response) {

-  assert( ! response);

-});

-

-client.testException('Xception', function(err, response) {

-  assert( ! response);

-  assert.equal(err.errorCode, 1001);

-  assert.equal('Xception', err.message);

-});

-

-client.testException('no Exception', function(err, response) {

-  assert( ! err);

-  assert.equal(undefined, response); //void

-});

-

-client.testOneway(0, function(err, response) {

-  assert(false); //should not answer

-});

-

-(function() {

-  var test_complete = false;

-  var retrys = 0;

-  var retry_limit = 30;

-  var retry_interval = 100;

-  /**

-   * redo a simple test after the oneway to make sure we aren't "off by one" --

-   * if the server treated oneway void like normal void, this next test will

-   * fail since it will get the void confirmation rather than the correct

-   * result. In this circumstance, the client will throw the exception:

-   *

-   * Because this is the last test against the server, when it completes

-   * the entire suite is complete by definition (the tests run serially).

-   */

-  client.testI32(-1, function(err, response) {

-    assert( ! err);

-    assert.equal(-1, response);

-    test_complete = true;

-  });

-

-  //We wait up to retry_limit * retry_interval for the test suite to complete

-  function TestForCompletion() {

-    if(test_complete) {

-      if (callback) {

-        callback("Server successfully tested!");

-      }

-    } else {

-      if (++retrys < retry_limit) {

-        setTimeout(TestForCompletion, retry_interval);

-      } else {

-        if (callback) {

-          callback("Server test failed to complete after " +

-                   (retry_limit*retry_interval/1000) + " seconds");

-        }

-      }

-    }

-  }

-

-  setTimeout(TestForCompletion, retry_interval);

-})();

-};

+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 'License'); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ // This is the Node.js test driver for the standard Apache Thrift 
+ // test service. The driver invokes every function defined in the 
+ // Thrift Test service with a representative range of parameters.
+ //
+ // The ThriftTestDriver function requires a client object
+ // connected to a server hosting the Thrift Test service and
+ // supports an optional callback function which is called with 
+ // a status message when the test is complete.
+
+var assert = require('assert');
+var ttypes = require('./gen-nodejs/ThriftTest_types');
+var Int64 = require('node-int64');
+
+var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {
+	
+function checkRecursively(map1, map2) {
+  if (typeof map1 !== 'function' && typeof map2 !== 'function') {
+    if (!map1 || typeof map1 !== 'object') {
+      //Handle int64 types (which use node-int64 in Node.js JavaScript)
+      if ((typeof map1 === "number") && (typeof map2 === "object") && 
+          (map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) {
+        var n = new Int64(map2.buffer);
+        assert.equal(map1, n.toNumber());          
+      } else {
+        assert.equal(map1, map2);
+      }
+    } else {
+      for (var key in map1) {
+        checkRecursively(map1[key], map2[key]);
+      }
+    }
+  }
+}
+
+client.testVoid(function(err, response) {
+  assert( ! err);
+  assert.equal(undefined, response); //void
+});
+
+client.testString("Test", function(err, response) {
+  assert( ! err);
+  assert.equal("Test", response);
+});
+
+client.testString("", function(err, response) {
+  assert( ! err);
+  assert.equal("", response);
+});
+
+//all Languages in UTF-8
+/*jshint -W100 */
+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, Polski, پنجابی, پښتو, " +
+    "Norfuk / Pitkern, 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ú, 粵語";
+/*jshint +W100 */
+
+client.testString(stringTest, function(err, response) {
+  assert( ! err);
+  assert.equal(stringTest, response);
+});
+
+var specialCharacters = 'quote: \" backslash:' +
+    ' forwardslash-escaped: \/ ' +
+    ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
+    ' now-all-of-them-together: "\\\/\b\n\r\t' +
+    ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><' +
+    ' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';
+client.testString(specialCharacters, function(err, response) {
+  assert( ! err);
+  assert.equal(specialCharacters, response);
+});
+
+client.testByte(1, function(err, response) {
+  assert( ! err);
+  assert.equal(1, response);
+});
+
+client.testByte(0, function(err, response) {
+  assert( ! err);
+  assert.equal(0, response);
+});
+
+client.testByte(-1, function(err, response) {
+  assert( ! err);
+  assert.equal(-1, response);
+});
+
+client.testByte(-127, function(err, response) {
+  assert( ! err);
+  assert.equal(-127, response);
+});
+
+client.testI32(-1, function(err, response) {
+  assert( ! err);
+  assert.equal(-1, response);
+});
+
+client.testI64(5, function(err, response) {
+  assert( ! err);
+  assert.equal(5, response);
+});
+
+client.testI64(-5, function(err, response) {
+  assert( ! err);
+  assert.equal(-5, response);
+});
+
+client.testI64(734359738368, function(err, response) {
+  assert( ! err);
+  assert.equal(734359738368, response);
+});
+
+client.testI64(-34359738368, function(err, response) {
+  assert( ! err);
+  assert.equal(-34359738368, response);
+});
+
+client.testI64(-734359738368, function(err, response) {
+  assert( ! err);
+  assert.equal(-734359738368, response);
+});
+
+client.testDouble(-5.2098523, function(err, response) {
+  assert( ! err);
+  assert.equal(-5.2098523, response);
+});
+
+client.testDouble(7.012052175215044, function(err, response) {
+  assert( ! err);
+  assert.equal(7.012052175215044, response);
+});
+
+// TODO: add testBinary() 
+
+var out = new ttypes.Xtruct({
+  string_thing: 'Zero',
+  byte_thing: 1,
+  i32_thing: -3,
+  i64_thing: 1000000
+});
+client.testStruct(out, function(err, response) {
+  assert( ! err);
+  checkRecursively(out, response);
+});
+
+var out2 = new ttypes.Xtruct2();
+out2.byte_thing = 1;
+out2.struct_thing = out;
+out2.i32_thing = 5;
+client.testNest(out2, function(err, response) {
+  assert( ! err);
+  checkRecursively(out2, response);
+});
+
+var mapout = {};
+for (var i = 0; i < 5; ++i) {
+  mapout[i] = i-10;
+}
+client.testMap(mapout, function(err, response) {
+  assert( ! err);
+  assert.deepEqual(mapout, response);
+});
+
+var mapTestInput = {
+  "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
+  "longValue":stringTest, "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, ":"long key"
+};
+client.testStringMap(mapTestInput, function(err, response) {
+  assert( ! err);
+  assert.deepEqual(mapTestInput, response);
+});
+
+var setTestSetInput = [1,2,3];
+client.testSet(setTestSetInput, function(err, response) {
+  assert( ! err);
+  assert.deepEqual(setTestSetInput, response);
+});
+var setTestListInput = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
+client.testList(setTestListInput, function(err, response) {
+  assert( ! err);
+  assert.deepEqual(setTestListInput, response);
+});
+
+client.testEnum(ttypes.Numberz.ONE, function(err, response) {
+  assert( ! err);
+  assert.equal(ttypes.Numberz.ONE, response);
+});
+
+client.testTypedef(69, function(err, response) {
+  assert( ! err);
+  assert.equal(69, response);
+});
+
+var mapMapTest = {
+  "4": {"1":1, "2":2, "3":3, "4":4},
+  "-4": {"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+};
+client.testMapMap(1, function(err, response) {
+  assert( ! err);
+  assert.deepEqual(mapMapTest, response);
+});
+
+var crazy = new ttypes.Insanity({
+  "userMap":{ "5":5, "8":8 },
+  "xtructs":[new ttypes.Xtruct({
+      "string_thing":"Goodbye4",
+      "byte_thing":4,
+      "i32_thing":4,
+      "i64_thing":4
+    }), new ttypes.Xtruct({
+      "string_thing":"Hello2",
+      "byte_thing":2,
+      "i32_thing":2,
+      "i64_thing":2
+    })]
+});
+var insanity = {
+  "1":{ "2": crazy, "3": crazy },
+  "2":{ "6":{ "userMap":{}, "xtructs":[] } }
+};
+client.testInsanity(crazy, function(err, response) {
+  assert( ! err);
+  checkRecursively(insanity, response);
+});
+
+client.testException('TException', function(err, response) {
+  assert( ! response);
+});
+
+client.testException('Xception', function(err, response) {
+  assert( ! response);
+  assert.equal(err.errorCode, 1001);
+  assert.equal('Xception', err.message);
+});
+
+client.testException('no Exception', function(err, response) {
+  assert( ! err);
+  assert.equal(undefined, response); //void
+});
+
+client.testOneway(0, function(err, response) {
+  assert(false); //should not answer
+});
+
+(function() {
+  var test_complete = false;
+  var retrys = 0;
+  var retry_limit = 30;
+  var retry_interval = 100;
+  /**
+   * redo a simple test after the oneway to make sure we aren't "off by one" --
+   * if the server treated oneway void like normal void, this next test will
+   * fail since it will get the void confirmation rather than the correct
+   * result. In this circumstance, the client will throw the exception:
+   *
+   * Because this is the last test against the server, when it completes
+   * the entire suite is complete by definition (the tests run serially).
+   */
+  client.testI32(-1, function(err, response) {
+    assert( ! err);
+    assert.equal(-1, response);
+    test_complete = true;
+  });
+
+  //We wait up to retry_limit * retry_interval for the test suite to complete
+  function TestForCompletion() {
+    if(test_complete) {
+      if (callback) {
+        callback("Server successfully tested!");
+      }
+    } else {
+      if (++retrys < retry_limit) {
+        setTimeout(TestForCompletion, retry_interval);
+      } else {
+        if (callback) {
+          callback("Server test failed to complete after " +
+                   (retry_limit*retry_interval/1000) + " seconds");
+        }
+      }
+    }
+  }
+
+  setTimeout(TestForCompletion, retry_interval);
+})();
+};
diff --git a/lib/nodejs/test/thrift_test_driver_promise.js b/lib/nodejs/test/thrift_test_driver_promise.js
index f27ba4c..74a91bd 100644
--- a/lib/nodejs/test/thrift_test_driver_promise.js
+++ b/lib/nodejs/test/thrift_test_driver_promise.js
@@ -1,398 +1,398 @@
-/*

- * Licensed to the Apache Software Foundation (ASF) under one

- * or more contributor license agreements. See the NOTICE file

- * distributed with this work for additional information

- * regarding copyright ownership. The ASF licenses this file

- * to you under the Apache License, Version 2.0 (the

- * 'License'); you may not use this file except in compliance

- * with the License. You may obtain a copy of the License at

- *

- *   http://www.apache.org/licenses/LICENSE-2.0

- *

- * Unless required by applicable law or agreed to in writing,

- * software distributed under the License is distributed on an

- * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- * KIND, either express or implied. See the License for the

- * specific language governing permissions and limitations

- * under the License.

- */

-

- // This is the Node test driver for the standard Apache Thrift

- // test service. The driver invokes every function defined in the

- // Thrift Test service with a representative range of parameters.

- //

- // The ThriftTestDriver function requires a client object

- // connected to a server hosting the Thrift Test service and

- // supports an optional callback function which is called with

- // a status message when the test is complete.

-

-var assert = require('assert');

-var ttypes = require('./gen-nodejs/ThriftTest_types');

-

-var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {

-

-// deepEqual doesn't work with fields using node-int64

-function checkRecursively(map1, map2) {

-  if (typeof map1 !== 'function' && typeof map2 !== 'function') {

-    if (!map1 || typeof map1 !== 'object') {

-        assert.equal(map1, map2);

-    } else {

-      for (var key in map1) {

-        checkRecursively(map1[key], map2[key]);

-      }

-    }

-  }

-}

-

-client.testVoid()

-  .then(function(response) {

-    assert.equal(undefined, response); //void

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-

-client.testString("Test")

-  .then(function(response) {

-    assert.equal("Test", response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testString("")

-  .then(function(response) {

-    assert.equal("", response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-//all Languages in UTF-8

-/*jshint -W100 */

-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, Polski, پنجابی, پښتو, " +

-    "Norfuk / Pitkern, 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ú, 粵語";

-/*jshint +W100 */

-

-client.testString(stringTest)

-  .then(function(response) {

-    assert.equal(stringTest, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-

-var specialCharacters = 'quote: \" backslash:' +

-    ' forwardslash-escaped: \/ ' +

-    ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +

-    ' now-all-of-them-together: "\\\/\b\n\r\t' +

-    ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><' +

-    ' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';

-client.testString(specialCharacters)

-  .then(function(response) {

-    assert.equal(specialCharacters, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-

-client.testByte(1)

-  .then(function(response) {

-    assert.equal(1, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-

-client.testByte(0)

-  .then(function(response) {

-    assert.equal(0, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testByte(-1)

-  .then(function(response) {

-    assert.equal(-1, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testByte(-127)

-  .then(function(response) {

-    assert.equal(-127, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testI32(-1)

-  .then(function(response) {

-    assert.equal(-1, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testI64(5)

-  .then(function(response) {

-    assert.equal(5, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testI64(-5)

-  .then(function(response) {

-    assert.equal(-5, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testI64(-34359738368)

-  .then(function(response) {

-    assert.equal(-34359738368, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testDouble(-5.2098523)

-  .then(function(response) {

-    assert.equal(-5.2098523, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testDouble(7.012052175215044)

-  .then(function(response) {

-    assert.equal(7.012052175215044, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-  

-// TODO: add testBinary() 

-  

-var out = new ttypes.Xtruct({

-  string_thing: 'Zero',

-  byte_thing: 1,

-  i32_thing: -3,

-  i64_thing: 1000000

-});

-client.testStruct(out)

-  .then(function(response) {

-    checkRecursively(out, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var out2 = new ttypes.Xtruct2();

-out2.byte_thing = 1;

-out2.struct_thing = out;

-out2.i32_thing = 5;

-client.testNest(out2)

-  .then(function(response) {

-    checkRecursively(out2, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var mapout = {};

-for (var i = 0; i < 5; ++i) {

-  mapout[i] = i-10;

-}

-client.testMap(mapout)

-  .then(function(response) {

-    assert.deepEqual(mapout, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var mapTestInput = {

-  "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",

-  "longValue":stringTest, stringTest:"long key"

-};

-client.testStringMap(mapTestInput)

-  .then(function(response) {

-    assert.deepEqual(mapTestInput, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var setTestInput = [1,2,3];

-client.testSet(setTestInput)

-  .then(function(response) {

-    assert.deepEqual(setTestInput, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-client.testList(setTestInput)

-  .then(function(response) {

-    assert.deepEqual(setTestInput, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testEnum(ttypes.Numberz.ONE)

-  .then(function(response) {

-    assert.equal(ttypes.Numberz.ONE, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testTypedef(69)

-  .then(function(response) {

-    assert.equal(69, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var mapMapTest = {

-  "4": {"1":1, "2":2, "3":3, "4":4},

-  "-4": {"-4":-4, "-3":-3, "-2":-2, "-1":-1}

-};

-client.testMapMap(1)

-  .then(function(response) {

-    assert.deepEqual(mapMapTest, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-var crazy = new ttypes.Insanity({

-  "userMap":{ "5":5, "8":8 },

-  "xtructs":[new ttypes.Xtruct({

-      "string_thing":"Goodbye4",

-      "byte_thing":4,

-      "i32_thing":4,

-      "i64_thing":4

-    }), new ttypes.Xtruct({

-      "string_thing":"Hello2",

-      "byte_thing":2,

-      "i32_thing":2,

-      "i64_thing":2

-    })]

-});

-

-var insanity = {

-  "1":{ "2": crazy, "3": crazy },

-  "2":{ "6":{ "userMap":null, "xtructs":null } }

-};

-client.testInsanity(crazy)

-  .then(function(response) {

-    checkRecursively(insanity, response);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testException('TException')

-  .then(function() {

-    assert(false);

-  });

-

-client.testException('Xception')

-  .then(function(response) {

-    assert.equal(err.errorCode, 1001);

-    assert.equal('Xception', err.message);

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testException('no Exception')

-  .then(function(response) {

-    assert.equal(undefined, response); //void

-  })

-  .fail(function() {

-    assert(false);

-  });

-

-client.testOneway(0, function(error, response) {

-  assert(false); //should not answer

-});

-

-(function() {

-  var test_complete = false;

-  var retrys = 0;

-  var retry_limit = 30;

-  var retry_interval = 100;

-  /**

-   * redo a simple test after the oneway to make sure we aren't "off by one" --

-   * if the server treated oneway void like normal void, this next test will

-   * fail since it will get the void confirmation rather than the correct

-   * result. In this circumstance, the client will throw the exception:

-   *

-   * Because this is the last test against the server, when it completes

-   * the entire suite is complete by definition (the tests run serially).

-   */

-  client.testI32(-1)

-    .then(function(response) {

-        assert.equal(-1, response);

-        test_complete = true;

-    })

-    .fail(function() {

-      assert(false);

-    });

-

-//We wait up to retry_limit * retry_interval for the test suite to complete

-  function TestForCompletion() {

-    if(test_complete) {

-      if (callback) {

-        callback("Server successfully tested!");

-      }

-    } else {

-      if (++retrys < retry_limit) {

-        setTimeout(TestForCompletion, retry_interval);

-      } else {

-    if (callback) {

-      callback("Server test failed to complete after " +

-        (retry_limit*retry_interval/1000) + " seconds");

-    }

-      }

-    }

-  }

-

-  setTimeout(TestForCompletion, retry_interval);

-})();

-};

+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 'License'); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+ // This is the Node test driver for the standard Apache Thrift
+ // test service. The driver invokes every function defined in the
+ // Thrift Test service with a representative range of parameters.
+ //
+ // The ThriftTestDriver function requires a client object
+ // connected to a server hosting the Thrift Test service and
+ // supports an optional callback function which is called with
+ // a status message when the test is complete.
+
+var assert = require('assert');
+var ttypes = require('./gen-nodejs/ThriftTest_types');
+
+var ThriftTestDriver = exports.ThriftTestDriver = function(client, callback) {
+
+// deepEqual doesn't work with fields using node-int64
+function checkRecursively(map1, map2) {
+  if (typeof map1 !== 'function' && typeof map2 !== 'function') {
+    if (!map1 || typeof map1 !== 'object') {
+        assert.equal(map1, map2);
+    } else {
+      for (var key in map1) {
+        checkRecursively(map1[key], map2[key]);
+      }
+    }
+  }
+}
+
+client.testVoid()
+  .then(function(response) {
+    assert.equal(undefined, response); //void
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+
+client.testString("Test")
+  .then(function(response) {
+    assert.equal("Test", response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testString("")
+  .then(function(response) {
+    assert.equal("", response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+//all Languages in UTF-8
+/*jshint -W100 */
+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, Polski, پنجابی, پښتو, " +
+    "Norfuk / Pitkern, 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ú, 粵語";
+/*jshint +W100 */
+
+client.testString(stringTest)
+  .then(function(response) {
+    assert.equal(stringTest, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+
+var specialCharacters = 'quote: \" backslash:' +
+    ' forwardslash-escaped: \/ ' +
+    ' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
+    ' now-all-of-them-together: "\\\/\b\n\r\t' +
+    ' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><' +
+    ' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';
+client.testString(specialCharacters)
+  .then(function(response) {
+    assert.equal(specialCharacters, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+
+client.testByte(1)
+  .then(function(response) {
+    assert.equal(1, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+
+client.testByte(0)
+  .then(function(response) {
+    assert.equal(0, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testByte(-1)
+  .then(function(response) {
+    assert.equal(-1, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testByte(-127)
+  .then(function(response) {
+    assert.equal(-127, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testI32(-1)
+  .then(function(response) {
+    assert.equal(-1, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testI64(5)
+  .then(function(response) {
+    assert.equal(5, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testI64(-5)
+  .then(function(response) {
+    assert.equal(-5, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testI64(-34359738368)
+  .then(function(response) {
+    assert.equal(-34359738368, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testDouble(-5.2098523)
+  .then(function(response) {
+    assert.equal(-5.2098523, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testDouble(7.012052175215044)
+  .then(function(response) {
+    assert.equal(7.012052175215044, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+  
+// TODO: add testBinary() 
+  
+var out = new ttypes.Xtruct({
+  string_thing: 'Zero',
+  byte_thing: 1,
+  i32_thing: -3,
+  i64_thing: 1000000
+});
+client.testStruct(out)
+  .then(function(response) {
+    checkRecursively(out, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var out2 = new ttypes.Xtruct2();
+out2.byte_thing = 1;
+out2.struct_thing = out;
+out2.i32_thing = 5;
+client.testNest(out2)
+  .then(function(response) {
+    checkRecursively(out2, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var mapout = {};
+for (var i = 0; i < 5; ++i) {
+  mapout[i] = i-10;
+}
+client.testMap(mapout)
+  .then(function(response) {
+    assert.deepEqual(mapout, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var mapTestInput = {
+  "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
+  "longValue":stringTest, stringTest:"long key"
+};
+client.testStringMap(mapTestInput)
+  .then(function(response) {
+    assert.deepEqual(mapTestInput, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var setTestInput = [1,2,3];
+client.testSet(setTestInput)
+  .then(function(response) {
+    assert.deepEqual(setTestInput, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+client.testList(setTestInput)
+  .then(function(response) {
+    assert.deepEqual(setTestInput, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testEnum(ttypes.Numberz.ONE)
+  .then(function(response) {
+    assert.equal(ttypes.Numberz.ONE, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testTypedef(69)
+  .then(function(response) {
+    assert.equal(69, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var mapMapTest = {
+  "4": {"1":1, "2":2, "3":3, "4":4},
+  "-4": {"-4":-4, "-3":-3, "-2":-2, "-1":-1}
+};
+client.testMapMap(1)
+  .then(function(response) {
+    assert.deepEqual(mapMapTest, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+var crazy = new ttypes.Insanity({
+  "userMap":{ "5":5, "8":8 },
+  "xtructs":[new ttypes.Xtruct({
+      "string_thing":"Goodbye4",
+      "byte_thing":4,
+      "i32_thing":4,
+      "i64_thing":4
+    }), new ttypes.Xtruct({
+      "string_thing":"Hello2",
+      "byte_thing":2,
+      "i32_thing":2,
+      "i64_thing":2
+    })]
+});
+
+var insanity = {
+  "1":{ "2": crazy, "3": crazy },
+  "2":{ "6":{ "userMap":null, "xtructs":null } }
+};
+client.testInsanity(crazy)
+  .then(function(response) {
+    checkRecursively(insanity, response);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testException('TException')
+  .then(function() {
+    assert(false);
+  });
+
+client.testException('Xception')
+  .then(function(response) {
+    assert.equal(err.errorCode, 1001);
+    assert.equal('Xception', err.message);
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testException('no Exception')
+  .then(function(response) {
+    assert.equal(undefined, response); //void
+  })
+  .fail(function() {
+    assert(false);
+  });
+
+client.testOneway(0, function(error, response) {
+  assert(false); //should not answer
+});
+
+(function() {
+  var test_complete = false;
+  var retrys = 0;
+  var retry_limit = 30;
+  var retry_interval = 100;
+  /**
+   * redo a simple test after the oneway to make sure we aren't "off by one" --
+   * if the server treated oneway void like normal void, this next test will
+   * fail since it will get the void confirmation rather than the correct
+   * result. In this circumstance, the client will throw the exception:
+   *
+   * Because this is the last test against the server, when it completes
+   * the entire suite is complete by definition (the tests run serially).
+   */
+  client.testI32(-1)
+    .then(function(response) {
+        assert.equal(-1, response);
+        test_complete = true;
+    })
+    .fail(function() {
+      assert(false);
+    });
+
+//We wait up to retry_limit * retry_interval for the test suite to complete
+  function TestForCompletion() {
+    if(test_complete) {
+      if (callback) {
+        callback("Server successfully tested!");
+      }
+    } else {
+      if (++retrys < retry_limit) {
+        setTimeout(TestForCompletion, retry_interval);
+      } else {
+    if (callback) {
+      callback("Server test failed to complete after " +
+        (retry_limit*retry_interval/1000) + " seconds");
+    }
+      }
+    }
+  }
+
+  setTimeout(TestForCompletion, retry_interval);
+})();
+};