mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-06 18:35:19 +00:00
THRIFT-847 Test Framework harmonization across all languages
Added --port arg (=9090) Port number to listen to nodejs server at lib/nodejs/test/server.js and added --host arg (=localhost) Host to connect --port arg (=9090) Port number to connect to nodejs client at lib/nodejs/test/client.js Patch: Chamila Dilshan Wijayarathna
This commit is contained in:
parent
44460e2e7a
commit
f8c1c989f2
@ -33,10 +33,23 @@ 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('--port <port>', 'Set thift server port number to connect')
|
||||
.option('--host <host>', 'Set thift server host to connect')
|
||||
.option('--ssl', 'use SSL transport')
|
||||
.option('--promise', 'test with promise style functions')
|
||||
.parse(process.argv);
|
||||
|
||||
var host = "localhost";
|
||||
if(String(program.host) === "undefined") {
|
||||
}else{
|
||||
host = program.host;
|
||||
}
|
||||
|
||||
var port = 9090;
|
||||
if(String(program.port) === "undefined") {
|
||||
}else{
|
||||
port = program.port;
|
||||
}
|
||||
|
||||
var protocol = thrift.TBinaryProtocol;
|
||||
if (program.protocol === "json") {
|
||||
@ -59,9 +72,9 @@ var connection;
|
||||
|
||||
if (program.ssl) {
|
||||
options.rejectUnauthorized = false;
|
||||
connection = thrift.createSSLConnection('localhost', 9090, options);
|
||||
connection = thrift.createSSLConnection(host, port, options);
|
||||
} else {
|
||||
connection = thrift.createConnection('localhost', 9090, options);
|
||||
connection = thrift.createConnection(host,port, options);
|
||||
}
|
||||
|
||||
var client = thrift.createClient(ThriftTest, connection);
|
||||
|
@ -29,6 +29,7 @@ var program = require('commander');
|
||||
program
|
||||
.option('-p, --protocol <protocol>', 'Set thift protocol (binary|json) [protocol]')
|
||||
.option('-t, --transport <transport>', 'Set thift transport (buffered|framed) [transport]')
|
||||
.option('--port <port>', 'Set thift server port')
|
||||
.option('--ssl', 'use ssl transport')
|
||||
.option('--promise', 'test with promise style functions')
|
||||
.parse(process.argv);
|
||||
@ -45,6 +46,12 @@ if (program.protocol === "json") {
|
||||
protocol = thrift.TCompactProtocol;
|
||||
}
|
||||
|
||||
var port = 9090;
|
||||
if (String(program.port) === "undefined"){
|
||||
} else {
|
||||
port = program.port;
|
||||
}
|
||||
|
||||
var handler = ThriftTestHandler;
|
||||
if (program.promise) {
|
||||
handler = ThriftTestHandlerPromise;
|
||||
@ -60,5 +67,5 @@ if (program.ssl) {
|
||||
cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
|
||||
};
|
||||
}
|
||||
thrift.createServer(ThriftTest, handler, options).listen(9090);
|
||||
thrift.createServer(ThriftTest, handler, options).listen(port);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user