THRIFT-2998: enable cross test for nodejs http transport,
fix missing apache license headers in nodejs
Client: nodejs
This closes #1403
diff --git a/lib/nodejs/test/browser_client.js b/lib/nodejs/test/browser_client.js
index 27db543..72fd837 100644
--- a/lib/nodejs/test/browser_client.js
+++ b/lib/nodejs/test/browser_client.js
@@ -1,3 +1,21 @@
+/*
+ * 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 assert = require('assert');
var thrift = require('thrift');
diff --git a/lib/nodejs/test/client.js b/lib/nodejs/test/client.js
index a38a66b..9609518 100644
--- a/lib/nodejs/test/client.js
+++ b/lib/nodejs/test/client.js
@@ -32,13 +32,13 @@
var program = require('commander');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json) [protocol]')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed) [transport]')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json) [protocol]')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http) [transport]')
.option('--port <port>', 'Set thrift server port number to connect', 9090)
.option('--host <host>', 'Set thrift server host to connect', 'localhost')
.option('--ssl', 'use SSL transport')
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var host = program.host;
@@ -47,6 +47,12 @@
var ssl = program.ssl;
var promise = program.promise;
+/* for compatibility with cross test invocation for http transport testing */
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
diff --git a/lib/nodejs/test/deep-constructor.test.js b/lib/nodejs/test/deep-constructor.test.js
index 2caeb82..145b668 100644
--- a/lib/nodejs/test/deep-constructor.test.js
+++ b/lib/nodejs/test/deep-constructor.test.js
@@ -1,3 +1,22 @@
+/*
+ * 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 ttypes = require('./gen-nodejs/JsDeepConstructorTest_types');
var thrift = require('thrift');
var test = require('tape');
@@ -286,7 +305,7 @@
"Can make list with objects": function(assert) {
var tObj = new ttypes.ComplexList({
- "struct_list_field": [new ttypes.Complex({})]
+ "struct_list_field": [new ttypes.Complex({})]
});
var innerObj = tObj.struct_list_field[0];
assert.ok(innerObj instanceof ttypes.Complex)
diff --git a/lib/nodejs/test/exceptions.js b/lib/nodejs/test/exceptions.js
index c6f2e4d..0a75770 100644
--- a/lib/nodejs/test/exceptions.js
+++ b/lib/nodejs/test/exceptions.js
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
'use strict';
var test = require('tape');
var thrift = require('../lib/thrift/thrift.js');
diff --git a/lib/nodejs/test/helpers.js b/lib/nodejs/test/helpers.js
index c850c46..5f828b3 100644
--- a/lib/nodejs/test/helpers.js
+++ b/lib/nodejs/test/helpers.js
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
'use strict';
var thrift = require('../lib/thrift');
diff --git a/lib/nodejs/test/server.js b/lib/nodejs/test/server.js
index 6e5cdfa..bad3b17 100644
--- a/lib/nodejs/test/server.js
+++ b/lib/nodejs/test/server.js
@@ -32,12 +32,12 @@
var ttypes = require('./gen-nodejs/ThriftTest_types');
program
- .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|json|compact)', 'binary')
- .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed)', 'buffered')
+ .option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json)', 'binary')
+ .option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http)', 'buffered')
.option('--ssl', 'use ssl transport')
.option('--port <port>', 'Set thrift server port', 9090)
.option('--promise', 'test with promise style functions')
- .option('-t, --type <type>', 'Select server type (tcp|multiplex|http)', 'tcp')
+ .option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
.parse(process.argv);
var port = program.port;
@@ -47,6 +47,11 @@
var handler = program.promise ? ThriftTestHandler : ThriftTestHandlerPromise;
+if (program.transport === 'http') {
+ program.transport = 'buffered';
+ type = 'http';
+}
+
var options = {
transport: helpers.transports[program.transport],
protocol: helpers.protocols[program.protocol]
diff --git a/lib/nodejs/test/test-cases.js b/lib/nodejs/test/test-cases.js
index 13722be..bd66dc4 100644
--- a/lib/nodejs/test/test-cases.js
+++ b/lib/nodejs/test/test-cases.js
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
'use strict';
var ttypes = require('./gen-nodejs/ThriftTest_types');