wilfrem | 2c69b5a | 2015-04-20 19:24:50 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | import assert = require("assert"); |
| 21 | import thrift = require("thrift"); |
| 22 | import Thrift = thrift.Thrift; |
| 23 | import ThriftTest = require("./gen-nodejs/ThriftTest"); |
| 24 | import test_driver = require("./test_driver"); |
| 25 | import ThriftTestDriver = test_driver.ThriftTestDriver; |
| 26 | import ThriftTestDriverPromise = test_driver.ThriftTestDriverPromise; |
| 27 | |
| 28 | // var program = require("commander"); |
| 29 | import * as program from "commander"; |
| 30 | |
| 31 | program |
| 32 | .option("--port <port>", "Set thrift server port number to connect", 9090) |
| 33 | .option("--promise", "test with promise style functions") |
| 34 | .option("--protocol", "Set thrift protocol (binary) [protocol]") |
| 35 | .parse(process.argv); |
| 36 | |
| 37 | var port: number = program.port; |
| 38 | var promise = program.promise; |
| 39 | |
| 40 | var options = { |
| 41 | transport: Thrift.TBufferedTransport, |
| 42 | protocol: Thrift.TBinaryProtocol |
| 43 | }; |
| 44 | |
| 45 | var testDriver = promise ? ThriftTestDriverPromise : ThriftTestDriver; |
| 46 | |
| 47 | var connection = thrift.createConnection("localhost", port, options); |
| 48 | |
| 49 | connection.on("error", function(err: string) { |
| 50 | assert(false, err); |
| 51 | }); |
| 52 | |
| 53 | var client = thrift.createClient(ThriftTest.Client, connection); |
| 54 | runTests(); |
| 55 | |
| 56 | function runTests() { |
| 57 | testDriver(client, function (status: string) { |
| 58 | console.log(status); |
Mustafa Senol Cosar | dd965c1 | 2018-11-30 20:02:00 +0300 | [diff] [blame^] | 59 | process.exit(0); |
wilfrem | 2c69b5a | 2015-04-20 19:24:50 +0900 | [diff] [blame] | 60 | }); |
| 61 | } |
| 62 | |
| 63 | exports.expressoTest = function() {}; |