]> git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/lib/nodets/test/server.ts
2da53aee29b8f73e6952b0014a5e45c937faf059
[ceph.git] / ceph / src / jaegertracing / thrift / lib / nodets / test / server.ts
1 import thrift = require("thrift");
2 var program = require('commander');
3 import ThriftTest = require('./gen-nodejs/ThriftTest');
4 import test_handler = require('./test_handler');
5
6
7 program
8 .option('--port <port>', 'Set thrift server port', 9090)
9 .option('--promise', 'test with promise style functions')
10 .option('--protocol', '"Set thrift protocol (binary) [protocol]"')
11 .parse(process.argv);
12
13 var port: number = program.port;
14
15 var options: thrift.ServerOptions = {
16 transport: thrift.TBufferedTransport,
17 protocol: thrift.TBinaryProtocol
18 };
19
20 var server: thrift.Server;
21 if (program.promise) {
22 server = thrift.createServer(ThriftTest.Processor, new test_handler.AsyncThriftTestHandler(), options);
23 } else {
24 server = thrift.createServer(ThriftTest.Processor, new test_handler.SyncThriftTestHandler(), options);
25 }
26 server.listen(port);