summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRoger Meier <roger@apache.org>2014-01-26 11:44:27 +0100
committerRoger Meier <roger@apache.org>2014-01-26 11:44:27 +0100
commit8909cbdf819a059874ffc22ca6c04a06211321f6 (patch)
tree6b343d8209c8b1486b87538f896163847710bf66 /test
parentd0024544bc2f45b6c039387fe69df8cf77fde45d (diff)
downloadthrift-8909cbdf819a059874ffc22ca6c04a06211321f6.tar.gz
THRIFT-2327 nodejs: nodejs test suite should be bundled with the library
Patch: Pierre Lamot further modifications by Roger Meier - git mv instead of delete and add - detect node or nodejs with configure.ac - use exit instead of return within lib/nodejs/test/testAll.sh
Diffstat (limited to 'test')
-rwxr-xr-xtest/Makefile.am3
-rwxr-xr-xtest/nodejs/Makefile.am56
-rw-r--r--test/nodejs/client.js45
-rw-r--r--test/nodejs/client_bin.js47
-rw-r--r--test/nodejs/client_json.js47
-rw-r--r--test/nodejs/client_json_frame.js47
-rw-r--r--test/nodejs/multiplex_client.js326
-rw-r--r--test/nodejs/multiplex_server.js242
-rwxr-xr-xtest/nodejs/package.json30
-rw-r--r--test/nodejs/server.js33
-rw-r--r--test/nodejs/server_bin.js38
-rw-r--r--test/nodejs/server_http.js52
-rw-r--r--test/nodejs/server_json.js38
-rw-r--r--test/nodejs/server_json_frame.js38
-rw-r--r--test/nodejs/test.html51
-rw-r--r--test/nodejs/test.js420
-rw-r--r--test/nodejs/test_handler.js195
-rw-r--r--test/nodejs/thrift_test_driver.js304
-rwxr-xr-xtest/test.sh43
19 files changed, 32 insertions, 2023 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 175f4770d..2d44229db 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -17,7 +17,7 @@
# under the License.
#
-SUBDIRS = nodejs
+SUBDIRS =
if WITH_CPP
SUBDIRS += cpp
@@ -55,7 +55,6 @@ EXTRA_DIST = \
test.sh \
cpp \
hs \
- nodejs \
ocaml \
perl \
php \
diff --git a/test/nodejs/Makefile.am b/test/nodejs/Makefile.am
deleted file mode 100755
index 39a72373f..000000000
--- a/test/nodejs/Makefile.am
+++ /dev/null
@@ -1,56 +0,0 @@
-# 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.
-
-
-THRIFT = $(top_srcdir)/compiler/cpp/thrift
-
-stubs: ../ThriftTest.thrift
- $(THRIFT) --gen js:node ../ThriftTest.thrift
-
-check: stubs
- @if which nodeunit &> /dev/null ; then \
- echo " Testing thrift/binary"; \
- NODE_PATH=../../lib/nodejs/lib:../../lib/nodejs/lib/thrift:$(NODE_PATH) nodeunit ../../lib/nodejs/test/binary.test.js; \
- fi
- @if which node &> /dev/null ; then \
- echo " Testing Client/Server"; \
- timeout -s14 5 $(MAKE) server & \
- sleep 1; $(MAKE) client; sleep 2; \
- \
- echo " Testing Multiplex Client/Server"; \
- sleep 4; timeout -s14 5 $(MAKE) mserver & \
- sleep 1; $(MAKE) mclient; sleep 2; \
- \
- echo " Testing Client/Server examples"; \
- sleep 4; timeout -s14 5 $(MAKE) -C ../../lib/nodejs/examples server & \
- sleep 1; $(MAKE) -C ../../lib/nodejs/examples client; sleep 2; \
- fi
-
-clean-local:
- $(RM) -r gen-nodejs
-
-server:
- NODE_PATH=../../lib/nodejs/lib:../../lib/nodejs/lib/thrift:$(NODE_PATH) node server.js
-
-client:
- NODE_PATH=../../lib/nodejs/lib:../../lib/nodejs/lib/thrift:$(NODE_PATH) node client.js
-
-mserver:
- NODE_PATH=../../lib/nodejs/lib:../../lib/nodejs/lib/thrift:$(NODE_PATH) node multiplex_server.js
-
-mclient:
- NODE_PATH=../../lib/nodejs/lib:../../lib/nodejs/lib/thrift:$(NODE_PATH) node multiplex_client.js
diff --git a/test/nodejs/client.js b/test/nodejs/client.js
deleted file mode 100644
index d70ec0ce8..000000000
--- a/test/nodejs/client.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-//Client test for the following I/O stack:
-// TBinaryProtocol
-// TFramedTransport
-// TSocket
-
-var assert = require('assert');
-var thrift = require('thrift');
-var TFramedTransport = require('thrift/transport').TFramedTransport;
-var ThriftTest = require('./gen-nodejs/ThriftTest');
-var ThriftTestDriver = require('./thrift_test_driver').ThriftTestDriver;
-
-var connection = thrift.createConnection('localhost', 9090, { transport: TFramedTransport} );
-var client = thrift.createClient(ThriftTest, connection);
-
-connection.on('error', function(err) {
- assert(false, err);
-});
-
-ThriftTestDriver(client, function (status) {
- console.log(status);
- connection.end();
-});
-
-// to make it also run on expresso
-exports.expressoTest = function() {};
-
diff --git a/test/nodejs/client_bin.js b/test/nodejs/client_bin.js
deleted file mode 100644
index d077202c6..000000000
--- a/test/nodejs/client_bin.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-//Node client test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var assert = require('assert');
-var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TBinaryProtocol = require('thrift/protocol').TBinaryProtocol;
-var ThriftTest = require('./gen-nodejs/ThriftTest');
-var ThriftTestDriver = require('./thrift_test_driver').ThriftTestDriver;
-
-var connection = thrift.createConnection('localhost', 9090,
- { protocol: TBinaryProtocol, transport: TBufferedTransport} );
-var client = thrift.createClient(ThriftTest, connection);
-
-connection.on('error', function(err) {
- assert(false, err);
-});
-
-ThriftTestDriver(client, function (status) {
- console.log(status);
- connection.end();
-});
-
-// to make it also run on expresso
-exports.expressoTest = function() {};
-
diff --git a/test/nodejs/client_json.js b/test/nodejs/client_json.js
deleted file mode 100644
index de0190fc8..000000000
--- a/test/nodejs/client_json.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-//Node client test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var assert = require('assert');
-var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
-var ThriftTest = require('./gen-nodejs/ThriftTest');
-var ThriftTestDriver = require('./thrift_test_driver').ThriftTestDriver;
-
-var connection = thrift.createConnection('localhost', 9090,
- { protocol: TJSONProtocol, transport: TBufferedTransport} );
-var client = thrift.createClient(ThriftTest, connection);
-
-connection.on('error', function(err) {
- assert(false, err);
-});
-
-ThriftTestDriver(client, function (status) {
- console.log(status);
- connection.end();
-});
-
-// to make it also run on expresso
-exports.expressoTest = function() {};
-
diff --git a/test/nodejs/client_json_frame.js b/test/nodejs/client_json_frame.js
deleted file mode 100644
index f23ddd498..000000000
--- a/test/nodejs/client_json_frame.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-//Node client test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var assert = require('assert');
-var thrift = require('thrift');
-var TFramedTransport = require('thrift/transport').TFramedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
-var ThriftTest = require('./gen-nodejs/ThriftTest');
-var ThriftTestDriver = require('./thrift_test_driver').ThriftTestDriver;
-
-var connection = thrift.createConnection('localhost', 9090,
- { protocol: TJSONProtocol, transport: TFramedTransport} );
-var client = thrift.createClient(ThriftTest, connection);
-
-connection.on('error', function(err) {
- assert(false, err);
-});
-
-ThriftTestDriver(client, function (status) {
- console.log(status);
- connection.end();
-});
-
-// to make it also run on expresso
-exports.expressoTest = function() {};
-
diff --git a/test/nodejs/multiplex_client.js b/test/nodejs/multiplex_client.js
deleted file mode 100644
index ba0d47b2f..000000000
--- a/test/nodejs/multiplex_client.js
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- * 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.
- */
-var thrift = require('thrift');
-var ttransport = require('transport');
-var assert = require('assert');
-
-var ThriftTest = require('./gen-nodejs/ThriftTest'),
- SecondService = require('./gen-nodejs/SecondService'),
- ttypes = require('./gen-nodejs/ThriftTest_types');
-
-var connection = thrift.createConnection('localhost', 9090, {
- 'transport': ttransport.TFramedTransport
-});
-
-var mp = new thrift.Multiplexer();
-
-client = mp.createClient("ThriftTest", ThriftTest, connection);
-secondclient = mp.createClient("SecondService", SecondService, connection);
-
-connection.on('error', function(err) {
- assert(false, err);
-});
-
-// 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.testString("Test", function(err, response) {
- assert(!err);
- assert.equal("Test", response);
-});
-secondclient.secondtestString("Test", function(err, response) {
- assert(!err);
- assert.equal("Test", response);
-});
-
-
-client.testVoid(function(err, response) {
- assert(!err);
- assert.equal(undefined, response); //void
-});
-
-
-secondclient.secondtestString("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
-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ú, 粵語";
-
-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: !@#$%&()(&%$#{}{}<><><';
-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(-34359738368, function(err, response) {
- assert(!err);
- assert.equal(-34359738368, 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);
-});
-
-
-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,
- stringTest: "long key"
-};
-client.testStringMap(mapTestInput, function(err, response) {
- assert(!err);
- assert.deepEqual(mapTestInput, response);
-});
-
-
-var setTestInput = [1, 2, 3];
-client.testSet(setTestInput, function(err, response) {
- assert(!err);
- assert.deepEqual(setTestInput, response);
-});
-client.testList(setTestInput, function(err, response) {
- assert(!err);
- assert.deepEqual(setTestInput, 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(mapMapTest, 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": null,
- "xtructs": null
- }
- }
-};
-client.testInsanity(crazy, function(err, response) {
- assert(!err);
- checkRecursively(insanity, response);
-});
-
-
-client.testException('TException', function(err, response) {
- //assert(err); //BUG?
- 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(1, function(err, response) {
- assert(!response); //should not answer
-});
-
-/**
- * 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:
- *
- * TApplicationException: Wrong method namea
- */
-client.testI32(-1, function(err, response) {
- assert(!err);
- assert.equal(-1, response);
-});
-
-setTimeout(function() {
- console.log("Server successfully tested!");
- connection.end();
-}, 1500);
-
-// to make it also run on expresso
-exports.expressoTest = function() {};
diff --git a/test/nodejs/multiplex_server.js b/test/nodejs/multiplex_server.js
deleted file mode 100644
index 6b2d7d3d2..000000000
--- a/test/nodejs/multiplex_server.js
+++ /dev/null
@@ -1,242 +0,0 @@
-/*
- * 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.
- */
-var thrift = require('thrift');
-var Thrift = thrift.Thrift;
-var ttransport = require('transport');
-
-var ThriftTest = require('./gen-nodejs/ThriftTest'),
- SecondService = require('./gen-nodejs/SecondService'),
- ttypes = require('./gen-nodejs/ThriftTest_types');
-
-var 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);
- },
-
- 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 Thrift.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 x = new ttypes.Xception2();
- x.errorCode = 2002;
- x.struct_thing = new ttypes.Xtruct();
- x.struct_thing.string_thing = 'This is an Xception2';
- result(x);
- }
-
- var res = new ttypes.Xtruct();
- res.string_thing = arg1;
- result(null, res);
- },
-
- testOneway: function(sleepFor, result) {
- console.log('testOneway(' + sleepFor + ') => sleeping...');
- setTimeout(function() {
- console.log('Done sleeping for testOneway!');
- }, sleepFor * 1000); //seconds
- }
-};
-
-var SecondServiceHandler = {
- secondtestString: function(thing, result) {
- console.log('testString(\'' + thing + '\')');
- result(null, thing);
- }
-};
-
-var processor = new thrift.MultiplexedProcessor();
-
-processor.registerProcessor(
- "ThriftTest",
- new ThriftTest.Processor(ThriftTestHandler));
-
-processor.registerProcessor(
- "SecondService",
- new SecondService.Processor(SecondServiceHandler));
-
-
-var server = thrift.createMultiplexServer(processor, { //server options
- 'transport': ttransport.TFramedTransport
-});
-
-server.listen(9090);
diff --git a/test/nodejs/package.json b/test/nodejs/package.json
deleted file mode 100755
index 85adef14b..000000000
--- a/test/nodejs/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "thrift-nodejs-test",
- "version": "1.0.0-dev",
- "description": "node.js test server and client for the Apache Thrift",
- "homepage": "http://thrift.apache.org/",
- "repository":
- { "type" : "git",
- "url" : "https://git-wip-us.apache.org/repos/asf/thrift.git"
- },
- "author":
- { "name": "Apache Thrift Developers",
- "email": "dev@thrift.apache.org",
- "url": "http://thrift.apache.org"
- },
- "licenses":
- [ { "type": "Apache-2.0",
- "url": "http://www.apache.org/licenses/LICENSE-2.0"
- }
- ],
- "bugs":
- { "mail": "dev@thrift.apache.org",
- "url": "https://issues.apache.org/jira/browse/THRIFT"
- },
- "directories" : { "lib" : "../lib/nodejs/lib/thrift" },
- "main": "../lib/nodejs/lib/thrift",
- "scripts": {
- "start": "node ./http-server"
- },
- "engines": { "node": ">= 0.2.4" }
-}
diff --git a/test/nodejs/server.js b/test/nodejs/server.js
deleted file mode 100644
index 78a21c639..000000000
--- a/test/nodejs/server.js
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-//Server test for the following I/O stack:
-// TBinaryProtocol
-// TFramedTransport
-// TSocket
-
-var thrift = require('thrift');
-var TFramedTransport = require('thrift/transport').TFramedTransport;
-var ThriftTest = require('./gen-nodejs/ThriftTest');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-
-thrift.createServer(ThriftTest,
- ThriftTestHandler,
- {'transport': TFramedTransport}).listen(9090);
-
diff --git a/test/nodejs/server_bin.js b/test/nodejs/server_bin.js
deleted file mode 100644
index ba8444903..000000000
--- a/test/nodejs/server_bin.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-//Node server test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TBinaryProtocol = require('thrift/protocol').TBinaryProtocol;
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-
-var ThriftTestSvcOpt = {
- transport: TBufferedTransport,
- protocol: TBinaryProtocol
-};
-
-thrift.createServer(ThriftTestSvc,
- ThriftTestHandler,
- ThriftTestSvcOpt).listen(9090);
diff --git a/test/nodejs/server_http.js b/test/nodejs/server_http.js
deleted file mode 100644
index 43669437f..000000000
--- a/test/nodejs/server_http.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 HTTP server is designed to server the test.html browser
-// 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). The current directory must also include the browser
-// support libraries for test.html (jquery.js, qunit.js and qunit.css
-// in ./build/js/lib).
-
-var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest.js');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-
-var ThriftTestSvcOpt = {
- transport: TBufferedTransport,
- protocol: TJSONProtocol,
- cls: ThriftTestSvc,
- handler: ThriftTestHandler
-};
-
-var StaticHttpThriftServerOptions = {
- staticFilePath: ".",
- services: {
- "/service": ThriftTestSvcOpt
- }
-}
-
-var server = thrift.createStaticHttpThriftServer(StaticHttpThriftServerOptions);
-var port = 8088;
-server.listen(port);
-console.log("Http/Thrift Server running on port: " + port);
diff --git a/test/nodejs/server_json.js b/test/nodejs/server_json.js
deleted file mode 100644
index 406c9820e..000000000
--- a/test/nodejs/server_json.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-//Node server test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var thrift = require('thrift');
-var TBufferedTransport = require('thrift/transport').TBufferedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-
-var ThriftTestSvcOpt = {
- transport: TBufferedTransport,
- protocol: TJSONProtocol
-};
-
-thrift.createServer(ThriftTestSvc,
- ThriftTestHandler,
- ThriftTestSvcOpt).listen(9090);
diff --git a/test/nodejs/server_json_frame.js b/test/nodejs/server_json_frame.js
deleted file mode 100644
index 828063ac8..000000000
--- a/test/nodejs/server_json_frame.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-//Node server test for the following I/O stack:
-// TJSONProtocol
-// TBufferedTransport
-// TSocket
-
-var thrift = require('thrift');
-var TFramedTransport = require('thrift/transport').TFramedTransport;
-var TJSONProtocol = require('thrift/protocol').TJSONProtocol;
-var ThriftTestSvc = require('./gen-nodejs/ThriftTest');
-var ThriftTestHandler = require('./test_handler').ThriftTestHandler;
-
-var ThriftTestSvcOpt = {
- transport: TFramedTransport,
- protocol: TJSONProtocol
-};
-
-thrift.createServer(ThriftTestSvc,
- ThriftTestHandler,
- ThriftTestSvcOpt).listen(9090);
diff --git a/test/nodejs/test.html b/test/nodejs/test.html
deleted file mode 100644
index fe0e52b29..000000000
--- a/test/nodejs/test.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<!--
- 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.
--->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Thrift Javascript Bindings: Unit Test</title>
-
- <script src="/thrift.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest_types.js" type="text/javascript" charset="utf-8"></script>
- <script src="gen-js/ThriftTest.js" type="text/javascript" charset="utf-8"></script>
-
- <!-- jQuery -->
- <script type="text/javascript" src="build/js/lib/jquery-1.7.2.js" charset="utf-8"></script>
-
- <!-- QUnit Test framework-->
- <script type="text/javascript" src="build/js/lib/qunit.js" charset="utf-8"></script>
- <link rel="stylesheet" href="build/js/lib/qunit.css" type="text/css" media="screen" />
-
- <!-- the Test Suite-->
- <script type="text/javascript" src="test.js" charset="utf-8"></script>
-</head>
-<body>
- <h1 id="qunit-header">Thrift Javascript Bindings: Unit Test (<a href="https://git-wip-us.apache.org/repos/asf?p=thrift.git;a=blob;f=test/ThriftTest.thrift;hb=HEAD">ThriftTest.thrift</a>)</h1>
- <h2 id="qunit-banner"></h2>
- <div id="qunit-testrunner-toolbar"></div>
- <h2 id="qunit-userAgent"></h2>
- <ol id="qunit-tests"><li><!-- get valid xhtml strict--></li></ol>
- <p>
- <a href="http://validator.w3.org/check/referer"><img
- src="http://www.w3.org/Icons/valid-xhtml10"
- alt="Valid XHTML 1.0!" height="31" width="88" /></a>
- </p>
-</body>
-</html>
diff --git a/test/nodejs/test.js b/test/nodejs/test.js
deleted file mode 100644
index 91ba4d108..000000000
--- a/test/nodejs/test.js
+++ /dev/null
@@ -1,420 +0,0 @@
-/*
- * 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.
- */
- /* jshint -W100 */
-
-/*
- * JavaScript test suite
- */
-
-var transport = new Thrift.Transport("/service");
-var protocol = new Thrift.Protocol(transport);
-var client = new ThriftTest.ThriftTestClient(protocol);
-
-// 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') {
- equal(map1, map2);
- } else {
- for (var key in map1) {
- checkRecursively(map1[key], map2[key]);
- }
- }
- }
-}
-
-module("Base Types");
-
- test("Void", function() {
- equal(client.testVoid(), undefined);
- });
- test("String", function() {
- equal(client.testString(''), '');
- equal(client.testString(stringTest), stringTest);
-
- 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: !@#$%&()(&%$#{}{}<><><';
- equal(client.testString(specialCharacters),specialCharacters);
- });
- 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));
- });
- test("Byte", function() {
- equal(client.testByte(0), 0);
- equal(client.testByte(0x01), 0x01);
- });
- 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));
- });
- 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));
- });
-
-
-module("Structured Types");
-
- test("Struct", function() {
- var structTestInput = new ThriftTest.Xtruct();
- structTestInput.string_thing = 'worked';
- structTestInput.byte_thing = 0x01;
- 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);
-
- var structTestOutput = client.testStruct(structTestInput);
-
- equal(structTestOutput.string_thing, structTestInput.string_thing);
- equal(structTestOutput.byte_thing, structTestInput.byte_thing);
- equal(structTestOutput.i32_thing, structTestInput.i32_thing);
- equal(structTestOutput.i64_thing, structTestInput.i64_thing);
-
- equal(JSON.stringify(structTestOutput), JSON.stringify(structTestInput));
- });
-
- test("Nest", function() {
- var xtrTestInput = new ThriftTest.Xtruct();
- xtrTestInput.string_thing = 'worked';
- xtrTestInput.byte_thing = 0x01;
- 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);
-
- var nestTestInput = new ThriftTest.Xtruct2();
- nestTestInput.byte_thing = 0x02;
- nestTestInput.struct_thing = xtrTestInput;
- nestTestInput.i32_thing = Math.pow(2,15);
-
- var nestTestOutput = client.testNest(nestTestInput);
-
- equal(nestTestOutput.byte_thing, nestTestInput.byte_thing);
- equal(nestTestOutput.struct_thing.string_thing, nestTestInput.struct_thing.string_thing);
- equal(nestTestOutput.struct_thing.byte_thing, nestTestInput.struct_thing.byte_thing);
- equal(nestTestOutput.struct_thing.i32_thing, nestTestInput.struct_thing.i32_thing);
- equal(nestTestOutput.struct_thing.i64_thing, nestTestInput.struct_thing.i64_thing);
- equal(nestTestOutput.i32_thing, nestTestInput.i32_thing);
-
- equal(JSON.stringify(nestTestOutput), JSON.stringify(nestTestInput));
- });
-
- test("Map", function() {
- var mapTestInput = {7:77, 8:88, 9:99};
-
- var mapTestOutput = client.testMap(mapTestInput);
-
- for (var key in mapTestOutput) {
- equal(mapTestOutput[key], mapTestInput[key]);
- }
- });
-
- test("StringMap", function() {
- var mapTestInput = {
- "a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
- "longValue":stringTest, stringTest:"long key"
- };
-
- var mapTestOutput = client.testStringMap(mapTestInput);
-
- for (var key in mapTestOutput) {
- equal(mapTestOutput[key], mapTestInput[key]);
- }
- });
-
- test("Set", function() {
- var setTestInput = [1,2,3];
- ok(client.testSet(setTestInput), setTestInput);
- });
-
- test("List", function() {
- var listTestInput = [1,2,3];
- ok(client.testList(listTestInput), listTestInput);
- });
-
- test("Enum", function() {
- equal(client.testEnum(ThriftTest.Numberz.ONE), ThriftTest.Numberz.ONE);
- });
-
- test("TypeDef", function() {
- equal(client.testTypedef(69), 69);
- });
-
-
-module("deeper!");
-
- test("MapMap", function() {
- var mapMapTestExpectedResult = {
- "4":{"1":1,"2":2,"3":3,"4":4},
- "-4":{"-4":-4, "-3":-3, "-2":-2, "-1":-1}
- };
-
- var mapMapTestOutput = client.testMapMap(1);
-
-
- for (var key in mapMapTestOutput) {
- for (var key2 in mapMapTestOutput[key]) {
- equal(mapMapTestOutput[key][key2], mapMapTestExpectedResult[key][key2]);
- }
- }
-
- checkRecursively(mapMapTestOutput, mapMapTestExpectedResult);
- });
-
-
-module("Exception");
-
- test("Xception", function() {
- expect(2);
- try{
- client.testException("Xception");
- }catch(e){
- equal(e.errorCode, 1001);
- equal(e.message, "Xception");
- }
- });
-
- test("no Exception", 0, function() {
- try{
- client.testException("no Exception");
- }catch(e){
- ok(false);
- }
- });
-
- 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) {
- //ok(false);
- }
- ok(true);
- });
-
-
-module("Insanity");
-
- test("testInsanity", function() {
- var insanity = {
- "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
- }
- ]
- },
- "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
- }
- ]
- }
- },
- "2":{ "6":{ "userMap":null, "xtructs":null } }
- };
- var res = client.testInsanity(new ThriftTest.Insanity());
- ok(res, JSON.stringify(res));
- ok(insanity, JSON.stringify(insanity));
-
- checkRecursively(res, insanity);
- });
-
-
-//////////////////////////////////
-//Run same tests asynchronously
-jQuery.ajaxSetup({ timeout: 0 });
-$(document).ajaxError( function() { QUnit.start(); } );
-
-module("Async Manual");
-
- 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 jqxhr = jQuery.ajax({
- 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));
- },
- error: function() { ok(false); },
- complete: function() {
- ok(true);
- QUnit.start();
- }
- });
- });
-
-
- test("testI64", function() {
- expect( 2 );
- QUnit.stop();
-
- var transport = new Thrift.Transport();
- var protocol = new Thrift.Protocol(transport);
- var client = new ThriftTest.ThriftTestClient(protocol);
-
- jQuery.ajax({
- 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",
- cache: false,
- 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));
- },
- error: function() { ok(false); },
- complete: function() {
- ok(true);
- QUnit.start();
- }
- });
- });
-
-
-module("Async");
-
- test("Double", function() {
- expect( 1 );
-
- QUnit.stop();
- client.testDouble(3.14159265, function(result) {
- equal(result, 3.14159265);
- QUnit.start();
- });
- });
-
- test("Byte", function() {
- expect( 1 );
-
- QUnit.stop();
- client.testByte(0x01, function(result) {
- equal(result, 0x01);
- QUnit.start();
- });
- });
-
- test("I32", function() {
- expect( 3 );
-
- QUnit.stop();
- 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));
- });
-
- jqxhr.success(function(result) {
- equal(result, Math.pow(-2,31));
- QUnit.start();
- });
- });
-
- 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));
- 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));
- })
- .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));
- })
- .complete(function() {
- ok(true);
- QUnit.start();
- });
- });
-
- test("Xception", function() {
- expect( 2 );
-
- QUnit.stop();
-
- var dfd = client.testException("Xception", function(result) {
- ok(false);
- QUnit.start();
- })
- .error(function(xhr, status, e){
- equal(e.errorCode, 1001);
- equal(e.message, "Xception");
- //QUnit.start();
- //Note start is not required here because:
- //$(document).ajaxError( function() { QUnit.start(); } );
- });
- });
diff --git a/test/nodejs/test_handler.js b/test/nodejs/test_handler.js
deleted file mode 100644
index e697408a0..000000000
--- a/test/nodejs/test_handler.js
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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('thrift/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);
- },
- 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 x = new ttypes.Xception2();
- x.errorCode = 2002;
- x.struct_thing = new ttypes.Xtruct();
- x.struct_thing.string_thing = 'This is an Xception2';
- result(x);
- }
-
- 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/test/nodejs/thrift_test_driver.js b/test/nodejs/thrift_test_driver.js
deleted file mode 100644
index c61e99d44..000000000
--- a/test/nodejs/thrift_test_driver.js
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * 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(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
-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ú, 粵語";
-
-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(-34359738368, function(err, response) {
- assert( ! err);
- assert.equal(-34359738368, 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);
-});
-
-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, stringTest:"long key"
-};
-client.testStringMap(mapTestInput, function(err, response) {
- assert( ! err);
- assert.deepEqual(mapTestInput, response);
-});
-
-var setTestInput = [1,2,3];
-client.testSet(setTestInput, function(err, response) {
- assert( ! err);
- assert.deepEqual(setTestInput, response);
-});
-client.testList(setTestInput, function(err, response) {
- assert( ! err);
- assert.deepEqual(setTestInput, 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(mapMapTest, 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":null, "xtructs":null } }
-};
-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/test/test.sh b/test/test.sh
index 520a6321d..5170e13a6 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -101,6 +101,9 @@ cpp_sockets="ip domain"
java_sockets="ip ip-ssl"
# TODO fastframed java transport is another implementation of framed transport
+nodejs_protocols="binary json"
+nodejs_transports="buffered framed"
+nodejs_sockets="ip"
ant -f ../lib/java/build.xml compile-test 1>/dev/null
@@ -170,6 +173,34 @@ for proto in $(intersection "${cpp_protocols}" "${java_protocols}"); do
done
done
+
+NODE_TEST_DIR=${BASEDIR}/../bin/nodejs/tests
+export NODE_PATH=${NODE_TEST_DIR}:${NODE_TEST_DIR}/../lib:${NODE_PATH}
+######### nodejs client - cpp server ##############
+##
+for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
+ for trans in $(intersection "${nodejs_transports}" "${cpp_transports}"); do
+ for sock in $(intersection "${nodejs_sockets}" "${cpp_sockets}"); do
+ do_test "nodejs-cpp" "${proto}" "${trans}-ip" \
+ "nodejs ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans}" \
+ "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+ "10" "10"
+ done
+ done
+done
+
+######### cpp client - nodejs server ##############
+for proto in $(intersection "${nodejs_protocols}" "${cpp_protocols}"); do
+ for trans in $(intersection "${nodejs_transports}" "${cpp_transports}"); do
+ for sock in $(intersection "${nodejs_sockets}" "${cpp_sockets}"); do
+ do_test "cpp-nodejs" "${proto}" "${trans}-ip" \
+ "cpp/TestClient --protocol=${proto} --transport=${trans}" \
+ "nodejs ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans}" \
+ "10" "10"
+ done
+ done
+done
+
# delete Unix Domain Socket used by cpp tests
rm -f /tmp/ThriftTest.thrift
@@ -221,18 +252,6 @@ do_test "php-cpp" "binary" "buffered-ip" \
"make -C php/ client" \
"cpp/TestServer" \
"10" "10"
-do_test "nodejs-nodejs" "binary" "framed-ip" \
- "make -C nodejs/ client" \
- "make -C nodejs/ server" \
- "1" "5"
-do_test "nodejs-cpp" "binary" "framed-ip" \
- "make -C nodejs/ client" \
- "cpp/TestServer --transport=framed" \
- "1" "10"
-do_test "cpp-nodejs" "binary" "framed-ip" \
- "cpp/TestClient --transport=framed" \
- "make -C nodejs/ server" \
- "1" "5"
do_test "rb-rb" "binary" "buffered-ip" \
"ruby rb/integration/simple_client.rb" \
"ruby rb/integration/simple_server.rb" \