blob: c2666bc0d861779bad360ca2c01ee31904b7a363 [file] [log] [blame]
wilfrem2c69b5a2015-04-20 19:24:50 +09001/*
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
Cameron Martinfdaca5e2025-01-07 15:25:15 +000028import { program } from "commander";
wilfrem2c69b5a2015-04-20 19:24:50 +090029
30program
Cameron Martinfdaca5e2025-01-07 15:25:15 +000031 .option("--port <port>", "Set thrift server port number to connect", Number.parseInt, 9090)
wilfrem2c69b5a2015-04-20 19:24:50 +090032 .option("--promise", "test with promise style functions")
33 .option("--protocol", "Set thrift protocol (binary) [protocol]")
34 .parse(process.argv);
35
Cameron Martinfdaca5e2025-01-07 15:25:15 +000036
37var opts = program.opts();
38var port: number = opts.port;
39var promise = opts.promise;
wilfrem2c69b5a2015-04-20 19:24:50 +090040
41var options = {
42 transport: Thrift.TBufferedTransport,
Cameron Martincaef0ed2025-01-15 11:58:39 +010043 protocol: Thrift.TBinaryProtocol,
wilfrem2c69b5a2015-04-20 19:24:50 +090044};
45
46var testDriver = promise ? ThriftTestDriverPromise : ThriftTestDriver;
47
48var connection = thrift.createConnection("localhost", port, options);
49
Cameron Martincaef0ed2025-01-15 11:58:39 +010050connection.on("error", function (err: string) {
51 assert(false, err);
wilfrem2c69b5a2015-04-20 19:24:50 +090052});
53
54var client = thrift.createClient(ThriftTest.Client, connection);
55runTests();
56
57function runTests() {
58 testDriver(client, function (status: string) {
59 console.log(status);
Mustafa Senol Cosardd965c12018-11-30 20:02:00 +030060 process.exit(0);
wilfrem2c69b5a2015-04-20 19:24:50 +090061 });
62}
63
Cameron Martincaef0ed2025-01-15 11:58:39 +010064exports.expressoTest = function () {};