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 20import assert = require("assert"); 21import thrift = require("thrift"); 22import Thrift = thrift.Thrift; 23import ThriftTest = require("./gen-nodejs/ThriftTest"); 24import test_driver = require("./test_driver"); 25import ThriftTestDriver = test_driver.ThriftTestDriver; 26import ThriftTestDriverPromise = test_driver.ThriftTestDriverPromise; 27 28// var program = require("commander"); 29import * as program from "commander"; 30 31program 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 37var port: number = program.port; 38var promise = program.promise; 39 40var options = { 41 transport: Thrift.TBufferedTransport, 42 protocol: Thrift.TBinaryProtocol 43}; 44 45var testDriver = promise ? ThriftTestDriverPromise : ThriftTestDriver; 46 47var connection = thrift.createConnection("localhost", port, options); 48 49connection.on("error", function(err: string) { 50 assert(false, err); 51}); 52 53var client = thrift.createClient(ThriftTest.Client, connection); 54runTests(); 55 56function runTests() { 57 testDriver(client, function (status: string) { 58 console.log(status); 59 process.exit(0); 60 }); 61} 62 63exports.expressoTest = function() {}; 64