Upgrading vendor folder dependencies.
This commit is contained in:
parent
4a0cbcd770
commit
acbe9ad9e5
229 changed files with 10735 additions and 4528 deletions
16
Gopkg.lock
generated
16
Gopkg.lock
generated
|
@ -3,19 +3,19 @@
|
|||
|
||||
[[projects]]
|
||||
branch = "0.12.0"
|
||||
digest = "1:0d6d7a897b900dd5924e36bfa05dea429d7049b4b0b87bd3f93cb5f0acc35a21"
|
||||
digest = "1:89696c38cec777120b8b1bb5e2d363d655cf2e1e7d8c851919aaa0fd576d9b86"
|
||||
name = "git.apache.org/thrift.git"
|
||||
packages = ["lib/go/thrift"]
|
||||
pruneopts = ""
|
||||
revision = "5c1ecb67cde4d9aff7ed3188ab11566184b27bf0"
|
||||
revision = "384647d290e2e4a55a14b1b7ef1b7e66293a2c33"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:56c130d885a4aacae1dd9c7b71cfe39912c7ebc1ff7d2b46083c8812996dc43b"
|
||||
digest = "1:0deddd908b6b4b768cfc272c16ee61e7088a60f7fe2f06c547bd3d8e1f8b8e77"
|
||||
name = "github.com/davecgh/go-spew"
|
||||
packages = ["spew"]
|
||||
pruneopts = ""
|
||||
revision = "346938d642f2ec3594ed81d874461961cd0faa76"
|
||||
version = "v1.1.0"
|
||||
revision = "8991bc29aa16c548c550c7ff78260e27b9ab7c73"
|
||||
version = "v1.1.1"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:df48fb76fb2a40edea0c9b3d960bc95e326660d82ff1114e1f88001f7a236b40"
|
||||
|
@ -40,12 +40,12 @@
|
|||
revision = "471cd4e61d7a78ece1791fa5faa0345dc8c7d5a5"
|
||||
|
||||
[[projects]]
|
||||
digest = "1:2d0dc026c4aef5e2f3a0e06a4dabe268b840d8f63190cf6894e02134a03f52c5"
|
||||
digest = "1:c587772fb8ad29ad4db67575dad25ba17a51f072ff18a22b4f0257a4d9c24f75"
|
||||
name = "github.com/stretchr/testify"
|
||||
packages = ["assert"]
|
||||
pruneopts = ""
|
||||
revision = "b91bfb9ebec76498946beb6af7c0230c7cc7ba6c"
|
||||
version = "v1.2.0"
|
||||
revision = "f35b8ab0b5a2cef36673838d662e249dd9c94686"
|
||||
version = "v1.2.2"
|
||||
|
||||
[solve-meta]
|
||||
analyzer-name = "dep"
|
||||
|
|
9
vendor/git.apache.org/thrift.git/.eslintignore
generated
vendored
Normal file
9
vendor/git.apache.org/thrift.git/.eslintignore
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# TODO: Use eslint on js lib and generated code
|
||||
|
||||
# Ignore lib/js for now, which uses jshint currently
|
||||
lib/js/*
|
||||
# Ignore all generated code for now
|
||||
**/gen-*
|
||||
|
||||
# Don't lint nested node_modules
|
||||
**/node_modules
|
24
vendor/git.apache.org/thrift.git/.eslintrc.json
generated
vendored
Normal file
24
vendor/git.apache.org/thrift.git/.eslintrc.json
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"env": {
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2017
|
||||
},
|
||||
"rules": {
|
||||
"no-console": "off",
|
||||
"no-var": "error",
|
||||
"prefer-const": "error",
|
||||
"no-constant-condition": [
|
||||
"error",
|
||||
{
|
||||
"checkLoops": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
59
vendor/git.apache.org/thrift.git/.github/stale.yml
generated
vendored
Normal file
59
vendor/git.apache.org/thrift.git/.github/stale.yml
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 60
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 7
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- Do Not Merge
|
||||
- blocked
|
||||
- pinned
|
||||
- security
|
||||
- "[Status] Maybe Later"
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: wontfix
|
||||
|
||||
# Comment to post when marking as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed in 7 days if no further activity occurs.
|
||||
Thank you for your contributions.
|
||||
|
||||
# Comment to post when removing the stale label.
|
||||
unmarkComment: >
|
||||
This issue is no longer stale.
|
||||
Thank you for your contributions.
|
||||
|
||||
# Comment to post when closing a stale Issue or Pull Request.
|
||||
closeComment: >
|
||||
This issue has been automatically closed due to inactivity.
|
||||
Thank you for your contributions.
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
# Limit to only `issues` or `pulls`
|
||||
# only: issues
|
||||
|
||||
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
|
||||
# pulls:
|
||||
# daysUntilStale: 30
|
||||
# markComment: >
|
||||
# This pull request has been automatically marked as stale because it has not had
|
||||
# recent activity. It will be closed if no further activity occurs. Thank you
|
||||
# for your contributions.
|
||||
|
||||
# issues:
|
||||
# exemptLabels:
|
||||
# - confirmed
|
9
vendor/git.apache.org/thrift.git/.gitignore
generated
vendored
9
vendor/git.apache.org/thrift.git/.gitignore
generated
vendored
|
@ -339,8 +339,17 @@ project.lock.json
|
|||
/test/rs/target/
|
||||
/test/rs/*.iml
|
||||
/test/rs/**/*.iml
|
||||
/lib/cl/backport-update.zip
|
||||
/lib/cl/lib
|
||||
/tutorial/cl/quicklisp.lisp
|
||||
/tutorial/cl/externals/
|
||||
/tutorial/cl/quicklisp/
|
||||
/tutorial/cl/TutorialClient
|
||||
/tutorial/cl/TutorialServer
|
||||
/tutorial/cl/backport-update.zip
|
||||
/tutorial/cl/lib/
|
||||
/tutorial/cl/shared-implementation.fasl
|
||||
/tutorial/cl/tutorial-implementation.fasl
|
||||
/tutorial/cpp/TutorialClient
|
||||
/tutorial/cpp/TutorialServer
|
||||
/tutorial/c_glib/tutorial_client
|
||||
|
|
69
vendor/git.apache.org/thrift.git/.rustfmt.toml
generated
vendored
69
vendor/git.apache.org/thrift.git/.rustfmt.toml
generated
vendored
|
@ -1,7 +1,64 @@
|
|||
max_width = 100
|
||||
fn_args_layout = "Block"
|
||||
array_layout = "Block"
|
||||
where_style = "Rfc"
|
||||
generics_indent = "Block"
|
||||
fn_call_style = "Block"
|
||||
reorder_imported_names = true
|
||||
hard_tabs = false
|
||||
tab_spaces = 4
|
||||
newline_style = "Auto"
|
||||
use_small_heuristics = "Default"
|
||||
indent_style = "Block"
|
||||
wrap_comments = false
|
||||
format_doc_comments = false
|
||||
comment_width = 80
|
||||
normalize_comments = false
|
||||
normalize_doc_attributes = false
|
||||
license_template_path = ""
|
||||
format_strings = false
|
||||
format_macro_matchers = false
|
||||
format_macro_bodies = true
|
||||
empty_item_single_line = true
|
||||
struct_lit_single_line = true
|
||||
fn_single_line = false
|
||||
where_single_line = false
|
||||
imports_indent = "Block"
|
||||
imports_layout = "Mixed"
|
||||
merge_imports = false
|
||||
reorder_imports = true
|
||||
reorder_modules = true
|
||||
reorder_impl_items = false
|
||||
type_punctuation_density = "Wide"
|
||||
space_before_colon = false
|
||||
space_after_colon = true
|
||||
spaces_around_ranges = false
|
||||
binop_separator = "Front"
|
||||
remove_nested_parens = true
|
||||
combine_control_expr = true
|
||||
overflow_delimited_expr = false
|
||||
struct_field_align_threshold = 0
|
||||
enum_discrim_align_threshold = 0
|
||||
match_arm_blocks = true
|
||||
force_multiline_blocks = false
|
||||
fn_args_density = "Tall"
|
||||
brace_style = "SameLineWhere"
|
||||
control_brace_style = "AlwaysSameLine"
|
||||
trailing_semicolon = true
|
||||
trailing_comma = "Vertical"
|
||||
match_block_trailing_comma = false
|
||||
blank_lines_upper_bound = 1
|
||||
blank_lines_lower_bound = 0
|
||||
edition = "2015"
|
||||
merge_derives = true
|
||||
use_try_shorthand = false
|
||||
use_field_init_shorthand = false
|
||||
force_explicit_abi = true
|
||||
condense_wildcard_suffixes = false
|
||||
color = "Auto"
|
||||
required_version = "1.0.0"
|
||||
unstable_features = false
|
||||
disable_all_formatting = false
|
||||
skip_children = false
|
||||
hide_parse_errors = false
|
||||
error_on_line_overflow = false
|
||||
error_on_unformatted = false
|
||||
report_todo = "Never"
|
||||
report_fixme = "Never"
|
||||
ignore = []
|
||||
emit_mode = "Files"
|
||||
make_backup = false
|
||||
|
|
253
vendor/git.apache.org/thrift.git/CHANGES
generated
vendored
253
vendor/git.apache.org/thrift.git/CHANGES
generated
vendored
|
@ -1,13 +1,262 @@
|
|||
Apache Thrift Changelog
|
||||
|
||||
Breaking Changes since 0.11.0 [for 0.12.0]:
|
||||
--------------------------------------------------------------------------------
|
||||
================================================================================
|
||||
Thrift 0.12.0
|
||||
--------------------------------------------------------------------------------
|
||||
## New Languages
|
||||
* Common LISP (cl)
|
||||
* Swift
|
||||
* Typescript (nodets)
|
||||
|
||||
## Deprecated Languages
|
||||
* Cocoa
|
||||
|
||||
## Breaking Changes (since 0.11.0)
|
||||
* [THRIFT-4529] - Rust enum variants are now camel-cased instead of uppercased to conform to Rust naming conventions
|
||||
* [THRIFT-4448] - Support for golang 1.6 and earlier has been dropped.
|
||||
* [THRIFT-4474] - PHP now uses the PSR-4 loader by default instead of class maps.
|
||||
* [THRIFT-4532] - method signatures changed in the compiler's t_oop_generator.
|
||||
* [THRIFT-4648] - The C (GLib) compiler's handling of namespaces has been improved.
|
||||
|
||||
## Known Issues (Blocker or Critical)
|
||||
* [THRIFT-4037] - build: use a single build system for thrift
|
||||
* [THRIFT-4119] - build: bootstrap.sh is missing from source tarball
|
||||
* [THRIFT-3289] - csharp: socket exhaustion in csharp implementation
|
||||
* [THRIFT-3029] - cocoa: Getters for fields defined with uppercase names do not work
|
||||
* [THRIFT-3325] - cocoa: Extended services aren't subclasses in generated Cocoa
|
||||
* [THRIFT-4116] - cocoa: Thrift de-capitalizes the name of IsSet property in Cocoa
|
||||
* [THRIFT-3877] - cpp: the http implementation is not standard; interop with other languages is spotty at best
|
||||
* [THRIFT-4180] - cpp: Impossible to build Thrift C++ library for Android (NDK)
|
||||
* [THRIFT-4384] - cpp: Using multiple async services simultaneously is not thread-safe
|
||||
* [THRIFT-3108] - haskell: Defaulted struct parameters on a service generates invalid Haskell
|
||||
* [THRIFT-3990] - nodejs: Exception swallowed by deserialization function
|
||||
* [THRIFT-4214] - nodejs: map<i64,value> key treated as hex value in JavaScript
|
||||
* [THRIFT-4602] - nodejs: ERROR in ./node_modules/thrift/lib/nodejs/lib/thrift/connection.js Module not found: Error: Can't resolve 'child_process'
|
||||
* [THRIFT-4639] - nodejs: Sequence numbering for multiplexed protocol broken
|
||||
* [THRIFT-1310] - php: sequence and reconnection management issues
|
||||
* [THRIFT-1538] - php: Error during deserialization int64 on 32-bit architecture
|
||||
* [THRIFT-1580] - php: thrift type i64 java to php serialize/deserealize not working
|
||||
* [THRIFT-1950] - php: PHP gets stuck in infinite loop
|
||||
* [THRIFT-2954] - python: sending int or float in a double field breaks the connection
|
||||
* [THRIFT-4080] - python: unix sockets can get stuck forever
|
||||
* [THRIFT-4281] - python: generated code is out of order and causes load issues
|
||||
* [THRIFT-4677] - py3: UnicodeDecideError in Python3
|
||||
|
||||
## Build Process
|
||||
* [THRIFT-4308] - D language docker images need demios for libevent and openssl fixed to re-enable make cross on dlang
|
||||
* [THRIFT-4579] - Use Ubuntu Bionic (18.04 LTS) for CI builds instead of Artful (17.10)
|
||||
* [THRIFT-4508] - Define CI operating system coverage rules for the project and (hopefully) simplify CI a little more
|
||||
* [THRIFT-4397] - ubuntu install instructions broken on 16.04
|
||||
* [THRIFT-4545] - Appveyor builds are failing due to a haskell / cabal update in chocolatey
|
||||
* [THRIFT-4452] - optimize Dockerfile (only onetime apt-get update)
|
||||
* [THRIFT-4440] - rm `build/docker/ubuntu-trusty/Dockerfile.orig`
|
||||
* [THRIFT-4352] - Ubuntu Artful doesn't appear to be compatible with Thrift and Haxe 3.4.2
|
||||
* [THRIFT-4666] - DLang Client Pool Test fails sporadically
|
||||
* [THRIFT-4676] - CL tutorial build fails sporadically
|
||||
* [THRIFT-4456] - Make haxelib download quiet so it doesn't blow up the build log
|
||||
* [THRIFT-4605] - bootstrap.sh fails if automake=1.16.1
|
||||
|
||||
## c_glib
|
||||
* [THRIFT-4648] - The C (GLib) compiler's handling of namespaces has been improved.
|
||||
* [THRIFT-4622] - glibC compilation issue
|
||||
* [THRIFT-4671] - c glib is unable to handle client close unexpectedly
|
||||
|
||||
## cl (new language support in 0.12.0)
|
||||
* [THRIFT-82] - Common Lisp support
|
||||
|
||||
## csharp
|
||||
* [THRIFT-4558] - reserved Csharp keywords are not escaped in some cases
|
||||
* [THRIFT-4637] - C# async mode generates incorrect code with inherited services
|
||||
* [THRIFT-4672] - IAsyncResult style methods not being supported by certain transports leads to issues in mixed ISync/IAsync use cases
|
||||
* [THRIFT-4539] - Allow TBufferedTransport to be used as base class
|
||||
* [THRIFT-4535] - XML docs; code cleanup (tabs->spaces; String->string)
|
||||
* [THRIFT-4492] - protected ExceptionType type member of TApplicationException cannot be accessed
|
||||
* [THRIFT-4446] - JSONProtocol Base64 Encoding Trims Padding
|
||||
* [THRIFT-4455] - Missing dispose calls in ThreadedServer & ThreadpoolServer
|
||||
* [THRIFT-4609] - keep InnerException wherever appropriate
|
||||
* [THRIFT-4673] - IAsyncResult not supported by layered transports (buffered/framed)
|
||||
|
||||
## cpp
|
||||
* [THRIFT-4476] - Typecasting problem on list items
|
||||
* [THRIFT-4465] - TNonblockingServer throwing THRIFT LOGGER: TConnection::workSocket(): THRIFT_EAGAIN (unavailable resources)
|
||||
* [THRIFT-4680] - TBufferTransports.h does not compile under Visual Studio 2017
|
||||
* [THRIFT-4618] - TNonblockingServer crash because of limitation of select()
|
||||
* [THRIFT-4620] - TZlibTransport.cpp doesn't ensure that there is enough space for the zlib flush marker in the buffer.
|
||||
* [THRIFT-4571] - ZeroMQ contrib library needs a refresh
|
||||
* [THRIFT-4559] - TSSLServerSocket incorrectly prints errors
|
||||
* [THRIFT-4578] - Move `TAsyncProtocolProcessor` into main thrift library
|
||||
* [THRIFT-4418] - evhttp_connection_new is deprecated; use evhttp_connection_base_new
|
||||
|
||||
## compiler
|
||||
* [THRIFT-4644] - Compiler cannot be compiled on macOS(maybe also on other platforms with clang)
|
||||
* [THRIFT-4531] - Thrift generates wrong Python code for immutable structures with optional members
|
||||
* [THRIFT-4513] - thrift generated code is not stable for constants
|
||||
* [THRIFT-4532] - Avoid updating Thrift compiler generated code if the output has not changed
|
||||
* [THRIFT-4400] - Visual Studio Compiler project should link runtime statically in release builds
|
||||
* [THRIFT-4399] - plugin.thrift t_const_value is not used as a union in C++ code -- fix this
|
||||
* [THRIFT-4496] - Dealing with language keywords in Thrift (e.g. service method names)
|
||||
* [THRIFT-4393] - repeated runs of compiler produce different binary output at plugin interface
|
||||
|
||||
## dlang
|
||||
* [THRIFT-4478] - Thrift will not build with dlang 2.078 or later
|
||||
* [THRIFT-4503] - dlang servers logError on normal client disconnection
|
||||
* [THRIFT-4308] - D language docker images need demios for libevent and openssl fixed to re-enable make cross on dlang
|
||||
|
||||
## dart
|
||||
* [THRIFT-4646] - Effective Dart and Exceptions
|
||||
* [THRIFT-4439] - Shouldn't download dart.deb directly.
|
||||
|
||||
## delphi
|
||||
* [THRIFT-4562] - Calling wrong exception CTOR leads to "call failed: unknown result" instead of the real exception being thrown
|
||||
* [THRIFT-4554] - uncompileable code with member names that are also types under specific conditions
|
||||
* [THRIFT-4422] - Add Async implementation via IFuture
|
||||
* [THRIFT-4485] - Possible invalid ptr AV with overlapped read/write on pipes
|
||||
* [THRIFT-4549] - Thrift exceptions should derive from TException
|
||||
* [THRIFT-4540] - buffered transport broken when trying to re-open a formerly closed transport
|
||||
* [THRIFT-4473] - Move Thrift.Console.pas out of the Library
|
||||
* [THRIFT-4490] - Allow a default service as fallback for multiplex processors connected by old clients
|
||||
* [THRIFT-4454] - Large writes/reads may cause range check errors in debug mode
|
||||
* [THRIFT-4461] - Compiler directive should match Delphi XE4
|
||||
* [THRIFT-4462] - First line in Console duplicated
|
||||
* [THRIFT-4642] - FPU ctrl word settings may cause an unexpected "denormalized" error
|
||||
|
||||
## erlang
|
||||
* [THRIFT-4497] - Erlang records should use map() for map type
|
||||
* [THRIFT-4495] - Erlang records should allow 'undefined' for non-required fields
|
||||
* [THRIFT-4580] - Fix erlang tutorial unpack on Windows
|
||||
* [THRIFT-4582] - Ubuntu Xenial erlang 18.3 "make check" fails
|
||||
|
||||
## golang
|
||||
* [THRIFT-4448] - Support for golang 1.6 and earlier has been dropped.
|
||||
* [THRIFT-4253] - Go generator assigns strings to field in const instead of pointers.
|
||||
* [THRIFT-4573] - Unions Field Count Does Not Consider Binary
|
||||
* [THRIFT-4447] - Golang: Panic on p.c.Call when using deprecated initializers
|
||||
* [THRIFT-4650] - Required field incorrectly marked as set when fieldType does not match
|
||||
* [THRIFT-4486] - Golang: -remote.go client cleanup
|
||||
* [THRIFT-4537] - TSimpleServer can exit Accept loop with lock still acquired
|
||||
* [THRIFT-4516] - Add support for go 1.10
|
||||
* [THRIFT-4421] - golang tests rely on gomock, which has change behaviour, causing tests to fail
|
||||
* [THRIFT-4626] - Communication crash when using binary/compact protocol and zlib transport
|
||||
* [THRIFT-4659] - golang race detected when closing listener socket
|
||||
|
||||
## haskell
|
||||
* [THRIFT-4634] - Haskell builds with older cabal cannot reconcile complex version requirements
|
||||
|
||||
## java
|
||||
* [THRIFT-4259] - Thrift does not compile due to Ant Maven task errors
|
||||
* [THRIFT-1418] - Compiling Thrift from source: Class org.apache.tools.ant.taskdefs.ConditionTask doesn't support the nested "typefound" element
|
||||
* [THRIFT-4530] - proposal: add nullability annotations to generated Java code
|
||||
* [THRIFT-4614] - Generate missing @Nullable annotations for Java iterator getters
|
||||
* [THRIFT-4555] - Getter of binary field in Java creates unnecessary copy
|
||||
* [THRIFT-3983] - libthrift is deployed on central with pom packaging instead of jar
|
||||
* [THRIFT-4294] - Java Configure Fails for Ant >= 1.10
|
||||
* [THRIFT-4178] - Java libraries missing from package when using cmake
|
||||
* [THRIFT-4120] - pom files are not generated or provided in the build
|
||||
* [THRIFT-1507] - Maven can't download resource from central when behind a proxy and won't use local repository
|
||||
* [THRIFT-4556] - Optional rethrow of unhandled exceptions in java processor
|
||||
* [THRIFT-4337] - Able to set keyStore and trustStore as InputStream in the TSSLTransportFactory.TSSLTransportParameters
|
||||
* [THRIFT-4566] - Pass message of unhandled exception to optional rethrow.
|
||||
* [THRIFT-4506] - Remove assertion in Java SASL code that would be ignored in release builds
|
||||
* [THRIFT-4470] - Include popular IDE file templates to gitignore
|
||||
* [THRIFT-4429] - Make TThreadPoolServer.executorService_ available in inherited classes and refactor methods to be able customization
|
||||
* [THRIFT-3769] - Fix logic of THRIFT-2268
|
||||
* [THRIFT-4494] - Increase Java Socket Buffer Size
|
||||
* [THRIFT-4499] - Remove Magic Number In TFIleTransport
|
||||
|
||||
## js
|
||||
* [THRIFT-4406] - JavaScript: Use modern Promise implementations
|
||||
* [THRIFT-4625] - let / const variable decorators for es6 compiler
|
||||
* [THRIFT-4653] - ES6 Classes
|
||||
* [THRIFT-4592] - JS: readI32 performance on large arrays is very poor in Chrome
|
||||
* [THRIFT-4509] - js and nodejs libraries need to be refreshed with current libraries
|
||||
* [THRIFT-4403] - thrift.js: Incorrect usage of 'this' in TWebSocketTransport.__onOpen
|
||||
* [THRIFT-4436] - Deserialization of nested list discards content
|
||||
* [THRIFT-4437] - JS WebSocket client callbacks invoked twice on parallel requests
|
||||
* [THRIFT-4679] - Duplicate declaration of InputBufferUnderrunError in lib/nodejs/lib/thrift/json_protocol.js
|
||||
* [THRIFT-4551] - Add prettier for consistent JS code formatting
|
||||
|
||||
## lua
|
||||
* [THRIFT-4591] - lua client uses two write() calls per framed message send
|
||||
* [THRIFT-3863] - Can't "make install" Lua Library
|
||||
|
||||
## netcore
|
||||
* [THRIFT-4524] - .NET Core Server doesn't close properly when cancelled
|
||||
* [THRIFT-4434] - Update .NET Core components, add tests for .Net Core library and .Net Core compiler, fix bugs and build process
|
||||
* [THRIFT-4446] - JSONProtocol Base64 Encoding Trims Padding
|
||||
|
||||
## node.js
|
||||
* [THRIFT-4225] - Error handling malformed arguments leaks memory, corrupts transport buffers causing next RPC to fail
|
||||
* [THRIFT-3950] - Memory leak while calling oneway method
|
||||
* [THRIFT-3143] - add typescript directory support
|
||||
* [THRIFT-4564] - TBufferedTransport can leave corrupt data in the buffer
|
||||
* [THRIFT-4647] - Node.js Fileserver webroot path
|
||||
* [THRIFT-4489] - Unix domain socket support for NodeJS client
|
||||
* [THRIFT-4443] - node.js json_protocol throws error in skip function
|
||||
* [THRIFT-4604] - NodeJS: Expose Int64 from browser.js for consumption by browser
|
||||
* [THRIFT-4480] - NodeJS warning on binary_protocol writeMessageEnd when seqid = 0
|
||||
|
||||
## perl
|
||||
* [THRIFT-4382] - Replace the use of Perl Indirect Object Syntax calls to new()
|
||||
* [THRIFT-4471] - Thrift CPAN release is missing Makefile.PL and the clients are unable to build the module
|
||||
* [THRIFT-4416] - Perl CPAN Packaging Improvements
|
||||
|
||||
## php
|
||||
* [THRIFT-4474] - PHP generator use PSR-4 default
|
||||
* [THRIFT-4463] - PHP generated code match PSR-2
|
||||
* [THRIFT-4373] - Extending Thrift class results in "Attempt serialize from non-Thrift object"
|
||||
* [THRIFT-4354] - TSocket block on read
|
||||
* [THRIFT-4423] - migrate php library to psr-4
|
||||
* [THRIFT-4656] - infinite loop in latest PHP library
|
||||
* [THRIFT-4477] - TBufferedTransport must have underlying transport
|
||||
* [THRIFT-4475] - lib/php/test should be checked for PSR-2
|
||||
* [THRIFT-4498] - add phpcs back
|
||||
* [THRIFT-4460] - php library use PSR-2
|
||||
* [THRIFT-4641] - TCurlClient doesn't check for HTTP status code
|
||||
* [THRIFT-4645] - TCurlClient: show actual error message when throwing TTransportException
|
||||
* [THRIFT-4674] - Add stream context support into PHP/THttpClient
|
||||
* [THRIFT-4459] - reduce php library directory depth
|
||||
|
||||
## python
|
||||
* [THRIFT-4670] - Twisted, slots, and void method fails with "object has no attribute 'success'"
|
||||
* [THRIFT-4464] - Potentially server-crashing typo in Python TNonblockingServer
|
||||
* [THRIFT-4548] - Supporting TBinaryProtocolAccelerated protocol when using TMultiplexedProcessor in Python
|
||||
* [THRIFT-4577] - Outdated cipher string in python unit test
|
||||
* [THRIFT-4505] - python build on Vagrant Windows boxes fails
|
||||
* [THRIFT-4621] - THeader for Python
|
||||
* [THRIFT-4668] - make socket backlog configurable for python
|
||||
* [THRIFT-4561] - Python: cleanup socket timeout settings
|
||||
|
||||
## ruby
|
||||
* [THRIFT-4289] - Thrift RSpec test suite fails with Ruby 2.4.x due to Fixnum deprecation
|
||||
* [THRIFT-4342] - Support ruby rspec 3
|
||||
* [THRIFT-4525] - Add ssl socket option to ruby cross tests
|
||||
* [THRIFT-4450] - Add seek support to TCompactInputProtocol in Rust
|
||||
* [THRIFT-4631] - Codegen Creates Invalid Ruby for Recursive Structs
|
||||
* [THRIFT-4472] - Fix the genspec for ruby so it does not complain about an invalid license
|
||||
|
||||
## rust
|
||||
* [THRIFT-4662] - Rust const string calls function at compile time
|
||||
* [THRIFT-4661] - Rust enum name wrong case in generated structs
|
||||
* [THRIFT-4617] - Avoid generating conflicting struct names in Rust code
|
||||
* [THRIFT-4529] - Rust generation should include #![allow(non_snake_case)] or force conform to Rust style guidelines
|
||||
* [THRIFT-4390] - Rust binary protocol and buffered transport cannot handle writes above 4096 bytes
|
||||
* [THRIFT-4419] - Rust framed transport cannot handle writes above 4096 bytes
|
||||
* [THRIFT-4658] - Rust's TBinaryInputProtocol fails when strict is false
|
||||
* [THRIFT-4187] - Dart -> Rust Framed cross tests fail
|
||||
* [THRIFT-4664] - Rust cannot create ReadHalf/WriteHalf to implement custom tranports
|
||||
|
||||
## swift (new language support in 0.12.0)
|
||||
* [THRIFT-3773] - Swift Library
|
||||
|
||||
## test suite
|
||||
* [THRIFT-4515] - Gracefully shutdown cross-test servers to fully test teardown
|
||||
* [THRIFT-4085] - Add .NET Core to the make cross standard test suite
|
||||
* [THRIFT-4358] - Add unix domain sockets in ruby to cross test - code exists
|
||||
|
||||
## typescript (new language support in 0.12.0)
|
||||
* [THRIFT-3143] - add typescript directory support
|
||||
|
||||
================================================================================
|
||||
Thrift 0.11.0
|
||||
--------------------------------------------------------------------------------
|
||||
## Sub-task
|
||||
|
|
15
vendor/git.apache.org/thrift.git/LANGUAGES.md
generated
vendored
15
vendor/git.apache.org/thrift.git/LANGUAGES.md
generated
vendored
|
@ -1,8 +1,8 @@
|
|||
# Apache Thrift Language Support #
|
||||
|
||||
Last Modified: 2018-07-06
|
||||
Last Modified: 2018-12-17
|
||||
|
||||
Guidance For: 0.11.0 or later
|
||||
Guidance For: 0.12.0 or later
|
||||
|
||||
Thrift supports many programming languages and has an impressive test suite that exercises most of the languages, protocols, and transports that represents a matrix of thousands of possible combinations. Each language typically has a minimum required version as well as support libraries - some mandatory and some optional. All of this information is provided below to help you assess whether you can use Apache Thrift with your project. Obviously this is a complex matrix to maintain and may not be correct in all cases - if you spot an error please inform the developers using the mailing list.
|
||||
|
||||
|
@ -243,6 +243,17 @@ The Language/Library Levels indicate the minimum and maximum versions that are u
|
|||
<td align=left><a href="https://issues.apache.org/jira/browse/THRIFT/component/12314320">node.js</a></td>
|
||||
</tr>
|
||||
<tr align=center>
|
||||
<td align=left><a href="lib/nodets/README.md">node.ts</a></td>
|
||||
<!-- Since -----------------><td>0.12.0</td>
|
||||
<!-- Build Systems ---------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td>
|
||||
<!-- Language Levels -------><td>3.1.6</td><td></td>
|
||||
<!-- Low-Level Transports --><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td>
|
||||
<!-- Transport Wrappers ----><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
|
||||
<!-- Protocols -------------><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
|
||||
<!-- Servers ---------------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cgrn.png" alt="Yes"/></td><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
|
||||
<td align=left><a href="https://issues.apache.org/jira/issues/?jql=project%20%3D%20THRIFT%20AND%20resolution%20%3D%20Unresolved%20and%20Component%20in%20(%22TypeScript%20-%20Library%22)%20ORDER%20BY%20priority%20DESC%2C%20updated%20DESC">node.ts</a></td>
|
||||
</tr>
|
||||
<tr align=center>
|
||||
<td align=left><a href="lib/ocaml/README.md">OCaml</a></td>
|
||||
<!-- Since -----------------><td>0.2.0</td>
|
||||
<!-- Build Systems ---------><td><img src="doc/images/cred.png" alt=""/></td><td><img src="doc/images/cred.png" alt=""/></td>
|
||||
|
|
2
vendor/git.apache.org/thrift.git/Makefile.am
generated
vendored
2
vendor/git.apache.org/thrift.git/Makefile.am
generated
vendored
|
@ -54,7 +54,7 @@ empty :=
|
|||
space := $(empty) $(empty)
|
||||
comma := ,
|
||||
|
||||
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_DOTNETCORE@
|
||||
CROSS_LANGS = @MAYBE_CPP@ @MAYBE_C_GLIB@ @MAYBE_CL@ @MAYBE_D@ @MAYBE_JAVA@ @MAYBE_CSHARP@ @MAYBE_PYTHON@ @MAYBE_PY3@ @MAYBE_RUBY@ @MAYBE_HASKELL@ @MAYBE_PERL@ @MAYBE_PHP@ @MAYBE_GO@ @MAYBE_NODEJS@ @MAYBE_DART@ @MAYBE_ERLANG@ @MAYBE_LUA@ @MAYBE_RS@ @MAYBE_DOTNETCORE@ @MAYBE_NODETS@
|
||||
CROSS_LANGS_COMMA_SEPARATED = $(subst $(space),$(comma),$(CROSS_LANGS))
|
||||
|
||||
if WITH_PY3
|
||||
|
|
10
vendor/git.apache.org/thrift.git/Thrift-swift3.podspec
generated
vendored
10
vendor/git.apache.org/thrift.git/Thrift-swift3.podspec
generated
vendored
|
@ -1,16 +1,16 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "Thrift-swift3"
|
||||
s.version = "1.1.0"
|
||||
s.name = "Thrift-swift3"
|
||||
s.version = "0.12.0"
|
||||
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
|
||||
s.description = <<-DESC
|
||||
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
|
||||
DESC
|
||||
s.homepage = "http://thrift.apache.org"
|
||||
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' }
|
||||
s.author = { "The Apache Software Foundation" => "apache@apache.org" }
|
||||
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
|
||||
s.author = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
|
||||
s.ios.deployment_target = '9.0'
|
||||
s.osx.deployment_target = '10.10'
|
||||
s.requires_arc = true
|
||||
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-1.0.0" }
|
||||
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "0.12.0" }
|
||||
s.source_files = "lib/swift/Sources/*.swift"
|
||||
end
|
||||
|
|
10
vendor/git.apache.org/thrift.git/Thrift.podspec
generated
vendored
10
vendor/git.apache.org/thrift.git/Thrift.podspec
generated
vendored
|
@ -1,18 +1,18 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "Thrift"
|
||||
s.version = "1.0.0"
|
||||
s.version = "0.12.0"
|
||||
s.summary = "Apache Thrift is a lightweight, language-independent software stack with an associated code generation mechanism for RPC."
|
||||
s.description = <<-DESC
|
||||
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, OCaml and Delphi and other languages.
|
||||
DESC
|
||||
s.homepage = "http://thrift.apache.org"
|
||||
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://raw.github.com/apache/thrift/thrift-0.9.0/LICENSE' }
|
||||
s.author = { "The Apache Software Foundation" => "apache@apache.org" }
|
||||
s.license = { :type => 'Apache License, Version 2.0', :url => 'https://www.apache.org/licenses/LICENSE-2.0' }
|
||||
s.author = { "Apache Thrift Developers" => "dev@thrift.apache.org" }
|
||||
s.requires_arc = true
|
||||
s.ios.deployment_target = '7.0'
|
||||
s.osx.deployment_target = '10.8'
|
||||
s.ios.framework = 'CFNetwork'
|
||||
s.osx.framework = 'CoreServices'
|
||||
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "thrift-1.0.0" }
|
||||
s.source = { :git => "https://github.com/apache/thrift.git", :tag => "0.12.0" }
|
||||
s.source_files = 'lib/cocoa/src/**/*.{h,m,swift}'
|
||||
end
|
||||
end
|
||||
|
|
6
vendor/git.apache.org/thrift.git/aclocal/ax_boost_base.m4
generated
vendored
6
vendor/git.apache.org/thrift.git/aclocal/ax_boost_base.m4
generated
vendored
|
@ -33,7 +33,7 @@
|
|||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 42
|
||||
#serial 45
|
||||
|
||||
# example boost program (need to pass version)
|
||||
m4_define([_AX_BOOST_BASE_PROGRAM],
|
||||
|
@ -113,8 +113,8 @@ AC_DEFUN([_AX_BOOST_BASE_RUNDETECT],[
|
|||
dnl are found, e.g. when only header-only libraries are installed!
|
||||
AS_CASE([${host_cpu}],
|
||||
[x86_64],[libsubdirs="lib64 libx32 lib lib64"],
|
||||
[ppc64|s390x|sparc64|aarch64|ppc64le],[libsubdirs="lib64 lib lib64"],
|
||||
[libsubdirs="lib"],
|
||||
[ppc64|powerpc64|s390x|sparc64|aarch64|ppc64le|powerpc64le|riscv64],[libsubdirs="lib64 lib lib64"],
|
||||
[libsubdirs="lib"]
|
||||
)
|
||||
|
||||
dnl allow for real multi-arch paths e.g. /usr/lib/x86_64-linux-gnu. Give
|
||||
|
|
42
vendor/git.apache.org/thrift.git/aclocal/ax_cxx_compile_stdcxx.m4
generated
vendored
42
vendor/git.apache.org/thrift.git/aclocal/ax_cxx_compile_stdcxx.m4
generated
vendored
|
@ -33,19 +33,18 @@
|
|||
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
|
||||
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
|
||||
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
|
||||
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
# Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com>
|
||||
#
|
||||
# Copying and distribution of this file, with or without modification, are
|
||||
# permitted in any medium without royalty provided the copyright notice
|
||||
# and this notice are preserved. This file is offered as-is, without any
|
||||
# warranty.
|
||||
|
||||
#serial 7
|
||||
#serial 10
|
||||
|
||||
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
|
||||
dnl (serial version number 13).
|
||||
|
||||
AX_REQUIRE_DEFINED([AC_MSG_WARN])
|
||||
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
||||
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
|
||||
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
|
||||
|
@ -61,14 +60,6 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
|||
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
|
||||
AC_LANG_PUSH([C++])dnl
|
||||
ac_success=no
|
||||
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
|
||||
ax_cv_cxx_compile_cxx$1,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
|
||||
[ax_cv_cxx_compile_cxx$1=yes],
|
||||
[ax_cv_cxx_compile_cxx$1=no])])
|
||||
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
|
||||
ac_success=yes
|
||||
fi
|
||||
|
||||
m4_if([$2], [noext], [], [dnl
|
||||
if test x$ac_success = xno; then
|
||||
|
@ -139,7 +130,6 @@ AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
|
|||
[define if the compiler supports basic C++$1 syntax])
|
||||
fi
|
||||
AC_SUBST(HAVE_CXX$1)
|
||||
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
|
||||
])
|
||||
|
||||
|
||||
|
@ -587,20 +577,12 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
|||
|
||||
#error "This is not a C++ compiler"
|
||||
|
||||
#elif __cplusplus <= 201402L
|
||||
#elif __cplusplus < 201703L
|
||||
|
||||
#error "This is not a C++17 compiler"
|
||||
|
||||
#else
|
||||
|
||||
#if defined(__clang__)
|
||||
#define REALLY_CLANG
|
||||
#else
|
||||
#if defined(__GNUC__)
|
||||
#define REALLY_GCC
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <type_traits>
|
||||
|
@ -608,16 +590,12 @@ m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
|
|||
namespace cxx17
|
||||
{
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_constexpr_lambdas
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
constexpr int foo = [](){return 42;}();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test::nested_namespace::definitions
|
||||
{
|
||||
|
@ -852,12 +830,9 @@ namespace cxx17
|
|||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_template_argument_deduction_for_class_templates
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
template <typename T1, typename T2>
|
||||
struct pair
|
||||
{
|
||||
|
@ -876,7 +851,6 @@ namespace cxx17
|
|||
}
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_non_type_auto_template_parameters
|
||||
{
|
||||
|
@ -890,12 +864,9 @@ namespace cxx17
|
|||
|
||||
}
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_structured_bindings
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
int arr[2] = { 1, 2 };
|
||||
std::pair<int, int> pr = { 1, 2 };
|
||||
|
||||
|
@ -927,14 +898,10 @@ namespace cxx17
|
|||
const auto [ x3, y3 ] = f3();
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
#if !defined(REALLY_CLANG)
|
||||
namespace test_exception_spec_type_system
|
||||
{
|
||||
|
||||
// TODO: test it with clang++ from git
|
||||
|
||||
struct Good {};
|
||||
struct Bad {};
|
||||
|
||||
|
@ -952,7 +919,6 @@ namespace cxx17
|
|||
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
|
||||
|
||||
}
|
||||
#endif // !defined(REALLY_CLANG)
|
||||
|
||||
namespace test_inline_variables
|
||||
{
|
||||
|
@ -977,6 +943,6 @@ namespace cxx17
|
|||
|
||||
} // namespace cxx17
|
||||
|
||||
#endif // __cplusplus <= 201402L
|
||||
#endif // __cplusplus < 201703L
|
||||
|
||||
]])
|
||||
|
|
4
vendor/git.apache.org/thrift.git/appveyor.yml
generated
vendored
4
vendor/git.apache.org/thrift.git/appveyor.yml
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
|
||||
# build Apache Thrift on AppVeyor - https://ci.appveyor.com
|
||||
|
||||
version: '1.0.0-dev.{build}'
|
||||
version: '0.12.0.{build}'
|
||||
|
||||
shallow_clone: true
|
||||
|
||||
|
@ -107,4 +107,4 @@ test_script:
|
|||
#
|
||||
# also need:
|
||||
# environment:
|
||||
# APPVEYOR_RDP_PASSWORD: thr1FT2345$xyzZ
|
||||
# APPVEYOR_RDP_PASSWORD: thr1FT2345$xyzZ
|
||||
|
|
1
vendor/git.apache.org/thrift.git/bower.json
generated
vendored
1
vendor/git.apache.org/thrift.git/bower.json
generated
vendored
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"name": "thrift",
|
||||
"version": "0.12.0",
|
||||
"homepage": "https://git-wip-us.apache.org/repos/asf/thrift.git",
|
||||
"authors": [
|
||||
"Apache Thrift <dev@thrift.apache.org>"
|
||||
|
|
3
vendor/git.apache.org/thrift.git/build/appveyor/MSVC-appveyor-build.bat
generated
vendored
3
vendor/git.apache.org/thrift.git/build/appveyor/MSVC-appveyor-build.bat
generated
vendored
|
@ -21,8 +21,6 @@ CALL cl_setenv.bat || EXIT /B
|
|||
MKDIR "%BUILDDIR%" || EXIT /B
|
||||
CD "%BUILDDIR%" || EXIT /B
|
||||
|
||||
:: Haskell is disabled for cmake (Windows), see Jira THRIFT-4545
|
||||
|
||||
@ECHO ON
|
||||
cmake "%SRCDIR%" ^
|
||||
-G"%GENERATOR%" ^
|
||||
|
@ -38,7 +36,6 @@ CD "%BUILDDIR%" || EXIT /B
|
|||
-DOPENSSL_USE_STATIC_LIBS=OFF ^
|
||||
-DZLIB_LIBRARY="%WIN3P%\zlib-inst\lib\zlib%ZLIB_LIB_SUFFIX%.lib" ^
|
||||
-DZLIB_ROOT="%WIN3P%\zlib-inst" ^
|
||||
-DWITH_HASKELL=OFF ^
|
||||
-DWITH_PYTHON=%WITH_PYTHON% ^
|
||||
-DWITH_%THREADMODEL%THREADS=ON ^
|
||||
-DWITH_SHARED_LIB=OFF ^
|
||||
|
|
15
vendor/git.apache.org/thrift.git/build/appveyor/MSVC-appveyor-install.bat
generated
vendored
15
vendor/git.apache.org/thrift.git/build/appveyor/MSVC-appveyor-install.bat
generated
vendored
|
@ -31,14 +31,14 @@ choco feature enable -n allowGlobalConfirmation || EXIT /B
|
|||
:: Things to install when NOT running in appveyor:
|
||||
IF "%APPVEYOR_BUILD_ID%" == "" (
|
||||
cup -y chocolatey || EXIT /B
|
||||
cinst -c "%BUILDCACHE%" -y curl || EXIT /B
|
||||
cinst -c "%BUILDCACHE%" -y 7zip || EXIT /B
|
||||
cinst -c "%BUILDCACHE%" -y python3 || EXIT /B
|
||||
cinst -c "%BUILDCACHE%" -y openssl.light || EXIT /B
|
||||
cinst -y curl || EXIT /B
|
||||
cinst -y 7zip || EXIT /B
|
||||
cinst -y python3 || EXIT /B
|
||||
cinst -y openssl.light || EXIT /B
|
||||
)
|
||||
|
||||
cinst -c "%BUILDCACHE%" -y jdk8 || EXIT /B
|
||||
cinst -c "%BUILDCACHE%" -y winflexbison3 || EXIT /B
|
||||
cinst -y jdk8 || EXIT /B
|
||||
cinst -y winflexbison3 || EXIT /B
|
||||
|
||||
:: zlib - not available through chocolatey
|
||||
CD "%APPVEYOR_SCRIPTS%" || EXIT /B
|
||||
|
@ -56,5 +56,4 @@ pip.exe ^
|
|||
tornado ^
|
||||
twisted || EXIT /B
|
||||
|
||||
:: Haskell (GHC) and cabal (disabled: see Jira THRIFT-4545)
|
||||
:: cinst -c "%BUILDCACHE%" -y ghc || EXIT /B
|
||||
cinst -y ghc || EXIT /B
|
||||
|
|
1
vendor/git.apache.org/thrift.git/build/appveyor/cl_setenv.bat
generated
vendored
1
vendor/git.apache.org/thrift.git/build/appveyor/cl_setenv.bat
generated
vendored
|
@ -37,7 +37,6 @@ CALL cl_setcompiler.bat || EXIT /B
|
|||
CALL cl_setgenerator.bat || EXIT /B
|
||||
|
||||
SET APPVEYOR_SCRIPTS=%APPVEYOR_BUILD_FOLDER%\build\appveyor
|
||||
SET BUILDCACHE=%APPVEYOR_BUILD_FOLDER%\..\build\cache
|
||||
SET BUILDDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
|
||||
SET INSTDIR=%APPVEYOR_BUILD_FOLDER%\..\build\%PROFILE%\%PLATFORM%
|
||||
SET SRCDIR=%APPVEYOR_BUILD_FOLDER%
|
||||
|
|
1
vendor/git.apache.org/thrift.git/build/appveyor/cl_showenv.bat
generated
vendored
1
vendor/git.apache.org/thrift.git/build/appveyor/cl_showenv.bat
generated
vendored
|
@ -38,7 +38,6 @@ ECHO BASH = %BASH%
|
|||
ECHO BOOST_ROOT = %BOOST_ROOT%
|
||||
ECHO BOOST_INCLUDEDIR = %BOOST_INCLUDEDIR%
|
||||
ECHO BOOST_LIBRARYDIR = %BOOST_LIBRARYDIR%
|
||||
ECHO BUILDCACHE = %BUILDCACHE%
|
||||
ECHO BUILDDIR = %BUILDDIR%
|
||||
ECHO COMPILER = %COMPILER%
|
||||
ECHO GENERATOR = %GENERATOR%
|
||||
|
|
2
vendor/git.apache.org/thrift.git/build/cmake/DefineCMakeDefaults.cmake
generated
vendored
2
vendor/git.apache.org/thrift.git/build/cmake/DefineCMakeDefaults.cmake
generated
vendored
|
@ -35,7 +35,7 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
|
|||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
# Define the generic version of the libraries here
|
||||
set(GENERIC_LIB_VERSION "0.1.0")
|
||||
set(GENERIC_LIB_VERSION "0.12.0")
|
||||
set(GENERIC_LIB_SOVERSION "0")
|
||||
|
||||
# Set the default build type to release with debug info
|
||||
|
|
3
vendor/git.apache.org/thrift.git/build/cmake/DefinePlatformSpecifc.cmake
generated
vendored
3
vendor/git.apache.org/thrift.git/build/cmake/DefinePlatformSpecifc.cmake
generated
vendored
|
@ -61,9 +61,6 @@ if(MSVC)
|
|||
set(STATIC_POSTFIX "md" CACHE STRING "Set static library postfix" FORCE)
|
||||
endif(WITH_MT)
|
||||
|
||||
# Disable Windows.h definition of macros for min and max
|
||||
add_definitions("-DNOMINMAX")
|
||||
|
||||
# Disable boost auto linking pragmas - cmake includes the right files
|
||||
add_definitions("-DBOOST_ALL_NO_LIB")
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/build/docker/scripts/sca.sh
generated
vendored
2
vendor/git.apache.org/thrift.git/build/docker/scripts/sca.sh
generated
vendored
|
@ -39,7 +39,7 @@ cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/cpp/src lib/c
|
|||
cppcheck --force --quiet --inline-suppr --error-exitcode=1 -j2 lib/c_glib/src lib/c_glib/test test/c_glib/src tutorial/c_glib
|
||||
|
||||
# Python code style
|
||||
flake8 --ignore=E501 --exclude=lib/py/build lib/py
|
||||
flake8 --ignore=W504,E501 lib/py
|
||||
flake8 --exclude=tutorial/py/build tutorial/py
|
||||
# THRIFT-4371 : generated files are excluded because they haven't been scrubbed yet
|
||||
flake8 --ignore=E501 --exclude="*/gen-py*/*",test/py/build test/py
|
||||
|
|
10
vendor/git.apache.org/thrift.git/build/docker/ubuntu-bionic/Dockerfile
generated
vendored
10
vendor/git.apache.org/thrift.git/build/docker/ubuntu-bionic/Dockerfile
generated
vendored
|
@ -89,7 +89,7 @@ RUN apt-get install -y --no-install-recommends \
|
|||
`# csharp (mono) dependencies` \
|
||||
mono-devel
|
||||
|
||||
ENV SBCL_VERSION 1.4.9
|
||||
ENV SBCL_VERSION 1.4.12
|
||||
RUN \
|
||||
`# Common Lisp (sbcl) dependencies` \
|
||||
curl --version && \
|
||||
|
@ -101,8 +101,8 @@ RUN \
|
|||
cd .. && \
|
||||
rm -rf sbcl*
|
||||
|
||||
ENV D_VERSION 2.081.0
|
||||
ENV DMD_DEB dmd_2.081.0-0_amd64.deb
|
||||
ENV D_VERSION 2.082.1
|
||||
ENV DMD_DEB dmd_2.082.1-0_amd64.deb
|
||||
RUN \
|
||||
`# D dependencies` \
|
||||
wget -q http://downloads.dlang.org/releases/2.x/${D_VERSION}/${DMD_DEB} && \
|
||||
|
@ -140,9 +140,9 @@ RUN apt-get install -y --no-install-recommends \
|
|||
libglib2.0-dev
|
||||
|
||||
# golang
|
||||
ENV GOLANG_VERSION 1.10.3
|
||||
ENV GOLANG_VERSION 1.11.1
|
||||
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
|
||||
ENV GOLANG_DOWNLOAD_SHA256 fa1b0e45d3b647c252f51f5e1204aba049cde4af177ef9f2181f43004f901035
|
||||
ENV GOLANG_DOWNLOAD_SHA256 2871270d8ff0c8c69f161aaae42f9f28739855ff5c5204752a8d92a1c9f63993
|
||||
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz && \
|
||||
echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - && \
|
||||
tar -C /usr/local -xzf golang.tar.gz && \
|
||||
|
|
2
vendor/git.apache.org/thrift.git/compiler/cpp/CMakeLists.txt
generated
vendored
2
vendor/git.apache.org/thrift.git/compiler/cpp/CMakeLists.txt
generated
vendored
|
@ -113,7 +113,7 @@ THRIFT_ADD_COMPILER(xml "Enable compiler for XML" ON)
|
|||
# we also add the current binary directory for generated files
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} src)
|
||||
|
||||
if(NOT ${WITH_PLUGIN})
|
||||
if(NOT DEFINED WITH_PLUGIN OR NOT ${WITH_PLUGIN})
|
||||
list(APPEND thrift-compiler_SOURCES ${compiler_core})
|
||||
endif()
|
||||
|
||||
|
|
78
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
generated
vendored
78
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
generated
vendored
|
@ -1690,6 +1690,7 @@ void t_csharp_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#if SILVERLIGHT" << endl;
|
||||
indent(f_service_) << endl;
|
||||
}
|
||||
// Begin_
|
||||
indent(f_service_) << "public " << function_signature_async_begin(*f_iter, "Begin_") << endl;
|
||||
|
@ -1766,51 +1767,52 @@ void t_csharp_generator::generate_service_client(t_service* tservice) {
|
|||
indent(f_service_) << "#endif" << endl << endl;
|
||||
}
|
||||
|
||||
// "Normal" Synchronous invoke
|
||||
generate_csharp_doc(f_service_, *f_iter);
|
||||
indent(f_service_) << "public " << function_signature(*f_iter) << endl;
|
||||
scope_up(f_service_);
|
||||
|
||||
// silverlight invoke
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#if !SILVERLIGHT" << endl;
|
||||
indent(f_service_) << "send_" << funname << "(";
|
||||
indent(f_service_) << "#if SILVERLIGHT" << endl;
|
||||
|
||||
first = true;
|
||||
indent(f_service_) << "var asyncResult = Begin_" << funname << "(null, null";
|
||||
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
f_service_ << ", ";
|
||||
}
|
||||
f_service_ << normalize_name((*fld_iter)->get_name());
|
||||
f_service_ << ", " << normalize_name((*fld_iter)->get_name());
|
||||
}
|
||||
f_service_ << ");" << endl;
|
||||
|
||||
|
||||
if (!(*f_iter)->is_oneway()) {
|
||||
f_service_ << indent();
|
||||
if (!(*f_iter)->get_returntype()->is_void()) {
|
||||
f_service_ << "return ";
|
||||
}
|
||||
f_service_ << "recv_" << funname << "();" << endl;
|
||||
f_service_ << "End_" << funname << "(asyncResult);" << endl;
|
||||
}
|
||||
f_service_ << endl;
|
||||
|
||||
indent(f_service_) << "#else" << endl;
|
||||
}
|
||||
|
||||
// Silverlight synchronous invoke
|
||||
indent(f_service_) << "var asyncResult = Begin_" << funname << "(null, null";
|
||||
// synchronous invoke
|
||||
indent(f_service_) << "send_" << funname << "(";
|
||||
|
||||
first = true;
|
||||
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
|
||||
f_service_ << ", " << normalize_name((*fld_iter)->get_name());
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
f_service_ << ", ";
|
||||
}
|
||||
f_service_ << normalize_name((*fld_iter)->get_name());
|
||||
}
|
||||
f_service_ << ");" << endl;
|
||||
|
||||
|
||||
if (!(*f_iter)->is_oneway()) {
|
||||
f_service_ << indent();
|
||||
if (!(*f_iter)->get_returntype()->is_void()) {
|
||||
f_service_ << "return ";
|
||||
}
|
||||
f_service_ << "End_" << funname << "(asyncResult);" << endl;
|
||||
f_service_ << "recv_" << funname << "();" << endl;
|
||||
}
|
||||
f_service_ << endl;
|
||||
|
||||
|
@ -1829,12 +1831,8 @@ void t_csharp_generator::generate_service_client(t_service* tservice) {
|
|||
if (!async_) {
|
||||
indent(f_service_) << "#if SILVERLIGHT" << endl;
|
||||
}
|
||||
|
||||
indent(f_service_) << "public " << function_signature_async_begin(&send_function) << endl;
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#else" << endl;
|
||||
indent(f_service_) << "public " << function_signature(&send_function) << endl;
|
||||
indent(f_service_) << "#endif" << endl;
|
||||
}
|
||||
scope_up(f_service_);
|
||||
|
||||
f_service_ << indent() << "oprot_.WriteMessageBegin(new TMessage(\"" << funname << "\", "
|
||||
|
@ -1849,20 +1847,40 @@ void t_csharp_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
f_service_ << indent() << "args.Write(oprot_);" << endl << indent()
|
||||
<< "oprot_.WriteMessageEnd();" << endl;
|
||||
;
|
||||
indent(f_service_) << "return oprot_.Transport.BeginFlush(callback, state);" << endl;
|
||||
|
||||
scope_down(f_service_);
|
||||
f_service_ << endl;
|
||||
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#if SILVERLIGHT" << endl;
|
||||
}
|
||||
indent(f_service_) << "return oprot_.Transport.BeginFlush(callback, state);" << endl;
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#else" << endl;
|
||||
indent(f_service_) << "oprot_.Transport.Flush();" << endl;
|
||||
f_service_ << endl;
|
||||
}
|
||||
|
||||
indent(f_service_) << "public " << function_signature(&send_function) << endl;
|
||||
scope_up(f_service_);
|
||||
|
||||
f_service_ << indent() << "oprot_.WriteMessageBegin(new TMessage(\"" << funname << "\", "
|
||||
<< ((*f_iter)->is_oneway() ? "TMessageType.Oneway" : "TMessageType.Call")
|
||||
<< ", seqid_));" << endl << indent() << argsname << " args = new " << argsname
|
||||
<< "();" << endl;
|
||||
|
||||
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
|
||||
f_service_ << indent() << "args." << prop_name(*fld_iter) << " = "
|
||||
<< normalize_name((*fld_iter)->get_name()) << ";" << endl;
|
||||
}
|
||||
|
||||
f_service_ << indent() << "args.Write(oprot_);" << endl << indent()
|
||||
<< "oprot_.WriteMessageEnd();" << endl;
|
||||
|
||||
indent(f_service_) << "oprot_.Transport.Flush();" << endl;
|
||||
cleanup_member_name_mapping(arg_struct);
|
||||
scope_down(f_service_);
|
||||
|
||||
if (!async_) {
|
||||
indent(f_service_) << "#endif" << endl;
|
||||
}
|
||||
|
||||
cleanup_member_name_mapping(arg_struct);
|
||||
scope_down(f_service_);
|
||||
f_service_ << endl;
|
||||
|
||||
if (!(*f_iter)->is_oneway()) {
|
||||
|
|
4
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_go_generator.cc
generated
vendored
4
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_go_generator.cc
generated
vendored
|
@ -61,7 +61,7 @@ static const string endl = "\n"; // avoid ostream << std::endl flushes
|
|||
*/
|
||||
bool format_go_output(const string& file_path);
|
||||
|
||||
const string DEFAULT_THRIFT_IMPORT = "git.apache.org/thrift.git/lib/go/thrift";
|
||||
const string DEFAULT_THRIFT_IMPORT = "github.com/apache/thrift/lib/go/thrift";
|
||||
static std::string package_flag;
|
||||
|
||||
/**
|
||||
|
@ -1323,7 +1323,7 @@ void t_go_generator::generate_go_struct_definition(ostream& out,
|
|||
if (tstruct->is_union())
|
||||
(*m_iter)->set_req(t_field::T_OPTIONAL);
|
||||
if (sorted_keys_pos != (*m_iter)->get_key()) {
|
||||
int first_unused = std::max(1, sorted_keys_pos++);
|
||||
int first_unused = (std::max)(1, sorted_keys_pos++);
|
||||
while (sorted_keys_pos != (*m_iter)->get_key()) {
|
||||
++sorted_keys_pos;
|
||||
}
|
||||
|
|
10
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_java_generator.cc
generated
vendored
10
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_java_generator.cc
generated
vendored
|
@ -498,6 +498,11 @@ void t_java_generator::generate_enum(t_enum* tenum) {
|
|||
f_enum << autogen_comment() << java_package() << endl;
|
||||
|
||||
generate_java_doc(f_enum, tenum);
|
||||
|
||||
if (!suppress_generated_annotations_) {
|
||||
generate_javax_generated_annotation(f_enum);
|
||||
}
|
||||
|
||||
if (is_deprecated) {
|
||||
indent(f_enum) << "@Deprecated" << endl;
|
||||
}
|
||||
|
@ -544,6 +549,7 @@ void t_java_generator::generate_enum(t_enum* tenum) {
|
|||
<< endl;
|
||||
indent(f_enum) << " * @return null if the value is not found." << endl;
|
||||
indent(f_enum) << " */" << endl;
|
||||
indent(f_enum) << java_nullable_annotation() << endl;
|
||||
indent(f_enum) << "public static " + tenum->get_name() + " findByValue(int value) { " << endl;
|
||||
|
||||
indent_up();
|
||||
|
@ -827,6 +833,10 @@ void t_java_generator::generate_java_union(t_struct* tstruct) {
|
|||
bool is_final = (tstruct->annotations_.find("final") != tstruct->annotations_.end());
|
||||
bool is_deprecated = this->is_deprecated(tstruct->annotations_);
|
||||
|
||||
if (!suppress_generated_annotations_) {
|
||||
generate_javax_generated_annotation(f_struct);
|
||||
}
|
||||
|
||||
if (is_deprecated) {
|
||||
indent(f_struct) << "@Deprecated" << endl;
|
||||
}
|
||||
|
|
569
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_js_generator.cc
generated
vendored
569
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_js_generator.cc
generated
vendored
|
@ -64,7 +64,7 @@ public:
|
|||
|
||||
bool with_ns_ = false;
|
||||
|
||||
for( iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
|
||||
for (iter = parsed_options.begin(); iter != parsed_options.end(); ++iter) {
|
||||
if( iter->first.compare("node") == 0) {
|
||||
gen_node_ = true;
|
||||
} else if( iter->first.compare("jquery") == 0) {
|
||||
|
@ -80,10 +80,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
if (gen_node_ && gen_ts_) {
|
||||
throw "Invalid switch: [-gen js:node,ts] options not compatible";
|
||||
}
|
||||
|
||||
if (gen_es6_ && gen_jquery_) {
|
||||
throw "Invalid switch: [-gen js:es6,jquery] options not compatible";
|
||||
}
|
||||
|
@ -203,6 +199,7 @@ public:
|
|||
*/
|
||||
|
||||
std::string js_includes();
|
||||
std::string ts_includes();
|
||||
std::string render_includes();
|
||||
std::string declare_field(t_field* tfield, bool init = false, bool obj = false);
|
||||
std::string function_signature(t_function* tfunction,
|
||||
|
@ -285,7 +282,7 @@ public:
|
|||
* TypeScript Definition File helper functions
|
||||
*/
|
||||
|
||||
string ts_function_signature(t_function* tfunction, bool include_callback);
|
||||
string ts_function_signature(t_function* tfunction, bool include_callback, bool optional_callback);
|
||||
string ts_get_type(t_type* type);
|
||||
|
||||
/**
|
||||
|
@ -302,11 +299,11 @@ public:
|
|||
string ts_declare() { return (ts_module_.empty() ? "declare " : ""); }
|
||||
|
||||
/**
|
||||
* Returns "?" if the given field is optional.
|
||||
* Returns "?" if the given field is optional or has a default value.
|
||||
* @param t_field The field to check
|
||||
* @return string
|
||||
*/
|
||||
string ts_get_req(t_field* field) { return (field->get_req() == t_field::T_OPTIONAL ? "?" : ""); }
|
||||
string ts_get_req(t_field* field) {return (field->get_req() == t_field::T_OPTIONAL || field->get_value() != NULL ? "?" : ""); }
|
||||
|
||||
/**
|
||||
* Returns the documentation, if the provided documentable object has one.
|
||||
|
@ -415,7 +412,7 @@ void t_js_generator::init_generator() {
|
|||
f_types_ << js_includes() << endl << render_includes() << endl;
|
||||
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << autogen_comment() << endl;
|
||||
f_types_ts_ << autogen_comment() << ts_includes() << endl;
|
||||
}
|
||||
|
||||
if (gen_node_) {
|
||||
|
@ -457,6 +454,20 @@ string t_js_generator::js_includes() {
|
|||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints standard ts imports
|
||||
*/
|
||||
string t_js_generator::ts_includes() {
|
||||
if (gen_node_) {
|
||||
return string(
|
||||
"import thrift = require('thrift');\n"
|
||||
"import Thrift = thrift.Thrift;\n"
|
||||
"import Q = thrift.Q;\n");
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all the imports necessary for including another Thrift program
|
||||
*/
|
||||
|
@ -518,8 +529,8 @@ void t_js_generator::generate_enum(t_enum* tenum) {
|
|||
|
||||
indent_up();
|
||||
|
||||
vector<t_enum_value*> constants = tenum->get_constants();
|
||||
vector<t_enum_value*>::iterator c_iter;
|
||||
vector<t_enum_value*> const& constants = tenum->get_constants();
|
||||
vector<t_enum_value*>::const_iterator c_iter;
|
||||
for (c_iter = constants.begin(); c_iter != constants.end(); ++c_iter) {
|
||||
int value = (*c_iter)->get_value();
|
||||
if (gen_ts_) {
|
||||
|
@ -718,16 +729,15 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
|
|||
|
||||
if (gen_node_) {
|
||||
string prefix = has_js_namespace(tstruct->get_program()) ? js_namespace(tstruct->get_program()) : js_const_type_;
|
||||
if (is_exported) {
|
||||
out << prefix << tstruct->get_name() << " = "
|
||||
<< "module.exports." << tstruct->get_name() << " = function(args) {" << endl;
|
||||
} else {
|
||||
out << prefix << tstruct->get_name() << " = function(args) {"
|
||||
<< endl;
|
||||
out << prefix << tstruct->get_name() <<
|
||||
(is_exported ? " = module.exports." + tstruct->get_name() : "");
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << ts_print_doc(tstruct) << ts_indent() << ts_declare() << "class "
|
||||
<< tstruct->get_name() << (is_exception ? " extends Thrift.TException" : "")
|
||||
<< " {" << endl;
|
||||
}
|
||||
} else {
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name() << " = function(args) {"
|
||||
<< endl;
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name();
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << ts_print_doc(tstruct) << ts_indent() << ts_declare() << "class "
|
||||
<< tstruct->get_name() << (is_exception ? " extends Thrift.TException" : "")
|
||||
|
@ -735,11 +745,28 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
|
|||
}
|
||||
}
|
||||
|
||||
if (gen_es6_) {
|
||||
if (gen_node_ && is_exception) {
|
||||
out << " = class extends Thrift.TException {" << endl;
|
||||
} else {
|
||||
out << " = class {" << endl;
|
||||
}
|
||||
indent_up();
|
||||
indent(out) << "constructor(args) {" << endl;
|
||||
} else {
|
||||
out << " = function(args) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
// Call super() method on inherited Error class
|
||||
if (gen_node_ && is_exception) {
|
||||
out << indent() << "Thrift.TException.call(this, \"" << js_namespace(tstruct->get_program())
|
||||
if (gen_es6_) {
|
||||
indent(out) << "super(args);" << endl;
|
||||
} else {
|
||||
indent(out) << "Thrift.TException.call(this, \"" << js_namespace(tstruct->get_program())
|
||||
<< tstruct->get_name() << "\");" << endl;
|
||||
}
|
||||
out << indent() << "this.name = \"" << js_namespace(tstruct->get_program())
|
||||
<< tstruct->get_name() << "\";" << endl;
|
||||
}
|
||||
|
@ -755,8 +782,14 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
|
|||
out << indent() << dval << ";" << endl;
|
||||
}
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << ts_indent() << (*m_iter)->get_name() << ": "
|
||||
<< ts_get_type((*m_iter)->get_type()) << ";" << endl;
|
||||
if (gen_node_) {
|
||||
f_types_ts_ << ts_indent() << "public " << (*m_iter)->get_name() << ": "
|
||||
<< ts_get_type((*m_iter)->get_type()) << ";" << endl;
|
||||
} else {
|
||||
f_types_ts_ << ts_indent() << (*m_iter)->get_name() << ": "
|
||||
<< ts_get_type((*m_iter)->get_type()) << ";" << endl;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -782,15 +815,17 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
|
|||
}
|
||||
}
|
||||
|
||||
out << indent() << "if (args) {" << endl;
|
||||
indent(out) << "if (args) {" << endl;
|
||||
indent_up();
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << endl << ts_indent() << "constructor(args?: { ";
|
||||
}
|
||||
|
||||
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
|
||||
t_type* t = get_true_type((*m_iter)->get_type());
|
||||
out << indent() << indent() << "if (args." << (*m_iter)->get_name() << " !== undefined && args." << (*m_iter)->get_name() << " !== null) {"
|
||||
<< endl << indent() << indent() << indent() << "this." << (*m_iter)->get_name();
|
||||
indent(out) << "if (args." << (*m_iter)->get_name() << " !== undefined && args." << (*m_iter)->get_name() << " !== null) {" << endl;
|
||||
indent_up();
|
||||
indent(out) << "this." << (*m_iter)->get_name();
|
||||
|
||||
if (t->is_struct()) {
|
||||
out << (" = new " + js_type_namespace(t->get_program()) + t->get_name() +
|
||||
|
@ -829,43 +864,60 @@ void t_js_generator::generate_js_struct_definition(ostream& out,
|
|||
out << " = args." << (*m_iter)->get_name() << ";" << endl;
|
||||
}
|
||||
|
||||
indent_down();
|
||||
if (!(*m_iter)->get_req()) {
|
||||
out << indent() << indent() << "} else {" << endl << indent() << indent() << indent()
|
||||
<< "throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, "
|
||||
indent(out) << "} else {" << endl;
|
||||
indent(out)
|
||||
<< " throw new Thrift.TProtocolException(Thrift.TProtocolExceptionType.UNKNOWN, "
|
||||
"'Required field " << (*m_iter)->get_name() << " is unset!');" << endl;
|
||||
}
|
||||
out << indent() << indent() << "}" << endl;
|
||||
indent(out) << "}" << endl;
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << (*m_iter)->get_name() << ts_get_req(*m_iter) << ": "
|
||||
<< ts_get_type((*m_iter)->get_type()) << "; ";
|
||||
}
|
||||
}
|
||||
|
||||
indent_down();
|
||||
out << indent() << "}" << endl;
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << "});" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Done with constructor
|
||||
indent_down();
|
||||
out << "};" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(out) << "}" << endl << endl;
|
||||
} else {
|
||||
indent(out) << "};" << endl;
|
||||
}
|
||||
|
||||
if (gen_ts_) {
|
||||
f_types_ts_ << ts_indent() << "}" << endl;
|
||||
}
|
||||
|
||||
if (is_exception) {
|
||||
out << "Thrift.inherits(" << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ", Thrift.TException);" << endl;
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name() << ".prototype.name = '"
|
||||
<< tstruct->get_name() << "';" << endl;
|
||||
} else {
|
||||
// init prototype
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name() << ".prototype = {};"
|
||||
<< endl;
|
||||
if (!gen_es6_) {
|
||||
if (is_exception) {
|
||||
out << "Thrift.inherits(" << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ", Thrift.TException);" << endl;
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name() << ".prototype.name = '"
|
||||
<< tstruct->get_name() << "';" << endl;
|
||||
} else {
|
||||
// init prototype manually if we aren't using es6
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name() << ".prototype = {};"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
generate_js_struct_reader(out, tstruct);
|
||||
generate_js_struct_writer(out, tstruct);
|
||||
|
||||
// Close out the class definition
|
||||
if (gen_es6_) {
|
||||
indent_down();
|
||||
indent(out) << "};" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -875,8 +927,12 @@ void t_js_generator::generate_js_struct_reader(ostream& out, t_struct* tstruct)
|
|||
const vector<t_field*>& fields = tstruct->get_members();
|
||||
vector<t_field*>::const_iterator f_iter;
|
||||
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ".prototype.read = function(input) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(out) << "read (input) {" << endl;
|
||||
} else {
|
||||
indent(out) << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ".prototype.read = function(input) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
|
@ -945,7 +1001,12 @@ void t_js_generator::generate_js_struct_reader(ostream& out, t_struct* tstruct)
|
|||
indent(out) << "return;" << endl;
|
||||
|
||||
indent_down();
|
||||
out << indent() << "};" << endl << endl;
|
||||
|
||||
if (gen_es6_) {
|
||||
indent(out) << "}" << endl << endl;
|
||||
} else {
|
||||
indent(out) << "};" << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -956,8 +1017,12 @@ void t_js_generator::generate_js_struct_writer(ostream& out, t_struct* tstruct)
|
|||
const vector<t_field*>& fields = tstruct->get_members();
|
||||
vector<t_field*>::const_iterator f_iter;
|
||||
|
||||
out << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ".prototype.write = function(output) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(out) << "write (output) {" << endl;
|
||||
} else {
|
||||
indent(out) << js_namespace(tstruct->get_program()) << tstruct->get_name()
|
||||
<< ".prototype.write = function(output) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
|
@ -987,7 +1052,11 @@ void t_js_generator::generate_js_struct_writer(ostream& out, t_struct* tstruct)
|
|||
out << indent() << "return;" << endl;
|
||||
|
||||
indent_down();
|
||||
out << indent() << "};" << endl << endl;
|
||||
if (gen_es6_) {
|
||||
out << indent() << "}" << endl << endl;
|
||||
} else {
|
||||
out << indent() << "};" << endl << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1018,6 +1087,39 @@ void t_js_generator::generate_service(t_service* tservice) {
|
|||
<< ".d.ts\" />" << endl;
|
||||
}
|
||||
f_service_ts_ << autogen_comment() << endl;
|
||||
if (gen_node_) {
|
||||
f_service_ts_ << ts_includes() << endl;
|
||||
f_service_ts_ << "import ttypes = require('./" + program_->get_name() + "_types');" << endl;
|
||||
// Generate type aliases
|
||||
// enum
|
||||
vector<t_enum*> const& enums = program_->get_enums();
|
||||
vector<t_enum*>::const_iterator e_iter;
|
||||
for (e_iter = enums.begin(); e_iter != enums.end(); ++e_iter) {
|
||||
f_service_ts_ << "import " << (*e_iter)->get_name() << " = ttypes."
|
||||
<< js_namespace(program_) << (*e_iter)->get_name() << endl;
|
||||
}
|
||||
// const
|
||||
vector<t_const*> const& consts = program_->get_consts();
|
||||
vector<t_const*>::const_iterator c_iter;
|
||||
for (c_iter = consts.begin(); c_iter != consts.end(); ++c_iter) {
|
||||
f_service_ts_ << "import " << (*c_iter)->get_name() << " = ttypes."
|
||||
<< js_namespace(program_) << (*c_iter)->get_name() << endl;
|
||||
}
|
||||
// exception
|
||||
vector<t_struct*> const& exceptions = program_->get_xceptions();
|
||||
vector<t_struct*>::const_iterator x_iter;
|
||||
for (x_iter = exceptions.begin(); x_iter != exceptions.end(); ++x_iter) {
|
||||
f_service_ts_ << "import " << (*x_iter)->get_name() << " = ttypes."
|
||||
<< js_namespace(program_) << (*x_iter)->get_name() << endl;
|
||||
}
|
||||
// structs
|
||||
vector<t_struct*> const& structs = program_->get_structs();
|
||||
vector<t_struct*>::const_iterator s_iter;
|
||||
for (s_iter = structs.begin(); s_iter != structs.end(); ++s_iter) {
|
||||
f_service_ts_ << "import " << (*s_iter)->get_name() << " = ttypes."
|
||||
<< js_namespace(program_) << (*s_iter)->get_name() << endl;
|
||||
}
|
||||
}
|
||||
if (!ts_module_.empty()) {
|
||||
f_service_ts_ << "declare module " << ts_module_ << " {";
|
||||
}
|
||||
|
@ -1064,26 +1166,67 @@ void t_js_generator::generate_service_processor(t_service* tservice) {
|
|||
|
||||
if (gen_node_) {
|
||||
string prefix = has_js_namespace(tservice->get_program()) ? js_namespace(tservice->get_program()) : js_const_type_;
|
||||
f_service_ << prefix << service_name_ << "Processor = " << "exports.Processor = function(handler) {" << endl;
|
||||
f_service_ << prefix << service_name_ << "Processor = " << "exports.Processor";
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << endl << "declare class Processor ";
|
||||
if (tservice->get_extends() != NULL) {
|
||||
f_service_ts_ << "extends " << tservice->get_extends()->get_name() << "Processor ";
|
||||
}
|
||||
f_service_ts_ << "{" << endl;
|
||||
indent_up();
|
||||
f_service_ts_ << ts_indent() << "private _handler: Object;" << endl << endl;
|
||||
f_service_ts_ << ts_indent() << "constructor(handler: Object);" << endl;
|
||||
f_service_ts_ << ts_indent() << "process(input: Thrift.TJSONProtocol, output: Thrift.TJSONProtocol): void;" << endl;
|
||||
indent_down();
|
||||
}
|
||||
} else {
|
||||
f_service_ << js_namespace(tservice->get_program()) << service_name_ << "Processor = "
|
||||
<< "exports.Processor = function(handler) {" << endl;
|
||||
<< "exports.Processor";
|
||||
}
|
||||
|
||||
bool is_subclass_service = tservice->get_extends() != NULL;
|
||||
|
||||
// ES6 Constructor
|
||||
if (gen_es6_) {
|
||||
if (is_subclass_service) {
|
||||
f_service_ << " = class extends " << tservice->get_extends()->get_name() << "Processor {" << endl;
|
||||
} else {
|
||||
f_service_ << " = class {" << endl;
|
||||
}
|
||||
indent_up();
|
||||
indent(f_service_) << "constructor(handler) {" << endl;
|
||||
} else {
|
||||
f_service_ << " = function(handler) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
if (gen_es6_ && is_subclass_service) {
|
||||
indent(f_service_) << "super(handler);" << endl;
|
||||
}
|
||||
indent(f_service_) << "this._handler = handler;" << endl;
|
||||
indent_down();
|
||||
f_service_ << "};" << endl;
|
||||
|
||||
if (tservice->get_extends() != NULL) {
|
||||
// Done with constructor
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
|
||||
// ES5 service inheritance
|
||||
if (!gen_es6_ && is_subclass_service) {
|
||||
indent(f_service_) << "Thrift.inherits(" << js_namespace(tservice->get_program())
|
||||
<< service_name_ << "Processor, " << tservice->get_extends()->get_name()
|
||||
<< "Processor);" << endl;
|
||||
}
|
||||
|
||||
// Generate the server implementation
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Processor.prototype.process = function(input, output) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "process (input, output) {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Processor.prototype.process = function(input, output) {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
|
@ -1101,12 +1244,25 @@ void t_js_generator::generate_service_processor(t_service* tservice) {
|
|||
<< indent() << "}" << endl;
|
||||
|
||||
indent_down();
|
||||
f_service_ << "};" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
|
||||
// Generate the process subfunctions
|
||||
for (f_iter = functions.begin(); f_iter != functions.end(); ++f_iter) {
|
||||
generate_process_function(tservice, *f_iter);
|
||||
}
|
||||
|
||||
// Close off the processor class definition
|
||||
if (gen_es6_) {
|
||||
indent_down();
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
if (gen_node_ && gen_ts_) {
|
||||
f_service_ts_ << "}" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1115,9 +1271,18 @@ void t_js_generator::generate_service_processor(t_service* tservice) {
|
|||
* @param tfunction The function to write a dispatcher for
|
||||
*/
|
||||
void t_js_generator::generate_process_function(t_service* tservice, t_function* tfunction) {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Processor.prototype.process_" + tfunction->get_name()
|
||||
+ " = function(seqid, input, output) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "process_" + tfunction->get_name() + " (seqid, input, output) {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Processor.prototype.process_" + tfunction->get_name()
|
||||
+ " = function(seqid, input, output) {" << endl;
|
||||
}
|
||||
if (gen_ts_) {
|
||||
indent_up();
|
||||
f_service_ts_ << ts_indent() << "process_" << tfunction->get_name() << "(seqid: number, input: Thrift.TJSONProtocol, output: Thrift.TJSONProtocol): void;" << endl;
|
||||
indent_down();
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
|
@ -1149,10 +1314,16 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
|
||||
f_service_ << ");" << endl;
|
||||
indent_down();
|
||||
f_service_ << "};" << endl;
|
||||
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Promise style invocation
|
||||
indent(f_service_) << "if (this._handler." << tfunction->get_name()
|
||||
<< ".length === " << fields.size() << ") {" << endl;
|
||||
indent_up();
|
||||
|
@ -1173,7 +1344,7 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
indent_down();
|
||||
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << ")).then(function(result) {" << endl;
|
||||
indent(f_service_) << ")).then(result => {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << ").then(function(result) {" << endl;
|
||||
}
|
||||
|
@ -1186,7 +1357,11 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
<< indent() << "output.flush();" << endl;
|
||||
indent_down();
|
||||
|
||||
indent(f_service_) << "}).catch(function (err) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}).catch(err => {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "}).catch(function (err) {" << endl;
|
||||
}
|
||||
indent_up();
|
||||
indent(f_service_) << js_let_type_ << "result;" << endl;
|
||||
|
||||
|
@ -1236,6 +1411,9 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
indent_down();
|
||||
indent(f_service_) << "});" << endl;
|
||||
indent_down();
|
||||
// End promise style invocation
|
||||
|
||||
// Callback style invocation
|
||||
indent(f_service_) << "} else {" << endl;
|
||||
indent_up();
|
||||
indent(f_service_) << "this._handler." << tfunction->get_name() << "(";
|
||||
|
@ -1244,7 +1422,11 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
f_service_ << "args." << (*f_iter)->get_name() << ", ";
|
||||
}
|
||||
|
||||
f_service_ << "function (err, result) {" << endl;
|
||||
if (gen_es6_) {
|
||||
f_service_ << "(err, result) => {" << endl;
|
||||
} else {
|
||||
f_service_ << "function (err, result) {" << endl;
|
||||
}
|
||||
indent_up();
|
||||
indent(f_service_) << js_let_type_ << "result_obj;" << endl;
|
||||
|
||||
|
@ -1279,8 +1461,15 @@ void t_js_generator::generate_process_function(t_service* tservice, t_function*
|
|||
indent(f_service_) << "});" << endl;
|
||||
indent_down();
|
||||
indent(f_service_) << "}" << endl;
|
||||
// End callback style invocation
|
||||
|
||||
indent_down();
|
||||
indent(f_service_) << "};" << endl;
|
||||
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1354,33 +1543,73 @@ void t_js_generator::generate_service_rest(t_service* tservice) {
|
|||
* @param tservice The service to generate a server for.
|
||||
*/
|
||||
void t_js_generator::generate_service_client(t_service* tservice) {
|
||||
|
||||
bool is_subclass_service = tservice->get_extends() != NULL;
|
||||
|
||||
if (gen_node_) {
|
||||
string prefix = has_js_namespace(tservice->get_program()) ? js_namespace(tservice->get_program()) : js_const_type_;
|
||||
f_service_ << prefix << service_name_ << "Client = "
|
||||
<< "exports.Client = function(output, pClass) {" << endl;
|
||||
f_service_ << prefix << service_name_ << "Client = " << "exports.Client";
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << ts_print_doc(tservice) << ts_indent() << ts_declare() << "class "
|
||||
<< "Client ";
|
||||
if (tservice->get_extends() != NULL) {
|
||||
f_service_ts_ << "extends " << tservice->get_extends()->get_name() << "Client ";
|
||||
}
|
||||
f_service_ts_ << "{" << endl;
|
||||
}
|
||||
} else {
|
||||
f_service_ << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client = function(input, output) {" << endl;
|
||||
<< "Client";
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << ts_print_doc(tservice) << ts_indent() << ts_declare() << "class "
|
||||
<< service_name_ << "Client ";
|
||||
if (tservice->get_extends() != NULL) {
|
||||
if (is_subclass_service) {
|
||||
f_service_ts_ << "extends " << tservice->get_extends()->get_name() << "Client ";
|
||||
}
|
||||
f_service_ts_ << "{" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// ES6 Constructor
|
||||
if (gen_es6_) {
|
||||
if (is_subclass_service) {
|
||||
f_service_ << " = class extends " << js_namespace(tservice->get_extends()->get_program())
|
||||
<< tservice->get_extends()->get_name() << "Client {" << endl;
|
||||
} else {
|
||||
f_service_ << " = class {" << endl;
|
||||
}
|
||||
indent_up();
|
||||
if (gen_node_) {
|
||||
indent(f_service_) << "constructor(output, pClass) {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "constructor(input, output) {" << endl;
|
||||
}
|
||||
} else {
|
||||
if (gen_node_) {
|
||||
f_service_ << " = function(output, pClass) {" << endl;
|
||||
} else {
|
||||
f_service_ << " = function(input, output) {" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
if (gen_node_) {
|
||||
f_service_ << indent() << " this.output = output;" << endl << indent()
|
||||
<< " this.pClass = pClass;" << endl << indent() << " this._seqid = 0;" << endl
|
||||
<< indent() << " this._reqs = {};" << endl;
|
||||
indent(f_service_) << "this.output = output;" << endl;
|
||||
indent(f_service_) << "this.pClass = pClass;" << endl;
|
||||
indent(f_service_) << "this._seqid = 0;" << endl;
|
||||
indent(f_service_) << "this._reqs = {};" << endl;
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << ts_indent() << "private input: Thrift.TJSONProtocol;" << endl << ts_indent()
|
||||
<< "private output: Thrift.TJSONProtocol;" << endl << ts_indent() << "private seqid: number;"
|
||||
<< endl << endl << ts_indent()
|
||||
<< "constructor(input: Thrift.TJSONProtocol, output?: Thrift.TJSONProtocol);"
|
||||
<< endl;
|
||||
}
|
||||
} else {
|
||||
f_service_ << indent() << " this.input = input;" << endl << indent()
|
||||
<< " this.output = (!output) ? input : output;" << endl << indent()
|
||||
<< " this.seqid = 0;" << endl;
|
||||
indent(f_service_) << "this.input = input;" << endl;
|
||||
indent(f_service_) << "this.output = (!output) ? input : output;" << endl;
|
||||
indent(f_service_) << "this.seqid = 0;" << endl;
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << ts_indent() << "input: Thrift.TJSONProtocol;" << endl << ts_indent()
|
||||
<< "output: Thrift.TJSONProtocol;" << endl << ts_indent() << "seqid: number;"
|
||||
|
@ -1392,27 +1621,36 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
indent_down();
|
||||
|
||||
f_service_ << indent() << "};" << endl;
|
||||
|
||||
if (tservice->get_extends() != NULL) {
|
||||
indent(f_service_) << "Thrift.inherits(" << js_namespace(tservice->get_program())
|
||||
<< service_name_ << "Client, "
|
||||
<< js_namespace(tservice->get_extends()->get_program())
|
||||
<< tservice->get_extends()->get_name() << "Client);" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
// init prototype
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype = {};" << endl;
|
||||
indent(f_service_) << "};" << endl;
|
||||
if (is_subclass_service) {
|
||||
indent(f_service_) << "Thrift.inherits(" << js_namespace(tservice->get_program())
|
||||
<< service_name_ << "Client, "
|
||||
<< js_namespace(tservice->get_extends()->get_program())
|
||||
<< tservice->get_extends()->get_name() << "Client);" << endl;
|
||||
} else {
|
||||
// init prototype
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype = {};" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
// utils for multiplexed services
|
||||
if (gen_node_) {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.seqid = function() { return this._seqid; };" << endl
|
||||
<< js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.new_seqid = function() { return this._seqid += 1; };"
|
||||
<< endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "seqid () { return this._seqid; }" << endl;
|
||||
indent(f_service_) << "new_seqid () { return this._seqid += 1; }" << endl;
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.seqid = function() { return this._seqid; };" << endl
|
||||
<< js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.new_seqid = function() { return this._seqid += 1; };"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate client method implementations
|
||||
vector<t_function*> functions = tservice->get_functions();
|
||||
vector<t_function*>::const_iterator f_iter;
|
||||
|
@ -1424,42 +1662,41 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
string arglist = argument_list(arg_struct);
|
||||
|
||||
// Open function
|
||||
f_service_ << js_namespace(tservice->get_program()) << service_name_ << "Client.prototype."
|
||||
<< function_signature(*f_iter, "", !gen_es6_) << " {" << endl;
|
||||
f_service_ << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << funname << " (" << arglist << ") {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_ << "Client.prototype."
|
||||
<< function_signature(*f_iter, "", !gen_es6_) << " {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
if (gen_ts_) {
|
||||
// function definition without callback
|
||||
f_service_ts_ << ts_print_doc(*f_iter) << ts_indent() << ts_function_signature(*f_iter, false) << endl;
|
||||
|
||||
f_service_ts_ << ts_print_doc(*f_iter) << ts_indent() << ts_function_signature(*f_iter, false, false) << endl;
|
||||
if (!gen_es6_) {
|
||||
// overload with callback
|
||||
f_service_ts_ << ts_print_doc(*f_iter) << ts_indent() << ts_function_signature(*f_iter, true) << endl;
|
||||
f_service_ts_ << ts_print_doc(*f_iter) << ts_indent() << ts_function_signature(*f_iter, true, false) << endl;
|
||||
} else {
|
||||
// overload with callback
|
||||
f_service_ts_ << ts_print_doc(*f_iter) << ts_indent() << ts_function_signature(*f_iter, true, true) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (gen_es6_ && gen_node_) {
|
||||
f_service_ << indent() << "this._seqid = this.new_seqid();" << endl;
|
||||
f_service_ << indent() << js_const_type_ << "self = this;" << endl << indent()
|
||||
<< "return new Promise(function(resolve, reject) {" << endl;
|
||||
indent(f_service_) << "this._seqid = this.new_seqid();" << endl;
|
||||
indent(f_service_) << js_const_type_ << "self = this;" << endl << indent()
|
||||
<< "return new Promise((resolve, reject) => {" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << "self._reqs[self.seqid()] = function(error, result) {" << endl;
|
||||
indent(f_service_) << "self._reqs[self.seqid()] = (error, result) => {" << endl;
|
||||
indent_up();
|
||||
indent(f_service_) << "if (error) {" << endl;
|
||||
indent_up();
|
||||
indent(f_service_) << "reject(error);" << endl;
|
||||
indent_down();
|
||||
indent(f_service_) << "} else {" << endl;
|
||||
indent_up();
|
||||
indent(f_service_) << "resolve(result);" << endl;
|
||||
indent_down();
|
||||
indent(f_service_) << "}" << endl;
|
||||
indent(f_service_) << "return error ? reject(error) : resolve(result);" << endl;
|
||||
indent_down();
|
||||
indent(f_service_) << "};" << endl;
|
||||
f_service_ << indent() << "self.send_" << funname << "(" << arglist << ");" << endl;
|
||||
indent(f_service_) << "self.send_" << funname << "(" << arglist << ");" << endl;
|
||||
indent_down();
|
||||
f_service_ << indent() << "});" << endl;
|
||||
indent(f_service_) << "});" << endl;
|
||||
} else if (gen_node_) { // Node.js output ./gen-nodejs
|
||||
f_service_ << indent() << "this._seqid = this.new_seqid();" << endl << indent()
|
||||
<< "if (callback === undefined) {" << endl;
|
||||
|
@ -1489,16 +1726,12 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
indent(f_service_) << "}" << endl;
|
||||
} else if (gen_es6_) {
|
||||
f_service_ << indent() << js_const_type_ << "self = this;" << endl << indent()
|
||||
<< "return new Promise(function(resolve, reject) {" << endl;
|
||||
<< "return new Promise((resolve, reject) => {" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << "self.send_" << funname << "(" << arglist
|
||||
<< (arglist.empty() ? "" : ", ") << "function(error, result) {" << endl;
|
||||
<< (arglist.empty() ? "" : ", ") << "(error, result) => {" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << "if (error) {" << endl;
|
||||
f_service_ << indent() << " reject(error);" << endl;
|
||||
f_service_ << indent() << "} else {" << endl;
|
||||
f_service_ << indent() << " resolve(result);" << endl;
|
||||
f_service_ << indent() << "}" << endl;
|
||||
indent(f_service_) << "return error ? reject(error) : resolve(result);" << endl;
|
||||
indent_down();
|
||||
f_service_ << indent() << "});" << endl;
|
||||
indent_down();
|
||||
|
@ -1543,11 +1776,24 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
indent_down();
|
||||
|
||||
f_service_ << "};" << endl << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl << endl;
|
||||
}
|
||||
|
||||
// Send function
|
||||
f_service_ << js_namespace(tservice->get_program()) << service_name_ << "Client.prototype.send_"
|
||||
<< function_signature(*f_iter, "", !gen_node_) << " {" << endl;
|
||||
if (gen_es6_) {
|
||||
if (gen_node_) {
|
||||
indent(f_service_) << "send_" << funname << " (" << arglist << ") {" << endl;
|
||||
} else {
|
||||
// ES6 js still uses callbacks here. Should refactor this to promise style later..
|
||||
indent(f_service_) << "send_" << funname << " (" << argument_list(arg_struct, true) << ") {" << endl;
|
||||
}
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_ << "Client.prototype.send_"
|
||||
<< function_signature(*f_iter, "", !gen_node_) << " {" << endl;
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
||||
|
@ -1567,23 +1813,25 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
// Build args
|
||||
if (fields.size() > 0){
|
||||
f_service_ << indent() << js_const_type_ << "params = {" << endl;
|
||||
indent_up();
|
||||
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
|
||||
f_service_ << indent() << indent() << (*fld_iter)->get_name() << ": " << (*fld_iter)->get_name();
|
||||
indent(f_service_) << (*fld_iter)->get_name() << ": " << (*fld_iter)->get_name();
|
||||
if (fld_iter != fields.end()-1) {
|
||||
f_service_ << "," << endl;
|
||||
} else {
|
||||
f_service_ << endl;
|
||||
}
|
||||
}
|
||||
f_service_ << indent() << "};" << endl;
|
||||
f_service_ << indent() << js_const_type_ << "args = new " << argsname << "(params);" << endl;
|
||||
indent_down();
|
||||
indent(f_service_) << "};" << endl;
|
||||
indent(f_service_) << js_const_type_ << "args = new " << argsname << "(params);" << endl;
|
||||
} else {
|
||||
f_service_ << indent() << js_const_type_ << "args = new " << argsname << "();" << endl;
|
||||
indent(f_service_) << js_const_type_ << "args = new " << argsname << "();" << endl;
|
||||
}
|
||||
|
||||
|
||||
// Serialize the request header within try/catch
|
||||
f_service_ << indent() << "try {" << endl;
|
||||
indent(f_service_) << "try {" << endl;
|
||||
indent_up();
|
||||
|
||||
if (gen_node_) {
|
||||
|
@ -1617,7 +1865,7 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
f_service_ << indent() << "this.output.getTransport().flush(true, null);" << endl;
|
||||
f_service_ << indent() << "callback();" << endl;
|
||||
} else {
|
||||
f_service_ << indent() << "this.output.getTransport().flush(true, function() {" << endl;
|
||||
f_service_ << indent() << "this.output.getTransport().flush(true, () => {" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << js_let_type_ << "error = null, result = null;" << endl;
|
||||
f_service_ << indent() << "try {" << endl;
|
||||
|
@ -1627,7 +1875,7 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
f_service_ << indent() << "}" << endl;
|
||||
f_service_ << indent() << "callback(error, result);" << endl;
|
||||
indent_down();
|
||||
f_service_ << indent() << "});";
|
||||
f_service_ << indent() << "});" << endl;
|
||||
}
|
||||
} else {
|
||||
f_service_ << indent() << "if (callback) {" << endl;
|
||||
|
@ -1678,26 +1926,40 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
indent_down();
|
||||
|
||||
f_service_ << "};" << endl;
|
||||
// Close send function
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
|
||||
// Receive function
|
||||
if (!(*f_iter)->is_oneway()) {
|
||||
std::string resultname = js_namespace(tservice->get_program()) + service_name_ + "_"
|
||||
+ (*f_iter)->get_name() + "_result";
|
||||
|
||||
f_service_ << endl;
|
||||
// Open receive function
|
||||
if (gen_node_) {
|
||||
// Open function
|
||||
f_service_ << endl << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.recv_" << (*f_iter)->get_name()
|
||||
<< " = function(input,mtype,rseqid) {" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "recv_" << (*f_iter)->get_name() << " (input, mtype, rseqid) {" << endl;
|
||||
} else {
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype.recv_" << (*f_iter)->get_name()
|
||||
<< " = function(input,mtype,rseqid) {" << endl;
|
||||
}
|
||||
} else {
|
||||
t_struct noargs(program_);
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "recv_" << (*f_iter)->get_name() << " () {" << endl;
|
||||
} else {
|
||||
t_struct noargs(program_);
|
||||
|
||||
t_function recv_function((*f_iter)->get_returntype(),
|
||||
string("recv_") + (*f_iter)->get_name(),
|
||||
&noargs);
|
||||
// Open function
|
||||
f_service_ << endl << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype." << function_signature(&recv_function) << " {" << endl;
|
||||
t_function recv_function((*f_iter)->get_returntype(),
|
||||
string("recv_") + (*f_iter)->get_name(),
|
||||
&noargs);
|
||||
indent(f_service_) << js_namespace(tservice->get_program()) << service_name_
|
||||
<< "Client.prototype." << function_signature(&recv_function) << " {" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
indent_up();
|
||||
|
@ -1755,15 +2017,24 @@ void t_js_generator::generate_service_client(t_service* tservice) {
|
|||
}
|
||||
}
|
||||
|
||||
// Close function
|
||||
// Close receive function
|
||||
indent_down();
|
||||
f_service_ << "};" << endl;
|
||||
if (gen_es6_) {
|
||||
indent(f_service_) << "}" << endl;
|
||||
} else {
|
||||
indent(f_service_) << "};" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Finish class definitions
|
||||
if (gen_ts_) {
|
||||
f_service_ts_ << ts_indent() << "}" << endl;
|
||||
}
|
||||
if (gen_es6_) {
|
||||
indent_down();
|
||||
f_service_ << "};" << endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::string t_js_generator::render_recv_throw(std::string var) {
|
||||
|
@ -2351,7 +2622,7 @@ string t_js_generator::ts_get_type(t_type* type) {
|
|||
* @param bool in-/exclude the callback argument
|
||||
* @return String of rendered function definition
|
||||
*/
|
||||
std::string t_js_generator::ts_function_signature(t_function* tfunction, bool include_callback) {
|
||||
std::string t_js_generator::ts_function_signature(t_function* tfunction, bool include_callback, bool optional_callback) {
|
||||
string str;
|
||||
const vector<t_field*>& fields = tfunction->get_arglist()->get_members();
|
||||
vector<t_field*>::const_iterator f_iter;
|
||||
|
@ -2367,7 +2638,29 @@ std::string t_js_generator::ts_function_signature(t_function* tfunction, bool in
|
|||
}
|
||||
|
||||
if (include_callback) {
|
||||
str += "callback: (data: " + ts_get_type(tfunction->get_returntype()) + ")=>void): ";
|
||||
string callback_optional_string = optional_callback ? "?" : "";
|
||||
if (gen_node_) {
|
||||
t_struct* exceptions = tfunction->get_xceptions();
|
||||
string exception_types;
|
||||
if (exceptions) {
|
||||
const vector<t_field*>& members = exceptions->get_members();
|
||||
for (vector<t_field*>::const_iterator it = members.begin(); it != members.end(); ++it) {
|
||||
t_type* t = get_true_type((*it)->get_type());
|
||||
if (it == members.begin()) {
|
||||
exception_types = t->get_name();
|
||||
} else {
|
||||
exception_types += " | " + t->get_name();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (exception_types == "") {
|
||||
str += "callback" + callback_optional_string + ": (error: void, response: " + ts_get_type(tfunction->get_returntype()) + ")=>void): ";
|
||||
} else {
|
||||
str += "callback" + callback_optional_string + ": (error: " + exception_types + ", response: " + ts_get_type(tfunction->get_returntype()) + ")=>void): ";
|
||||
}
|
||||
} else {
|
||||
str += "callback" + callback_optional_string + ": (data: " + ts_get_type(tfunction->get_returntype()) + ")=>void): ";
|
||||
}
|
||||
|
||||
if (gen_jquery_) {
|
||||
str += "JQueryPromise<" + ts_get_type(tfunction->get_returntype()) +">;";
|
||||
|
|
20
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_perl_generator.cc
generated
vendored
20
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_perl_generator.cc
generated
vendored
|
@ -354,7 +354,7 @@ string t_perl_generator::render_const_value(t_type* type, t_const_value* value)
|
|||
} else if (type->is_enum()) {
|
||||
out << value->get_integer();
|
||||
} else if (type->is_struct() || type->is_xception()) {
|
||||
out << "new " << perl_namespace(type->get_program()) << type->get_name() << "({" << endl;
|
||||
out << perl_namespace(type->get_program()) << type->get_name() << "->new({" << endl;
|
||||
indent_up();
|
||||
|
||||
const vector<t_field*>& fields = ((t_struct*)type)->get_members();
|
||||
|
@ -546,7 +546,7 @@ void t_perl_generator::generate_perl_struct_reader(ostream& out, t_struct* tstru
|
|||
indent(out) << "$xfer += $input->readStructBegin(\\$fname);" << endl;
|
||||
|
||||
// Loop over reading in fields
|
||||
indent(out) << "while (1) " << endl;
|
||||
indent(out) << "while (1)" << endl;
|
||||
|
||||
scope_up(out);
|
||||
|
||||
|
@ -758,7 +758,7 @@ void t_perl_generator::generate_service_processor(t_service* tservice) {
|
|||
|
||||
f_service_ << indent() << "$input->skip(Thrift::TType::STRUCT);" << endl << indent()
|
||||
<< "$input->readMessageEnd();" << endl << indent()
|
||||
<< "my $x = new Thrift::TApplicationException('Function '.$fname.' not implemented.', "
|
||||
<< "my $x = Thrift::TApplicationException->new('Function '.$fname.' not implemented.', "
|
||||
"Thrift::TApplicationException::UNKNOWN_METHOD);" << endl << indent()
|
||||
<< "$output->writeMessageBegin($fname, Thrift::TMessageType::EXCEPTION, $rseqid);" << endl
|
||||
<< indent() << "$x->write($output);" << endl << indent()
|
||||
|
@ -798,7 +798,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, t_function
|
|||
string resultname = perl_namespace(tservice->get_program()) + service_name_ + "_"
|
||||
+ tfunction->get_name() + "_result";
|
||||
|
||||
f_service_ << indent() << "my $args = new " << argsname << "();" << endl << indent()
|
||||
f_service_ << indent() << "my $args = " << argsname << "->new();" << endl << indent()
|
||||
<< "$args->read($input);" << endl;
|
||||
|
||||
f_service_ << indent() << "$input->readMessageEnd();" << endl;
|
||||
|
@ -809,7 +809,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, t_function
|
|||
|
||||
// Declare result for non oneway function
|
||||
if (!tfunction->is_oneway()) {
|
||||
f_service_ << indent() << "my $result = new " << resultname << "();" << endl;
|
||||
f_service_ << indent() << "my $result = " << resultname << "->new();" << endl;
|
||||
}
|
||||
|
||||
// Try block for a function with exceptions
|
||||
|
@ -858,7 +858,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, t_function
|
|||
f_service_ << indent() << "if ($@) {" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << "$@ =~ s/^\\s+|\\s+$//g;" << endl
|
||||
<< indent() << "my $err = new Thrift::TApplicationException(\"Unexpected Exception: \" . $@, Thrift::TApplicationException::INTERNAL_ERROR);" << endl
|
||||
<< indent() << "my $err = Thrift::TApplicationException->new(\"Unexpected Exception: \" . $@, Thrift::TApplicationException::INTERNAL_ERROR);" << endl
|
||||
<< indent() << "$output->writeMessageBegin('" << tfunction->get_name() << "', Thrift::TMessageType::EXCEPTION, $seqid);" << endl
|
||||
<< indent() << "$err->write($output);" << endl
|
||||
<< indent() << "$output->writeMessageEnd();" << endl
|
||||
|
@ -1106,7 +1106,7 @@ void t_perl_generator::generate_service_client(t_service* tservice) {
|
|||
<< "', " << ((*f_iter)->is_oneway() ? "Thrift::TMessageType::ONEWAY" : "Thrift::TMessageType::CALL")
|
||||
<< ", $self->{seqid});" << endl;
|
||||
|
||||
f_service_ << indent() << "my $args = new " << argsname << "();" << endl;
|
||||
f_service_ << indent() << "my $args = " << argsname << "->new();" << endl;
|
||||
|
||||
for (fld_iter = fields.begin(); fld_iter != fields.end(); ++fld_iter) {
|
||||
f_service_ << indent() << "$args->{" << (*fld_iter)->get_name() << "} = $"
|
||||
|
@ -1140,12 +1140,12 @@ void t_perl_generator::generate_service_client(t_service* tservice) {
|
|||
|
||||
f_service_ << indent() << "$self->{input}->readMessageBegin(\\$fname, \\$mtype, \\$rseqid);"
|
||||
<< endl << indent() << "if ($mtype == Thrift::TMessageType::EXCEPTION) {" << endl
|
||||
<< indent() << " my $x = new Thrift::TApplicationException();" << endl << indent()
|
||||
<< indent() << " my $x = Thrift::TApplicationException->new();" << endl << indent()
|
||||
<< " $x->read($self->{input});" << endl << indent()
|
||||
<< " $self->{input}->readMessageEnd();" << endl << indent() << " die $x;" << endl
|
||||
<< indent() << "}" << endl;
|
||||
|
||||
f_service_ << indent() << "my $result = new " << resultname << "();" << endl << indent()
|
||||
f_service_ << indent() << "my $result = " << resultname << "->new();" << endl << indent()
|
||||
<< "$result->read($self->{input});" << endl;
|
||||
|
||||
f_service_ << indent() << "$self->{input}->readMessageEnd();" << endl << endl;
|
||||
|
@ -1586,7 +1586,7 @@ string t_perl_generator::declare_field(t_field* tfield, bool init, bool obj) {
|
|||
result += " = []";
|
||||
} else if (type->is_struct() || type->is_xception()) {
|
||||
if (obj) {
|
||||
result += " = new " + perl_namespace(type->get_program()) + type->get_name() + "()";
|
||||
result += " = " + perl_namespace(type->get_program()) + type->get_name() + "->new()";
|
||||
} else {
|
||||
result += " = undef";
|
||||
}
|
||||
|
|
6
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_py_generator.cc
generated
vendored
6
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_py_generator.cc
generated
vendored
|
@ -1961,8 +1961,10 @@ void t_py_generator::generate_process_function(t_service* tservice, t_function*
|
|||
indent(f_service_) << "def write_results_success_" << tfunction->get_name()
|
||||
<< "(self, success, result, seqid, oprot):" << endl;
|
||||
indent_up();
|
||||
f_service_ << indent() << "result.success = success" << endl
|
||||
<< indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
|
||||
if (!tfunction->get_returntype()->is_void()) {
|
||||
f_service_ << indent() << "result.success = success" << endl;
|
||||
}
|
||||
f_service_ << indent() << "oprot.writeMessageBegin(\"" << tfunction->get_name()
|
||||
<< "\", TMessageType.REPLY, seqid)" << endl
|
||||
<< indent() << "result.write(oprot)" << endl
|
||||
<< indent() << "oprot.writeMessageEnd()" << endl
|
||||
|
|
89
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_rs_generator.cc
generated
vendored
89
vendor/git.apache.org/thrift.git/compiler/cpp/src/thrift/generate/t_rs_generator.cc
generated
vendored
|
@ -127,7 +127,7 @@ private:
|
|||
void render_const_value_holder(const string& name, t_type* ttype, t_const_value* tvalue);
|
||||
|
||||
// Write the actual const value - the right side of a const definition.
|
||||
void render_const_value(t_type* ttype, t_const_value* tvalue);
|
||||
void render_const_value(t_type* ttype, t_const_value* tvalue, bool is_owned = true);
|
||||
|
||||
// Write a const struct (returned from `const_value` method).
|
||||
void render_const_struct(t_type* ttype, t_const_value* tvalue);
|
||||
|
@ -355,8 +355,8 @@ private:
|
|||
|
||||
string handler_successful_return_struct(t_function* tfunc);
|
||||
|
||||
// Writes the result of `render_rift_error_struct` wrapped in an `Err(thrift::Error(...))`.
|
||||
void render_rift_error(
|
||||
// Writes the result of `render_thrift_error_struct` wrapped in an `Err(thrift::Error(...))`.
|
||||
void render_thrift_error(
|
||||
const string& error_kind,
|
||||
const string& error_struct,
|
||||
const string& sub_error_kind,
|
||||
|
@ -377,7 +377,7 @@ private:
|
|||
// message: "This is some error message",
|
||||
// }
|
||||
// ```
|
||||
void render_rift_error_struct(
|
||||
void render_thrift_error_struct(
|
||||
const string& error_struct,
|
||||
const string& sub_error_kind,
|
||||
const string& error_message
|
||||
|
@ -411,6 +411,9 @@ private:
|
|||
// Return a string representing the rust type given a `t_type`.
|
||||
string to_rust_type(t_type* ttype, bool ordered_float = true);
|
||||
|
||||
// Return a string representing the `const` rust type given a `t_type`
|
||||
string to_rust_const_type(t_type* ttype, bool ordered_float = true);
|
||||
|
||||
// Return a string representing the rift `protocol::TType` given a `t_type`.
|
||||
string to_rust_field_type_enum(t_type* ttype);
|
||||
|
||||
|
@ -499,6 +502,9 @@ private:
|
|||
// the server half of a Thrift service.
|
||||
string rust_sync_processor_impl_name(t_service *tservice);
|
||||
|
||||
// Return the variant name for an enum variant
|
||||
string rust_enum_variant_name(const string& name);
|
||||
|
||||
// Properly uppercase names for use in Rust.
|
||||
string rust_upper_case(const string& name);
|
||||
|
||||
|
@ -645,8 +651,8 @@ void t_rs_generator::render_const_value(const string& name, t_type* ttype, t_con
|
|||
throw "cannot generate simple rust constant for " + ttype->get_name();
|
||||
}
|
||||
|
||||
f_gen_ << "pub const " << rust_upper_case(name) << ": " << to_rust_type(ttype) << " = ";
|
||||
render_const_value(ttype, tvalue);
|
||||
f_gen_ << "pub const " << rust_upper_case(name) << ": " << to_rust_const_type(ttype) << " = ";
|
||||
render_const_value(ttype, tvalue, false);
|
||||
f_gen_ << ";" << endl;
|
||||
f_gen_ << endl;
|
||||
}
|
||||
|
@ -673,15 +679,22 @@ void t_rs_generator::render_const_value_holder(const string& name, t_type* ttype
|
|||
f_gen_ << endl;
|
||||
}
|
||||
|
||||
void t_rs_generator::render_const_value(t_type* ttype, t_const_value* tvalue) {
|
||||
void t_rs_generator::render_const_value(t_type* ttype, t_const_value* tvalue, bool is_owned) {
|
||||
if (ttype->is_base_type()) {
|
||||
t_base_type* tbase_type = (t_base_type*)ttype;
|
||||
switch (tbase_type->get_base()) {
|
||||
case t_base_type::TYPE_STRING:
|
||||
if (tbase_type->is_binary()) {
|
||||
f_gen_ << "\"" << tvalue->get_string() << "\""<< ".to_owned().into_bytes()";
|
||||
if (is_owned) {
|
||||
f_gen_ << "\"" << tvalue->get_string() << "\""<< ".to_owned().into_bytes()";
|
||||
} else {
|
||||
f_gen_ << "b\"" << tvalue->get_string() << "\"";
|
||||
}
|
||||
} else {
|
||||
f_gen_ << "\"" << tvalue->get_string() << "\""<< ".to_owned()";
|
||||
f_gen_ << "\"" << tvalue->get_string() << "\"";
|
||||
if (is_owned) {
|
||||
f_gen_ << ".to_owned()";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case t_base_type::TYPE_BOOL:
|
||||
|
@ -873,7 +886,7 @@ void t_rs_generator::render_enum_definition(t_enum* tenum, const string& enum_na
|
|||
render_rustdoc((t_doc*) val);
|
||||
f_gen_
|
||||
<< indent()
|
||||
<< uppercase(val->get_name())
|
||||
<< rust_enum_variant_name(val->get_name())
|
||||
<< " = "
|
||||
<< val->get_value()
|
||||
<< ","
|
||||
|
@ -934,12 +947,12 @@ void t_rs_generator::render_enum_conversion(t_enum* tenum, const string& enum_na
|
|||
f_gen_
|
||||
<< indent()
|
||||
<< val->get_value()
|
||||
<< " => Ok(" << enum_name << "::" << uppercase(val->get_name()) << "),"
|
||||
<< " => Ok(" << enum_name << "::" << rust_enum_variant_name(val->get_name()) << "),"
|
||||
<< endl;
|
||||
}
|
||||
f_gen_ << indent() << "_ => {" << endl;
|
||||
indent_up();
|
||||
render_rift_error(
|
||||
render_thrift_error(
|
||||
"Protocol",
|
||||
"ProtocolError",
|
||||
"ProtocolErrorKind::InvalidData",
|
||||
|
@ -1320,7 +1333,7 @@ void t_rs_generator::render_result_struct_to_result_method(t_struct* tstruct) {
|
|||
indent_up();
|
||||
// if we haven't found a valid return value *or* a user exception
|
||||
// then we're in trouble; return a default error
|
||||
render_rift_error(
|
||||
render_thrift_error(
|
||||
"Application",
|
||||
"ApplicationError",
|
||||
"ApplicationErrorKind::MissingResult",
|
||||
|
@ -1854,7 +1867,7 @@ void t_rs_generator::render_union_sync_read(const string &union_name, t_struct *
|
|||
// return the value or an error
|
||||
f_gen_ << indent() << "if received_field_count == 0 {" << endl;
|
||||
indent_up();
|
||||
render_rift_error(
|
||||
render_thrift_error(
|
||||
"Protocol",
|
||||
"ProtocolError",
|
||||
"ProtocolErrorKind::InvalidData",
|
||||
|
@ -1863,7 +1876,7 @@ void t_rs_generator::render_union_sync_read(const string &union_name, t_struct *
|
|||
indent_down();
|
||||
f_gen_ << indent() << "} else if received_field_count > 1 {" << endl;
|
||||
indent_up();
|
||||
render_rift_error(
|
||||
render_thrift_error(
|
||||
"Protocol",
|
||||
"ProtocolError",
|
||||
"ProtocolErrorKind::InvalidData",
|
||||
|
@ -2565,7 +2578,7 @@ void t_rs_generator::render_sync_processor_definition_and_impl(t_service *tservi
|
|||
render_process_match_statements(tservice);
|
||||
f_gen_ << indent() << "method => {" << endl;
|
||||
indent_up();
|
||||
render_rift_error(
|
||||
render_thrift_error(
|
||||
"Application",
|
||||
"ApplicationError",
|
||||
"ApplicationErrorKind::UnknownMethod",
|
||||
|
@ -2844,7 +2857,7 @@ void t_rs_generator::render_sync_handler_failed_user_exception_branch(t_function
|
|||
|
||||
f_gen_ << indent() << "let ret_err = {" << endl;
|
||||
indent_up();
|
||||
render_rift_error_struct("ApplicationError", "ApplicationErrorKind::Unknown", "usr_err.description()");
|
||||
render_thrift_error_struct("ApplicationError", "ApplicationErrorKind::Unknown", "usr_err.description()");
|
||||
indent_down();
|
||||
f_gen_ << indent() << "};" << endl;
|
||||
render_sync_handler_send_exception_response(tfunc, "ret_err");
|
||||
|
@ -2867,7 +2880,7 @@ void t_rs_generator::render_sync_handler_failed_application_exception_branch(
|
|||
void t_rs_generator::render_sync_handler_failed_default_exception_branch(t_function *tfunc) {
|
||||
f_gen_ << indent() << "let ret_err = {" << endl;
|
||||
indent_up();
|
||||
render_rift_error_struct("ApplicationError", "ApplicationErrorKind::Unknown", "e.description()");
|
||||
render_thrift_error_struct("ApplicationError", "ApplicationErrorKind::Unknown", "e.description()");
|
||||
indent_down();
|
||||
f_gen_ << indent() << "};" << endl;
|
||||
if (tfunc->is_oneway()) {
|
||||
|
@ -2944,7 +2957,7 @@ void t_rs_generator::render_rustdoc(t_doc* tdoc) {
|
|||
generate_docstring_comment(f_gen_, "", "/// ", tdoc->get_doc(), "");
|
||||
}
|
||||
|
||||
void t_rs_generator::render_rift_error(
|
||||
void t_rs_generator::render_thrift_error(
|
||||
const string& error_kind,
|
||||
const string& error_struct,
|
||||
const string& sub_error_kind,
|
||||
|
@ -2954,14 +2967,14 @@ void t_rs_generator::render_rift_error(
|
|||
indent_up();
|
||||
f_gen_ << indent() << "thrift::Error::" << error_kind << "(" << endl;
|
||||
indent_up();
|
||||
render_rift_error_struct(error_struct, sub_error_kind, error_message);
|
||||
render_thrift_error_struct(error_struct, sub_error_kind, error_message);
|
||||
indent_down();
|
||||
f_gen_ << indent() << ")" << endl;
|
||||
indent_down();
|
||||
f_gen_ << indent() << ")" << endl;
|
||||
}
|
||||
|
||||
void t_rs_generator::render_rift_error_struct(
|
||||
void t_rs_generator::render_thrift_error_struct(
|
||||
const string& error_struct,
|
||||
const string& sub_error_kind,
|
||||
const string& error_message
|
||||
|
@ -3022,7 +3035,7 @@ string t_rs_generator::to_rust_type(t_type* ttype, bool ordered_float) {
|
|||
rust_type = ttypedef->is_forward_typedef() ? "Box<" + rust_type + ">" : rust_type;
|
||||
return rust_type;
|
||||
} else if (ttype->is_enum()) {
|
||||
return rust_namespace(ttype) + ttype->get_name();
|
||||
return rust_namespace(ttype) + rust_camel_case(ttype->get_name());
|
||||
} else if (ttype->is_struct() || ttype->is_xception()) {
|
||||
return rust_namespace(ttype) + rust_camel_case(ttype->get_name());
|
||||
} else if (ttype->is_map()) {
|
||||
|
@ -3039,6 +3052,21 @@ string t_rs_generator::to_rust_type(t_type* ttype, bool ordered_float) {
|
|||
throw "cannot find rust type for " + ttype->get_name();
|
||||
}
|
||||
|
||||
string t_rs_generator::to_rust_const_type(t_type* ttype, bool ordered_float) {
|
||||
if (ttype->is_base_type()) {
|
||||
t_base_type* tbase_type = ((t_base_type*)ttype);
|
||||
if (tbase_type->get_base() == t_base_type::TYPE_STRING) {
|
||||
if (tbase_type->is_binary()) {
|
||||
return "&[u8]";
|
||||
} else {
|
||||
return "&str";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return to_rust_type(ttype, ordered_float);
|
||||
}
|
||||
|
||||
string t_rs_generator::to_rust_field_type_enum(t_type* ttype) {
|
||||
ttype = get_true_type(ttype);
|
||||
if (ttype->is_base_type()) {
|
||||
|
@ -3254,6 +3282,23 @@ string t_rs_generator::rust_sync_processor_impl_name(t_service *tservice) {
|
|||
return "T" + rust_camel_case(tservice->get_name()) + "ProcessFunctions";
|
||||
}
|
||||
|
||||
string t_rs_generator::rust_enum_variant_name(const string &name) {
|
||||
bool all_uppercase = true;
|
||||
|
||||
for (size_t i = 0; i < name.size(); i++) {
|
||||
if (isalnum(name[i]) && islower(name[i])) {
|
||||
all_uppercase = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (all_uppercase) {
|
||||
return capitalize(camelcase(lowercase(name)));
|
||||
} else {
|
||||
return capitalize(camelcase(name));
|
||||
}
|
||||
}
|
||||
|
||||
string t_rs_generator::rust_upper_case(const string& name) {
|
||||
string str(uppercase(underscore(name)));
|
||||
string_replace(str, "__", "_");
|
||||
|
|
8
vendor/git.apache.org/thrift.git/composer.json
generated
vendored
8
vendor/git.apache.org/thrift.git/composer.json
generated
vendored
|
@ -1,9 +1,11 @@
|
|||
{
|
||||
"name": "apache/thrift",
|
||||
"description": "Apache Thrift RPC system",
|
||||
"homepage": "http://thrift.apache.org/",
|
||||
"homepage": "https://thrift.apache.org/",
|
||||
"type": "library",
|
||||
"keywords": ["RPC"],
|
||||
"license": "Apache-2.0",
|
||||
"readme": "README.md",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Apache Thrift Developers",
|
||||
|
@ -28,10 +30,10 @@
|
|||
"autoload-dev": {
|
||||
"psr-4": {"Test\\Thrift\\": "lib/php/test/"}
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"minimum-stability": "stable",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "1.0.0-dev"
|
||||
"dev-master": "1.0.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
20
vendor/git.apache.org/thrift.git/configure.ac
generated
vendored
20
vendor/git.apache.org/thrift.git/configure.ac
generated
vendored
|
@ -20,7 +20,7 @@
|
|||
AC_PREREQ(2.65)
|
||||
AC_CONFIG_MACRO_DIR([./aclocal])
|
||||
|
||||
AC_INIT([thrift], [1.0.0-dev])
|
||||
AC_INIT([thrift], [0.12.0])
|
||||
|
||||
AC_CONFIG_AUX_DIR([.])
|
||||
|
||||
|
@ -109,6 +109,8 @@ fi
|
|||
|
||||
AM_EXTRA_RECURSIVE_TARGETS([style])
|
||||
AC_SUBST(CPPSTYLE_CMD, 'find . -type f \( -iname "*.h" -or -iname "*.cpp" -or -iname "*.cc" -or -iname "*.tcc" \) -printf "Reformatting: %h/%f\n" -exec clang-format -i {} \;')
|
||||
# '
|
||||
# The above comment is to fix editor syntax highlighting
|
||||
|
||||
AC_ARG_ENABLE([libs],
|
||||
AS_HELP_STRING([--enable-libs], [build the Apache Thrift libraries [default=yes]]),
|
||||
|
@ -136,6 +138,7 @@ if test "$enable_libs" = "no"; then
|
|||
with_go="no"
|
||||
with_d="no"
|
||||
with_nodejs="no"
|
||||
with_nodets="no"
|
||||
with_lua="no"
|
||||
with_rs="no"
|
||||
fi
|
||||
|
@ -279,6 +282,18 @@ fi
|
|||
AM_CONDITIONAL(WITH_NODEJS, [test "$have_nodejs" = "yes"])
|
||||
AM_CONDITIONAL(HAVE_NPM, [test "x$NPM" != "x"])
|
||||
|
||||
AX_THRIFT_LIB(nodets, [Nodets], yes)
|
||||
have_nodets=no
|
||||
if test "$with_nodets" = "yes"; then
|
||||
AC_PATH_PROGS([NODETS], [nodets node])
|
||||
AC_PATH_PROG([NPM], [npm])
|
||||
if test "x$NODETS" != "x" -a "x$NPM" != "x"; then
|
||||
have_nodets="yes"
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(WITH_NODETS, [test "$have_nodets" = "yes"])
|
||||
AM_CONDITIONAL(HAVE_NPM, [test "x$NPM" != "x"])
|
||||
|
||||
AX_THRIFT_LIB(lua, [Lua], yes)
|
||||
have_lua=no
|
||||
if test "$with_lua" = "yes"; then
|
||||
|
@ -825,6 +840,7 @@ AC_CONFIG_FILES([
|
|||
lib/json/test/Makefile
|
||||
lib/netcore/Makefile
|
||||
lib/nodejs/Makefile
|
||||
lib/nodets/Makefile
|
||||
lib/perl/Makefile
|
||||
lib/perl/test/Makefile
|
||||
lib/php/Makefile
|
||||
|
@ -905,6 +921,8 @@ if test "$have_go" = "yes" ; then MAYBE_GO="go" ; else MAYBE_GO="" ; fi
|
|||
AC_SUBST([MAYBE_GO])
|
||||
if test "$have_nodejs" = "yes" ; then MAYBE_NODEJS="nodejs" ; else MAYBE_NODEJS="" ; fi
|
||||
AC_SUBST([MAYBE_NODEJS])
|
||||
if test "$have_nodets" = "yes" ; then MAYBE_NODETS="nodets" ; else MAYBE_NODETS="" ; fi
|
||||
AC_SUBST([MAYBE_NODETS])
|
||||
if test "$have_erlang" = "yes" ; then MAYBE_ERLANG="erl" ; else MAYBE_ERLANG="" ; fi
|
||||
AC_SUBST([MAYBE_ERLANG])
|
||||
if test "$have_lua" = "yes" ; then MAYBE_LUA="lua" ; else MAYBE_LUA="" ; fi
|
||||
|
|
4
vendor/git.apache.org/thrift.git/contrib/Rebus/Properties/AssemblyInfo.cs
generated
vendored
4
vendor/git.apache.org/thrift.git/contrib/Rebus/Properties/AssemblyInfo.cs
generated
vendored
|
@ -34,5 +34,5 @@ using System.Runtime.InteropServices;
|
|||
|
||||
[assembly: Guid("0af10984-40d3-453d-b1e5-421529e8c7e2")]
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("0.12.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.0")]
|
||||
|
|
2
vendor/git.apache.org/thrift.git/contrib/fb303/py/setup.py
generated
vendored
2
vendor/git.apache.org/thrift.git/contrib/fb303/py/setup.py
generated
vendored
|
@ -26,7 +26,7 @@ except:
|
|||
from distutils.core import setup, Extension, Command
|
||||
|
||||
setup(name='thrift_fb303',
|
||||
version='1.0.0-dev',
|
||||
version='0.12.0',
|
||||
description='Python bindings for the Apache Thrift FB303',
|
||||
author=['Thrift Developers'],
|
||||
author_email=['dev@thrift.apache.org'],
|
||||
|
|
2
vendor/git.apache.org/thrift.git/contrib/thrift-maven-plugin/pom.xml
generated
vendored
2
vendor/git.apache.org/thrift.git/contrib/thrift-maven-plugin/pom.xml
generated
vendored
|
@ -27,7 +27,7 @@
|
|||
<artifactId>thrift-maven-plugin</artifactId>
|
||||
<packaging>maven-plugin</packaging>
|
||||
<name>thrift-maven-plugin</name>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>0.12.0</version>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
2
vendor/git.apache.org/thrift.git/contrib/thrift.spec
generated
vendored
2
vendor/git.apache.org/thrift.git/contrib/thrift.spec
generated
vendored
|
@ -28,7 +28,7 @@ Name: thrift
|
|||
License: Apache License v2.0
|
||||
Group: Development
|
||||
Summary: RPC and serialization framework
|
||||
Version: 0.11.0
|
||||
Version: 0.12.0
|
||||
Release: 0
|
||||
URL: http://thrift.apache.org
|
||||
Packager: Thrift Developers <dev@thrift.apache.org>
|
||||
|
|
4
vendor/git.apache.org/thrift.git/contrib/zeromq/csharp/ThriftZMQ.csproj
generated
vendored
4
vendor/git.apache.org/thrift.git/contrib/zeromq/csharp/ThriftZMQ.csproj
generated
vendored
|
@ -25,7 +25,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.12.0</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -88,4 +88,4 @@
|
|||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
26
vendor/git.apache.org/thrift.git/debian/changelog
generated
vendored
26
vendor/git.apache.org/thrift.git/debian/changelog
generated
vendored
|
@ -1,8 +1,26 @@
|
|||
thrift (1.0.0-dev) stable; urgency=low
|
||||
* update version
|
||||
* fix libthrift0.install
|
||||
thrift (0.12.0) stable; urgency=low
|
||||
|
||||
-- Roger Meier <roger@apache.org> Tue, 08 Jan 2013 22:40:12 +0100
|
||||
* update to 0.12.0
|
||||
|
||||
-- Jake Farrell <jfarrell@apache.org> Wed, 15 Oct 2018 12:00:00 -0500
|
||||
|
||||
thrift (0.11.0) stable; urgency=low
|
||||
|
||||
* update to 0.11.0
|
||||
|
||||
-- Jake Farrell <jfarrell@apache.org> Wed, 07 Dec 2017 20:07:00 -0500
|
||||
|
||||
thrift (0.10.0) stable; urgency=low
|
||||
|
||||
* update to 0.10.0
|
||||
|
||||
-- Jake Farrell <jfarrell@apache.org> Wed, 03 Jan 2017 16:52:00 -0500
|
||||
|
||||
thrift (0.9.3) stable; urgency=low
|
||||
|
||||
* update to 0.9.3
|
||||
|
||||
-- Jake Farrell <jfarrell@apache.org> Wed, 11 Oct 2015 17:22:00 -0500
|
||||
|
||||
thrift (0.9.0) stable; urgency=low
|
||||
|
||||
|
|
10
vendor/git.apache.org/thrift.git/doap.rdf
generated
vendored
10
vendor/git.apache.org/thrift.git/doap.rdf
generated
vendored
|
@ -58,6 +58,16 @@
|
|||
<category rdf:resource="http://projects.apache.org/category/network-client" />
|
||||
<category rdf:resource="http://projects.apache.org/category/network-server" />
|
||||
<release rdf:parseType="Collection">
|
||||
<Version>
|
||||
<name>Apache Thrift</name>
|
||||
<created>2018-10-15</created>
|
||||
<revision>0.12.0</revision>
|
||||
</Version>
|
||||
<Version>
|
||||
<name>Apache Thrift</name>
|
||||
<created>2017-11-30</created>
|
||||
<revision>0.11.0</revision>
|
||||
</Version>
|
||||
<Version>
|
||||
<name>Apache Thrift</name>
|
||||
<created>2017-03-01</created>
|
||||
|
|
1
vendor/git.apache.org/thrift.git/lib/Makefile.am
generated
vendored
1
vendor/git.apache.org/thrift.git/lib/Makefile.am
generated
vendored
|
@ -87,6 +87,7 @@ endif
|
|||
if WITH_NODEJS
|
||||
SUBDIRS += nodejs
|
||||
PRECROSS_TARGET += precross-nodejs
|
||||
SUBDIRS += nodets
|
||||
endif
|
||||
|
||||
if WITH_LUA
|
||||
|
|
12
vendor/git.apache.org/thrift.git/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
generated
vendored
12
vendor/git.apache.org/thrift.git/lib/c_glib/src/thrift/c_glib/protocol/thrift_protocol.c
generated
vendored
|
@ -465,7 +465,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
|
|||
}
|
||||
case T_STRUCT:
|
||||
{
|
||||
guint32 result = 0;
|
||||
gint32 result = 0;
|
||||
gchar *name;
|
||||
gint16 fid;
|
||||
ThriftType ftype;
|
||||
|
@ -475,6 +475,10 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
|
|||
{
|
||||
result += thrift_protocol_read_field_begin (protocol, &name, &ftype,
|
||||
&fid, error);
|
||||
if (result < 0)
|
||||
{
|
||||
return result;
|
||||
}
|
||||
if (ftype == T_STOP)
|
||||
{
|
||||
break;
|
||||
|
@ -487,7 +491,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
|
|||
}
|
||||
case T_SET:
|
||||
{
|
||||
guint32 result = 0;
|
||||
gint32 result = 0;
|
||||
ThriftType elem_type;
|
||||
guint32 i, size;
|
||||
result += thrift_protocol_read_set_begin (protocol, &elem_type, &size,
|
||||
|
@ -501,7 +505,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
|
|||
}
|
||||
case T_MAP:
|
||||
{
|
||||
guint32 result = 0;
|
||||
gint32 result = 0;
|
||||
ThriftType elem_type;
|
||||
ThriftType key_type;
|
||||
guint32 i, size;
|
||||
|
@ -517,7 +521,7 @@ thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
|
|||
}
|
||||
case T_LIST:
|
||||
{
|
||||
guint32 result = 0;
|
||||
gint32 result = 0;
|
||||
ThriftType elem_type;
|
||||
guint32 i, size;
|
||||
result += thrift_protocol_read_list_begin (protocol, &elem_type, &size,
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/cocoa/src/Thrift.h
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/cocoa/src/Thrift.h
generated
vendored
|
@ -17,4 +17,4 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
#define ThriftVersion @"1.0.0-dev"
|
||||
#define ThriftVersion @"0.12.0"
|
||||
|
|
9
vendor/git.apache.org/thrift.git/lib/cpp/libthrift.vcxproj
generated
vendored
9
vendor/git.apache.org/thrift.git/lib/cpp/libthrift.vcxproj
generated
vendored
|
@ -53,12 +53,9 @@
|
|||
<ClCompile Include="src\thrift\server\TSimpleServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TThreadPoolServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TThreadedServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TConnectedClient.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TNonblockingServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TServerFramework.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TSimpleServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TThreadedServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TThreadPoolServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TConnectedClient.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TNonblockingServer.cpp"/>
|
||||
<ClCompile Include="src\thrift\server\TServerFramework.cpp"/>
|
||||
<ClCompile Include="src\thrift\TApplicationException.cpp"/>
|
||||
<ClCompile Include="src\thrift\TOutput.cpp"/>
|
||||
<ClCompile Include="src\thrift\transport\TBufferTransports.cpp"/>
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/protocol/TJSONProtocol.cpp
generated
vendored
|
@ -899,7 +899,7 @@ uint32_t TJSONProtocol::readJSONDouble(double& num) {
|
|||
}
|
||||
try {
|
||||
num = fromString<double>(str);
|
||||
} catch (std::runtime_error e) {
|
||||
} catch (std::runtime_error& e) {
|
||||
throw TProtocolException(TProtocolException::INVALID_DATA,
|
||||
"Expected numeric value; got \"" + str + "\"");
|
||||
}
|
||||
|
@ -912,7 +912,7 @@ uint32_t TJSONProtocol::readJSONDouble(double& num) {
|
|||
result += readJSONNumericChars(str);
|
||||
try {
|
||||
num = fromString<double>(str);
|
||||
} catch (std::runtime_error e) {
|
||||
} catch (std::runtime_error& e) {
|
||||
throw TProtocolException(TProtocolException::INVALID_DATA,
|
||||
"Expected numeric value; got \"" + str + "\"");
|
||||
}
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/qt/TQIODeviceTransport.cpp
generated
vendored
|
@ -91,7 +91,7 @@ uint32_t TQIODeviceTransport::read(uint8_t* buf, uint32_t len) {
|
|||
"read(): underlying QIODevice is not open");
|
||||
}
|
||||
|
||||
actualSize = (uint32_t)std::min((qint64)len, dev_->bytesAvailable());
|
||||
actualSize = (uint32_t)(std::min)((qint64)len, dev_->bytesAvailable());
|
||||
readSize = dev_->read(reinterpret_cast<char*>(buf), actualSize);
|
||||
|
||||
if (readSize < 0) {
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TBufferTransports.h
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TBufferTransports.h
generated
vendored
|
@ -449,7 +449,7 @@ private:
|
|||
// Common initialization done by all constructors.
|
||||
void initCommon(uint8_t* buf, uint32_t size, bool owner, uint32_t wPos) {
|
||||
|
||||
maxBufferSize_ = std::numeric_limits<uint32_t>::max();
|
||||
maxBufferSize_ = (std::numeric_limits<uint32_t>::max)();
|
||||
|
||||
if (buf == NULL && size != 0) {
|
||||
assert(owner);
|
||||
|
|
5
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TFileTransport.cpp
generated
vendored
5
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TFileTransport.cpp
generated
vendored
|
@ -65,7 +65,6 @@ using stdcxx::shared_ptr;
|
|||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::endl;
|
||||
using std::min;
|
||||
using std::string;
|
||||
using namespace apache::thrift::protocol;
|
||||
using namespace apache::thrift::concurrency;
|
||||
|
@ -705,8 +704,8 @@ eventInfo* TFileTransport::readEvent() {
|
|||
readState_.event_->eventBuffPos_ = 0;
|
||||
}
|
||||
// take either the entire event or the remaining bytes in the buffer
|
||||
int reclaimBuffer = min((uint32_t)(readState_.bufferLen_ - readState_.bufferPtr_),
|
||||
readState_.event_->eventSize_ - readState_.event_->eventBuffPos_);
|
||||
int reclaimBuffer = (std::min)((uint32_t)(readState_.bufferLen_ - readState_.bufferPtr_),
|
||||
readState_.event_->eventSize_ - readState_.event_->eventBuffPos_);
|
||||
|
||||
// copy data from read buffer into event buffer
|
||||
memcpy(readState_.event_->eventBuff_ + readState_.event_->eventBuffPos_,
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/THeaderTransport.cpp
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/THeaderTransport.cpp
generated
vendored
|
@ -511,7 +511,7 @@ void THeaderTransport::flush() {
|
|||
|
||||
// Pkt size
|
||||
ptrdiff_t szHbp = (headerStart - pktStart - 4);
|
||||
if (static_cast<uint64_t>(szHbp) > static_cast<uint64_t>(std::numeric_limits<uint32_t>().max()) - (headerSize + haveBytes)) {
|
||||
if (static_cast<uint64_t>(szHbp) > static_cast<uint64_t>((std::numeric_limits<uint32_t>().max)()) - (headerSize + haveBytes)) {
|
||||
throw TTransportException(TTransportException::CORRUPTED_DATA,
|
||||
"Header section size is unreasonable");
|
||||
}
|
||||
|
|
11
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TSocketPool.cpp
generated
vendored
11
vendor/git.apache.org/thrift.git/lib/cpp/src/thrift/transport/TSocketPool.cpp
generated
vendored
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#if __cplusplus >= 201703L
|
||||
#include <random>
|
||||
#endif
|
||||
|
||||
#include <thrift/transport/TSocketPool.h>
|
||||
|
||||
|
@ -188,7 +191,13 @@ void TSocketPool::open() {
|
|||
}
|
||||
|
||||
if (randomize_ && numServers > 1) {
|
||||
random_shuffle(servers_.begin(), servers_.end());
|
||||
#if __cplusplus >= 201703L
|
||||
std::random_device rng;
|
||||
std::mt19937 urng(rng());
|
||||
std::shuffle(servers_.begin(), servers_.end(), urng);
|
||||
#else
|
||||
std::random_shuffle(servers_.begin(), servers_.end());
|
||||
#endif
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < numServers; ++i) {
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/cpp/test/TMemoryBufferTest.cpp
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/cpp/test/TMemoryBufferTest.cpp
generated
vendored
|
@ -111,7 +111,7 @@ BOOST_AUTO_TEST_CASE(test_exceptions) {
|
|||
|
||||
BOOST_AUTO_TEST_CASE(test_default_maximum_buffer_size)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(std::numeric_limits<uint32_t>::max(), TMemoryBuffer().getMaxBufferSize());
|
||||
BOOST_CHECK_EQUAL((std::numeric_limits<uint32_t>::max)(), TMemoryBuffer().getMaxBufferSize());
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(test_default_buffer_size)
|
||||
|
|
|
@ -56,5 +56,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.11.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.11.0.*")]
|
||||
[assembly: AssemblyVersion("0.12.0.*")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.*")]
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.12.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -115,4 +115,4 @@
|
|||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/csharp/src/Properties/AssemblyInfo.cs
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/csharp/src/Properties/AssemblyInfo.cs
generated
vendored
|
@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
[assembly: AssemblyVersion("0.12.0.1")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.1")]
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/csharp/src/Thrift.csproj
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/csharp/src/Thrift.csproj
generated
vendored
|
@ -45,7 +45,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.12.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
|
@ -153,4 +153,4 @@
|
|||
<ProjectExtensions>
|
||||
<VisualStudio AllowExistingFolder="true" />
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
27
vendor/git.apache.org/thrift.git/lib/csharp/src/Transport/TBufferedTransport.cs
generated
vendored
27
vendor/git.apache.org/thrift.git/lib/csharp/src/Transport/TBufferedTransport.cs
generated
vendored
|
@ -81,7 +81,7 @@ namespace Thrift.Transport
|
|||
inputBuffer.Capacity = bufSize;
|
||||
|
||||
while (true)
|
||||
{
|
||||
{
|
||||
int got = inputBuffer.Read(buf, off, len);
|
||||
if (got > 0)
|
||||
return got;
|
||||
|
@ -129,9 +129,8 @@ namespace Thrift.Transport
|
|||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
private void InternalFlush()
|
||||
{
|
||||
CheckNotDisposed();
|
||||
if (!IsOpen)
|
||||
throw new TTransportException(TTransportException.ExceptionType.NotOpen);
|
||||
if (outputBuffer.Length > 0)
|
||||
|
@ -139,9 +138,31 @@ namespace Thrift.Transport
|
|||
transport.Write(outputBuffer.GetBuffer(), 0, (int)outputBuffer.Length);
|
||||
outputBuffer.SetLength(0);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
CheckNotDisposed();
|
||||
InternalFlush();
|
||||
|
||||
transport.Flush();
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginFlush(AsyncCallback callback, object state)
|
||||
{
|
||||
CheckNotDisposed();
|
||||
InternalFlush();
|
||||
|
||||
return transport.BeginFlush( callback, state);
|
||||
}
|
||||
|
||||
public override void EndFlush(IAsyncResult asyncResult)
|
||||
{
|
||||
transport.EndFlush( asyncResult);
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void CheckNotDisposed()
|
||||
{
|
||||
if (_IsDisposed)
|
||||
|
|
21
vendor/git.apache.org/thrift.git/lib/csharp/src/Transport/TFramedTransport.cs
generated
vendored
21
vendor/git.apache.org/thrift.git/lib/csharp/src/Transport/TFramedTransport.cs
generated
vendored
|
@ -108,7 +108,7 @@ namespace Thrift.Transport
|
|||
writeBuffer.Write(buf, off, len);
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
private void InternalFlush()
|
||||
{
|
||||
CheckNotDisposed();
|
||||
if (!IsOpen)
|
||||
|
@ -126,10 +126,29 @@ namespace Thrift.Transport
|
|||
transport.Write(buf, 0, len);
|
||||
|
||||
InitWriteBuffer();
|
||||
}
|
||||
|
||||
public override void Flush()
|
||||
{
|
||||
CheckNotDisposed();
|
||||
InternalFlush();
|
||||
|
||||
transport.Flush();
|
||||
}
|
||||
|
||||
public override IAsyncResult BeginFlush(AsyncCallback callback, object state)
|
||||
{
|
||||
CheckNotDisposed();
|
||||
InternalFlush();
|
||||
|
||||
return transport.BeginFlush( callback, state);
|
||||
}
|
||||
|
||||
public override void EndFlush(IAsyncResult asyncResult)
|
||||
{
|
||||
transport.EndFlush( asyncResult);
|
||||
}
|
||||
|
||||
private void InitWriteBuffer()
|
||||
{
|
||||
// Reserve space for message header to be put right before sending it out
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.12.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
|
@ -145,4 +145,4 @@ for %25%25I in ("%25THRIFT_FILE%25") do set THRIFT_SHORT=%25%25~fsI
|
|||
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("0.12.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.0")]
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<ApplicationVersion>0.12.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
|
@ -145,4 +145,4 @@ for %25%25I in ("%25THRIFT_FILE%25") do set THRIFT_SHORT=%25%25~fsI
|
|||
|
||||
</PreBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -51,5 +51,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("0.12.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.0")]
|
||||
|
|
|
@ -49,5 +49,5 @@ using System.Runtime.InteropServices;
|
|||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
[assembly: AssemblyVersion("0.12.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.0")]
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/base.d
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/d/src/thrift/base.d
generated
vendored
|
@ -50,7 +50,7 @@ class TCompoundOperationException : TException {
|
|||
/// The Thrift version string, used for informative purposes.
|
||||
// Note: This is currently hardcoded, but will likely be filled in by the build
|
||||
// system in future versions.
|
||||
enum VERSION = "1.0.0 dev";
|
||||
enum VERSION = "0.12.0";
|
||||
|
||||
/**
|
||||
* Functions used for logging inside Thrift.
|
||||
|
|
42
vendor/git.apache.org/thrift.git/lib/d/test/client_pool_test.d
generated
vendored
42
vendor/git.apache.org/thrift.git/lib/d/test/client_pool_test.d
generated
vendored
|
@ -18,6 +18,7 @@
|
|||
*/
|
||||
module client_pool_test;
|
||||
|
||||
import core.sync.semaphore : Semaphore;
|
||||
import core.time : Duration, dur;
|
||||
import core.thread : Thread;
|
||||
import std.algorithm;
|
||||
|
@ -28,6 +29,7 @@ import std.getopt;
|
|||
import std.range;
|
||||
import std.stdio;
|
||||
import std.typecons;
|
||||
import std.variant : Variant;
|
||||
import thrift.base;
|
||||
import thrift.async.libevent;
|
||||
import thrift.async.socket;
|
||||
|
@ -37,9 +39,12 @@ import thrift.codegen.async_client_pool;
|
|||
import thrift.codegen.client;
|
||||
import thrift.codegen.client_pool;
|
||||
import thrift.codegen.processor;
|
||||
import thrift.protocol.base;
|
||||
import thrift.protocol.binary;
|
||||
import thrift.server.base;
|
||||
import thrift.server.simple;
|
||||
import thrift.server.transport.socket;
|
||||
import thrift.transport.base;
|
||||
import thrift.transport.buffered;
|
||||
import thrift.transport.socket;
|
||||
import thrift.util.cancellation;
|
||||
|
@ -108,11 +113,29 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
class ServerPreServeHandler : TServerEventHandler {
|
||||
this(Semaphore sem) {
|
||||
sem_ = sem;
|
||||
}
|
||||
|
||||
override void preServe() {
|
||||
sem_.notify();
|
||||
}
|
||||
|
||||
Variant createContext(TProtocol input, TProtocol output) { return Variant.init; }
|
||||
void deleteContext(Variant serverContext, TProtocol input, TProtocol output) {}
|
||||
void preProcess(Variant serverContext, TTransport transport) {}
|
||||
|
||||
private:
|
||||
Semaphore sem_;
|
||||
}
|
||||
|
||||
class ServerThread : Thread {
|
||||
this(ExTestHandler handler, TCancellation cancellation) {
|
||||
this(ExTestHandler handler, ServerPreServeHandler serverHandler, TCancellation cancellation) {
|
||||
super(&run);
|
||||
handler_ = handler;
|
||||
cancellation_ = cancellation;
|
||||
serverHandler_ = serverHandler;
|
||||
}
|
||||
private:
|
||||
void run() {
|
||||
|
@ -123,16 +146,17 @@ private:
|
|||
serverTransport.recvTimeout = dur!"seconds"(3);
|
||||
auto transportFactory = new TBufferedTransportFactory;
|
||||
|
||||
auto server = new TSimpleServer(
|
||||
processor, serverTransport, transportFactory, protocolFactory);
|
||||
auto server = new TSimpleServer(processor, serverTransport, transportFactory, protocolFactory);
|
||||
server.eventHandler = serverHandler_;
|
||||
server.serve(cancellation_);
|
||||
} catch (Exception e) {
|
||||
writefln("Server thread on port %s failed: %s", handler_.port, e);
|
||||
}
|
||||
}
|
||||
|
||||
TCancellation cancellation_;
|
||||
ExTestHandler handler_;
|
||||
ServerPreServeHandler serverHandler_;
|
||||
TCancellation cancellation_;
|
||||
}
|
||||
|
||||
void main(string[] args) {
|
||||
|
@ -145,6 +169,9 @@ void main(string[] args) {
|
|||
|
||||
immutable ports = cast(immutable)array(map!"cast(ushort)a"(iota(port, port + 6)));
|
||||
|
||||
// semaphore that will be incremented whenever each server thread has bound and started listening
|
||||
Semaphore sem = new Semaphore(0);
|
||||
|
||||
version (none) {
|
||||
// Cannot use this due to multiple DMD @@BUG@@s:
|
||||
// 1. »function D main is a nested function and cannot be accessed from array«
|
||||
|
@ -174,11 +201,10 @@ version (none) {
|
|||
}
|
||||
|
||||
// Fire up the server threads.
|
||||
foreach (h; handlers) (new ServerThread(h, serverCancellation)).start();
|
||||
foreach (h; handlers) (new ServerThread(h, new ServerPreServeHandler(sem), serverCancellation)).start();
|
||||
|
||||
// Give the servers some time to get up. This should really be accomplished
|
||||
// via a barrier here and in the preServe() hook.
|
||||
Thread.sleep(dur!"msecs"(10));
|
||||
// wait until all the handlers signal that they're ready to serve
|
||||
foreach (h; handlers) (sem.wait(dur!`seconds`(1)));
|
||||
|
||||
syncClientPoolTest(ports, handlers);
|
||||
asyncClientPoolTest(ports, handlers);
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/dart/pubspec.yaml
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/dart/pubspec.yaml
generated
vendored
|
@ -16,7 +16,7 @@
|
|||
# under the License.
|
||||
|
||||
name: thrift
|
||||
version: 1.0.0-dev
|
||||
version: 0.12.0
|
||||
description: >
|
||||
A Dart library for Apache Thrift
|
||||
author: Apache Thrift Developers <dev@thrift.apache.org>
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/delphi/src/Thrift.pas
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/delphi/src/Thrift.pas
generated
vendored
|
@ -27,7 +27,7 @@ uses
|
|||
Thrift.Protocol;
|
||||
|
||||
const
|
||||
Version = '1.0.0-dev';
|
||||
Version = '0.12.0';
|
||||
|
||||
type
|
||||
TException = Thrift.Exception.TException; // compatibility alias
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/go/README.md
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/go/README.md
generated
vendored
|
@ -29,7 +29,7 @@ Thrift supports Go 1.7+
|
|||
In following Go conventions, we recommend you use the 'go' tool to install
|
||||
Thrift for go.
|
||||
|
||||
$ go get git.apache.org/thrift.git/lib/go/thrift/...
|
||||
$ go get github.com/apache/thrift/lib/go/thrift/...
|
||||
|
||||
Will retrieve and install the most recent version of the package.
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_types_test.go
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/go/thrift/serializer_types_test.go
generated
vendored
|
@ -19,7 +19,7 @@
|
|||
|
||||
package thrift
|
||||
|
||||
// Autogenerated by Thrift Compiler (1.0.0-dev)
|
||||
// Autogenerated by Thrift Compiler (0.12.0)
|
||||
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
||||
|
||||
/* THE FOLLOWING THRIFT FILE WAS USED TO CREATE THIS
|
||||
|
|
15
vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket.go
generated
vendored
15
vendor/git.apache.org/thrift.git/lib/go/thrift/server_socket.go
generated
vendored
|
@ -75,7 +75,9 @@ func (p *TServerSocket) Accept() (TTransport, error) {
|
|||
return nil, errTransportInterrupted
|
||||
}
|
||||
|
||||
p.mu.Lock()
|
||||
listener := p.listener
|
||||
p.mu.Unlock()
|
||||
if listener == nil {
|
||||
return nil, NewTTransportException(NOT_OPEN, "No underlying server socket")
|
||||
}
|
||||
|
@ -115,19 +117,20 @@ func (p *TServerSocket) Addr() net.Addr {
|
|||
}
|
||||
|
||||
func (p *TServerSocket) Close() error {
|
||||
defer func() {
|
||||
p.listener = nil
|
||||
}()
|
||||
var err error
|
||||
p.mu.Lock()
|
||||
if p.IsListening() {
|
||||
return p.listener.Close()
|
||||
err = p.listener.Close()
|
||||
p.listener = nil
|
||||
}
|
||||
return nil
|
||||
p.mu.Unlock()
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *TServerSocket) Interrupt() error {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.interrupted = true
|
||||
p.mu.Unlock()
|
||||
p.Close()
|
||||
|
||||
return nil
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/haxe/README.md
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/haxe/README.md
generated
vendored
|
@ -71,8 +71,8 @@ either from the official ASF repo, or via the github mirror.
|
|||
|
||||
- To set up any **stable version**, choose the appropriate branch (e.g. `0.10.0`):
|
||||
|
||||
- `haxelib git thrift https://git.apache.org/thrift.git 0.10.0 lib/haxe`
|
||||
- `haxelib git thrift https://github.com/apache/thrift.git 0.10.0 lib/haxe`
|
||||
- `haxelib git thrift https://git.apache.org/thrift.git 0.12.0 lib/haxe`
|
||||
- `haxelib git thrift https://github.com/apache/thrift.git 0.12.0 lib/haxe`
|
||||
|
||||
- To set up the current **development version**, use the `master` branch:
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/haxe/haxelib.json
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/haxe/haxelib.json
generated
vendored
|
@ -4,7 +4,7 @@
|
|||
"license": "Apache",
|
||||
"tags": ["thrift", "rpc", "serialization", "cross", "framework"],
|
||||
"description": "Haxe bindings for the Apache Thrift RPC and serialization framework",
|
||||
"version": "1.0.0-dev",
|
||||
"version": "0.12.0",
|
||||
"releasenote": "Licensed under Apache License, Version 2.0. The Apache Thrift compiler needs to be installed separately.",
|
||||
"contributors": ["Apache Software Foundation (ASF)"],
|
||||
"dependencies": { },
|
||||
|
|
8
vendor/git.apache.org/thrift.git/lib/hs/Thrift.cabal
generated
vendored
8
vendor/git.apache.org/thrift.git/lib/hs/Thrift.cabal
generated
vendored
|
@ -18,8 +18,8 @@
|
|||
--
|
||||
|
||||
Name: thrift
|
||||
Version: 1.0.0-dev
|
||||
Cabal-Version: >= 1.24
|
||||
Version: 0.12.0
|
||||
Cabal-Version: 1.24
|
||||
License: OtherLicense
|
||||
Category: Foreign
|
||||
Build-Type: Simple
|
||||
|
@ -63,8 +63,7 @@ Library
|
|||
Thrift.Transport.IOBuffer,
|
||||
Thrift.Transport.Memory,
|
||||
Thrift.Types
|
||||
Default-Language:
|
||||
Haskell2010
|
||||
Default-Language: Haskell2010
|
||||
Default-Extensions:
|
||||
DeriveDataTypeable,
|
||||
ExistentialQuantification,
|
||||
|
@ -82,3 +81,4 @@ Test-Suite spec
|
|||
Ghc-Options: -Wall
|
||||
main-is: Spec.hs
|
||||
Build-Depends: base, thrift, hspec, QuickCheck >= 2.8.2, bytestring >= 0.10, unordered-containers >= 0.2.6
|
||||
Default-Language: Haskell2010
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/java/gradle.properties
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/java/gradle.properties
generated
vendored
|
@ -1,9 +1,9 @@
|
|||
# This file is shared currently between this Gradle build and the
|
||||
# Ant builds for fd303 and JavaScript. Keep the dotted notation for
|
||||
# the properties to minimize the changes in the dependencies.
|
||||
thrift.version=1.0.0
|
||||
thrift.version=0.12.0
|
||||
thrift.groupid=org.apache.thrift
|
||||
release=false
|
||||
release=true
|
||||
|
||||
# Local Install paths
|
||||
install.path=/usr/local/lib
|
||||
|
|
42
vendor/git.apache.org/thrift.git/lib/js/Gruntfile.js
generated
vendored
42
vendor/git.apache.org/thrift.git/lib/js/Gruntfile.js
generated
vendored
|
@ -221,31 +221,37 @@ module.exports = function(grunt) {
|
|||
// The main thrift library file. not es6 yet :(
|
||||
lib: {
|
||||
src: ['src/**/*.js'],
|
||||
options: {
|
||||
// options here to override JSHint defaults
|
||||
globals: {
|
||||
jQuery: true,
|
||||
console: true,
|
||||
module: true,
|
||||
document: true,
|
||||
},
|
||||
}
|
||||
},
|
||||
// The test files use es6
|
||||
test: {
|
||||
src: ['Gruntfile.js', 'test/*.js'],
|
||||
options: {
|
||||
// options here to override JSHint defaults
|
||||
globals: {
|
||||
jQuery: true,
|
||||
console: true,
|
||||
module: true,
|
||||
document: true,
|
||||
},
|
||||
esversion: 6,
|
||||
}
|
||||
},
|
||||
}
|
||||
gen_js_code: {
|
||||
src: ['test/gen-js/*.js', 'test/gen-js-jquery/*.js'],
|
||||
},
|
||||
gen_es6_code: {
|
||||
src: ['test/gen-js-es6/*.js'],
|
||||
options: {
|
||||
esversion: 6,
|
||||
}
|
||||
},
|
||||
gen_node_code: {
|
||||
src: ['test/gen-nodejs/*.js'],
|
||||
options: {
|
||||
node: true,
|
||||
}
|
||||
},
|
||||
gen_node_es6_code: {
|
||||
src: ['test/gen-nodejs-es6/*.js'],
|
||||
options: {
|
||||
node: true,
|
||||
esversion: 6,
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
|
@ -269,8 +275,8 @@ module.exports = function(grunt) {
|
|||
]);
|
||||
|
||||
grunt.registerTask('test', [
|
||||
'jshint',
|
||||
'installAndGenerate',
|
||||
'jshint',
|
||||
'shell:ThriftTestServer', 'shell:ThriftTestServer_TLS',
|
||||
'shell:ThriftTestServerES6', 'shell:ThriftTestServerES6_TLS',
|
||||
'wait',
|
||||
|
|
3094
vendor/git.apache.org/thrift.git/lib/js/package-lock.json
generated
vendored
3094
vendor/git.apache.org/thrift.git/lib/js/package-lock.json
generated
vendored
File diff suppressed because it is too large
Load diff
2
vendor/git.apache.org/thrift.git/lib/js/package.json
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/js/package.json
generated
vendored
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "thrift",
|
||||
"version": "1.0.0",
|
||||
"version": "0.12.0",
|
||||
"devDependencies": {
|
||||
"grunt": "^1.0.2",
|
||||
"grunt-cli": "^1.2.0",
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/js/src/thrift.js
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/js/src/thrift.js
generated
vendored
|
@ -46,7 +46,7 @@ var Thrift = {
|
|||
* @const {string} Version
|
||||
* @memberof Thrift
|
||||
*/
|
||||
Version: '1.0.0-dev',
|
||||
Version: '0.12.0',
|
||||
|
||||
/**
|
||||
* Thrift IDL type string to Id mapping.
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/lua/THttpTransport.lua
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/lua/THttpTransport.lua
generated
vendored
|
@ -25,7 +25,7 @@ THttpTransport = TTransportBase:new{
|
|||
wBuf = '',
|
||||
rBuf = '',
|
||||
CRLF = '\r\n',
|
||||
VERSION = '1.0.0',
|
||||
VERSION = '0.12.0',
|
||||
isServer = true
|
||||
}
|
||||
|
||||
|
|
2
vendor/git.apache.org/thrift.git/lib/lua/Thrift.lua
generated
vendored
2
vendor/git.apache.org/thrift.git/lib/lua/Thrift.lua
generated
vendored
|
@ -48,7 +48,7 @@ function ttable_size(t)
|
|||
return count
|
||||
end
|
||||
|
||||
version = 1.0
|
||||
version = '0.12.0'
|
||||
|
||||
TType = {
|
||||
STOP = 0,
|
||||
|
|
4
vendor/git.apache.org/thrift.git/lib/netcore/Thrift/Properties/AssemblyInfo.cs
generated
vendored
4
vendor/git.apache.org/thrift.git/lib/netcore/Thrift/Properties/AssemblyInfo.cs
generated
vendored
|
@ -52,5 +52,5 @@ using System.Runtime.InteropServices;
|
|||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.0.0.1")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.1")]
|
||||
[assembly: AssemblyVersion("0.12.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.12.0.0")]
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace Thrift.Transports.Client
|
|||
}
|
||||
|
||||
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/x-thrift"));
|
||||
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "1.0.0"));
|
||||
httpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("THttpClientTransport", "0.12.0"));
|
||||
|
||||
if (CustomHeaders != null)
|
||||
{
|
||||
|
@ -223,4 +223,4 @@ namespace Thrift.Transports.Client
|
|||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
3
vendor/git.apache.org/thrift.git/lib/nodejs/Makefile.am
generated
vendored
3
vendor/git.apache.org/thrift.git/lib/nodejs/Makefile.am
generated
vendored
|
@ -27,8 +27,9 @@ all-local: deps
|
|||
|
||||
precross: deps stubs
|
||||
|
||||
# TODO: Lint nodejs lib and gen-code as part of build
|
||||
check: deps
|
||||
cd $(top_srcdir) && $(NPM) test && cd lib/nodejs
|
||||
cd $(top_srcdir) && $(NPM) test && $(NPM) run lint-tests && cd lib/nodejs
|
||||
|
||||
clean-local:
|
||||
$(RM) -r test/gen-nodejs
|
||||
|
|
1
vendor/git.apache.org/thrift.git/lib/nodejs/lib/thrift/json_protocol.js
generated
vendored
1
vendor/git.apache.org/thrift.git/lib/nodejs/lib/thrift/json_protocol.js
generated
vendored
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
|
||||
var Int64 = require('node-int64');
|
||||
var InputBufferUnderrunError = require('./transport').InputBufferUnderrunError;
|
||||
var Thrift = require('./thrift');
|
||||
var Type = Thrift.Type;
|
||||
var util = require("util");
|
||||
|
|
143
vendor/git.apache.org/thrift.git/lib/nodejs/test/binary.test.js
generated
vendored
143
vendor/git.apache.org/thrift.git/lib/nodejs/test/binary.test.js
generated
vendored
|
@ -17,19 +17,19 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
var test = require('tape');
|
||||
var binary = require('thrift/binary');
|
||||
const test = require("tape");
|
||||
const binary = require("thrift/binary");
|
||||
|
||||
var cases = {
|
||||
"Should read signed byte": function(assert){
|
||||
const cases = {
|
||||
"Should read signed byte": function(assert) {
|
||||
assert.equal(1, binary.readByte(0x01));
|
||||
assert.equal(-1, binary.readByte(0xFF));
|
||||
assert.equal(-1, binary.readByte(0xff));
|
||||
|
||||
assert.equal(127, binary.readByte(0x7F));
|
||||
assert.equal(127, binary.readByte(0x7f));
|
||||
assert.equal(-128, binary.readByte(0x80));
|
||||
assert.end();
|
||||
},
|
||||
"Should write byte": function(assert){
|
||||
"Should write byte": function(assert) {
|
||||
//Protocol simply writes to the buffer. Nothing to test.. yet.
|
||||
assert.ok(true);
|
||||
assert.end();
|
||||
|
@ -76,58 +76,135 @@ var cases = {
|
|||
assert.deepEqual([0xff, 0xff, 0xff, 0xff], binary.writeI32([], -1));
|
||||
|
||||
// Min I32
|
||||
assert.deepEqual([0x80, 0x00, 0x00, 0x00], binary.writeI32([], -2147483648));
|
||||
assert.deepEqual(
|
||||
[0x80, 0x00, 0x00, 0x00],
|
||||
binary.writeI32([], -2147483648)
|
||||
);
|
||||
// Max I32
|
||||
assert.deepEqual([0x7f, 0xff, 0xff, 0xff], binary.writeI32([], 2147483647));
|
||||
assert.end();
|
||||
},
|
||||
|
||||
"Should read doubles": function(assert) {
|
||||
assert.equal(0, binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(0, binary.readDouble([0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(1, binary.readDouble([0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(2, binary.readDouble([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(-2, binary.readDouble([0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(
|
||||
0,
|
||||
binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
assert.equal(
|
||||
0,
|
||||
binary.readDouble([0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
assert.equal(
|
||||
1,
|
||||
binary.readDouble([0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
assert.equal(
|
||||
2,
|
||||
binary.readDouble([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
assert.equal(
|
||||
-2,
|
||||
binary.readDouble([0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
|
||||
assert.equal(Math.PI, binary.readDouble([0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18]))
|
||||
assert.equal(
|
||||
Math.PI,
|
||||
binary.readDouble([0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18])
|
||||
);
|
||||
|
||||
assert.equal(Infinity, binary.readDouble([0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(-Infinity, binary.readDouble([0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(
|
||||
Infinity,
|
||||
binary.readDouble([0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
assert.equal(
|
||||
-Infinity,
|
||||
binary.readDouble([0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
|
||||
assert.ok(isNaN(binary.readDouble([0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])))
|
||||
assert.ok(
|
||||
isNaN(binary.readDouble([0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
);
|
||||
|
||||
assert.equal(1/3, binary.readDouble([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55]))
|
||||
assert.equal(
|
||||
1 / 3,
|
||||
binary.readDouble([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55])
|
||||
);
|
||||
|
||||
// Min subnormal positive double
|
||||
assert.equal(4.9406564584124654e-324, binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]))
|
||||
assert.equal(
|
||||
4.9406564584124654e-324,
|
||||
binary.readDouble([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01])
|
||||
);
|
||||
// Min normal positive double
|
||||
assert.equal(2.2250738585072014e-308, binary.readDouble([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))
|
||||
assert.equal(
|
||||
2.2250738585072014e-308,
|
||||
binary.readDouble([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00])
|
||||
);
|
||||
// Max positive double
|
||||
assert.equal(1.7976931348623157e308, binary.readDouble([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]))
|
||||
assert.equal(
|
||||
1.7976931348623157e308,
|
||||
binary.readDouble([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff])
|
||||
);
|
||||
assert.end();
|
||||
},
|
||||
|
||||
"Should write doubles": function(assert) {
|
||||
assert.deepEqual([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 0));
|
||||
assert.deepEqual([0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 1));
|
||||
assert.deepEqual([0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 2));
|
||||
assert.deepEqual([0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], -2));
|
||||
assert.deepEqual(
|
||||
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], 0)
|
||||
);
|
||||
assert.deepEqual(
|
||||
[0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], 1)
|
||||
);
|
||||
assert.deepEqual(
|
||||
[0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], 2)
|
||||
);
|
||||
assert.deepEqual(
|
||||
[0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], -2)
|
||||
);
|
||||
|
||||
assert.deepEqual([0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18], binary.writeDouble([], Math.PI));
|
||||
assert.deepEqual(
|
||||
[0x40, 0x9, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18],
|
||||
binary.writeDouble([], Math.PI)
|
||||
);
|
||||
|
||||
assert.deepEqual([0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], Infinity));
|
||||
assert.deepEqual([0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], -Infinity));
|
||||
assert.deepEqual(
|
||||
[0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], Infinity)
|
||||
);
|
||||
assert.deepEqual(
|
||||
[0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], -Infinity)
|
||||
);
|
||||
|
||||
assert.deepEqual([0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], NaN));
|
||||
assert.deepEqual(
|
||||
[0x7f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], NaN)
|
||||
);
|
||||
|
||||
assert.deepEqual([0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55], binary.writeDouble([], 1/3));
|
||||
assert.deepEqual(
|
||||
[0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55],
|
||||
binary.writeDouble([], 1 / 3)
|
||||
);
|
||||
|
||||
// Min subnormal positive double
|
||||
assert.deepEqual([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01], binary.writeDouble([], 4.9406564584124654e-324));
|
||||
assert.deepEqual(
|
||||
[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01],
|
||||
binary.writeDouble([], 4.9406564584124654e-324)
|
||||
);
|
||||
// Min normal positive double
|
||||
assert.deepEqual([0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], binary.writeDouble([], 2.2250738585072014e-308));
|
||||
assert.deepEqual(
|
||||
[0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00],
|
||||
binary.writeDouble([], 2.2250738585072014e-308)
|
||||
);
|
||||
// Max positive double
|
||||
assert.deepEqual([0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff], binary.writeDouble([], 1.7976931348623157e308));
|
||||
assert.deepEqual(
|
||||
[0x7f, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff],
|
||||
binary.writeDouble([], 1.7976931348623157e308)
|
||||
);
|
||||
assert.end();
|
||||
}
|
||||
};
|
||||
|
|
138
vendor/git.apache.org/thrift.git/lib/nodejs/test/client.js
generated
vendored
138
vendor/git.apache.org/thrift.git/lib/nodejs/test/client.js
generated
vendored
|
@ -19,125 +19,149 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var assert = require('assert');
|
||||
var thrift = require('thrift');
|
||||
var helpers = require('./helpers');
|
||||
var ThriftTest = require('./gen-nodejs/ThriftTest');
|
||||
var ThriftTestDriver = require('./test_driver').ThriftTestDriver;
|
||||
var ThriftTestDriverPromise = require('./test_driver').ThriftTestDriverPromise;
|
||||
var SecondService = require('./gen-nodejs/SecondService');
|
||||
var ttypes = require('./gen-nodejs/ThriftTest_types');
|
||||
const assert = require("assert");
|
||||
const thrift = require("thrift");
|
||||
const helpers = require("./helpers");
|
||||
|
||||
var program = require('commander');
|
||||
const ThriftTest = require(`./${helpers.genPath}/ThriftTest`);
|
||||
const ThriftTestDriver = require("./test_driver").ThriftTestDriver;
|
||||
const ThriftTestDriverPromise = require("./test_driver")
|
||||
.ThriftTestDriverPromise;
|
||||
const SecondService = require(`./${helpers.genPath}/SecondService`);
|
||||
|
||||
const program = require("commander");
|
||||
|
||||
program
|
||||
.option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json) [protocol]')
|
||||
.option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http) [transport]')
|
||||
.option('--port <port>', 'Set thrift server port number to connect', 9090)
|
||||
.option('--host <host>', 'Set thrift server host to connect', 'localhost')
|
||||
.option('--domain-socket <path>', 'Set thrift server unix domain socket to connect')
|
||||
.option('--ssl', 'use SSL transport')
|
||||
.option('--promise', 'test with promise style functions')
|
||||
.option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
|
||||
.option(
|
||||
"-p, --protocol <protocol>",
|
||||
"Set thrift protocol (binary|compact|json) [protocol]"
|
||||
)
|
||||
.option(
|
||||
"-t, --transport <transport>",
|
||||
"Set thrift transport (buffered|framed|http) [transport]"
|
||||
)
|
||||
.option("--port <port>", "Set thrift server port number to connect", 9090)
|
||||
.option("--host <host>", "Set thrift server host to connect", "localhost")
|
||||
.option(
|
||||
"--domain-socket <path>",
|
||||
"Set thrift server unix domain socket to connect"
|
||||
)
|
||||
.option("--ssl", "use SSL transport")
|
||||
.option("--callback", "test with callback style functions")
|
||||
.option(
|
||||
"-t, --type <type>",
|
||||
"Select server type (http|multiplex|tcp|websocket)",
|
||||
"tcp"
|
||||
)
|
||||
.option("--es6", "Use es6 code")
|
||||
.option("--es5", "Use es5 code")
|
||||
.parse(process.argv);
|
||||
|
||||
var host = program.host;
|
||||
var port = program.port;
|
||||
var domainSocket = program.domainSocket;
|
||||
var type = program.type;
|
||||
var ssl = program.ssl;
|
||||
var promise = program.promise;
|
||||
const host = program.host;
|
||||
const port = program.port;
|
||||
const domainSocket = program.domainSocket;
|
||||
const ssl = program.ssl;
|
||||
let type = program.type;
|
||||
|
||||
/* for compatibility with cross test invocation for http transport testing */
|
||||
if (program.transport === 'http') {
|
||||
program.transport = 'buffered';
|
||||
type = 'http';
|
||||
if (program.transport === "http") {
|
||||
program.transport = "buffered";
|
||||
type = "http";
|
||||
}
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
transport: helpers.transports[program.transport],
|
||||
protocol: helpers.protocols[program.protocol]
|
||||
};
|
||||
|
||||
if (type === 'http' || type === 'websocket') {
|
||||
options.path = '/test';
|
||||
if (type === "http" || type === "websocket") {
|
||||
options.path = "/test";
|
||||
}
|
||||
|
||||
if (type === 'http') {
|
||||
options.headers = {"Connection": "close"};
|
||||
if (type === "http") {
|
||||
options.headers = { Connection: "close" };
|
||||
}
|
||||
|
||||
if (ssl) {
|
||||
if (type === 'tcp' || type === 'multiplex') {
|
||||
if (type === "tcp" || type === "multiplex") {
|
||||
options.rejectUnauthorized = false;
|
||||
} else if (type === 'http') {
|
||||
} else if (type === "http") {
|
||||
options.nodeOptions = { rejectUnauthorized: false };
|
||||
options.https = true;
|
||||
} else if (type === 'websocket') {
|
||||
} else if (type === "websocket") {
|
||||
options.wsOptions = { rejectUnauthorized: false };
|
||||
options.secure = true;
|
||||
}
|
||||
}
|
||||
|
||||
var connection;
|
||||
var client;
|
||||
var testDriver = promise ? ThriftTestDriverPromise : ThriftTestDriver;
|
||||
let connection;
|
||||
let client;
|
||||
const testDriver = program.callback
|
||||
? ThriftTestDriver
|
||||
: ThriftTestDriverPromise;
|
||||
if (helpers.ecmaMode === "es6" && program.callback) {
|
||||
console.log("ES6 does not support callback style");
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (type === 'tcp' || type === 'multiplex') {
|
||||
if (type === "tcp" || type === "multiplex") {
|
||||
if (domainSocket) {
|
||||
connection = thrift.createUDSConnection(domainSocket, options);
|
||||
} else {
|
||||
connection = ssl ?
|
||||
thrift.createSSLConnection(host, port, options) :
|
||||
thrift.createConnection(host, port, options);
|
||||
connection = ssl
|
||||
? thrift.createSSLConnection(host, port, options)
|
||||
: thrift.createConnection(host, port, options);
|
||||
}
|
||||
} else if (type === 'http') {
|
||||
} else if (type === "http") {
|
||||
if (domainSocket) {
|
||||
connection = thrift.createHttpUDSConnection(domainSocket, options);
|
||||
} else {
|
||||
connection = thrift.createHttpConnection(host, port, options);
|
||||
}
|
||||
} else if (type === 'websocket') {
|
||||
} else if (type === "websocket") {
|
||||
connection = thrift.createWSConnection(host, port, options);
|
||||
connection.open();
|
||||
}
|
||||
|
||||
connection.on('error', function(err) {
|
||||
assert(false, err);
|
||||
connection.on("error", function(err) {
|
||||
assert(false, err);
|
||||
});
|
||||
|
||||
if (type === 'tcp') {
|
||||
if (type === "tcp") {
|
||||
client = thrift.createClient(ThriftTest, connection);
|
||||
runTests();
|
||||
} else if (type === 'multiplex') {
|
||||
var mp = new thrift.Multiplexer();
|
||||
} else if (type === "multiplex") {
|
||||
const mp = new thrift.Multiplexer();
|
||||
client = mp.createClient("ThriftTest", ThriftTest, connection);
|
||||
secondclient = mp.createClient("SecondService", SecondService, connection);
|
||||
const secondclient = mp.createClient(
|
||||
"SecondService",
|
||||
SecondService,
|
||||
connection
|
||||
);
|
||||
|
||||
connection.on('connect', function() {
|
||||
connection.on("connect", function() {
|
||||
secondclient.secondtestString("Test", function(err, response) {
|
||||
assert(!err);
|
||||
assert.equal("testString(\"Test\")", response);
|
||||
assert.equal('testString("Test")', response);
|
||||
});
|
||||
|
||||
runTests();
|
||||
});
|
||||
} else if (type === 'http') {
|
||||
} else if (type === "http") {
|
||||
client = thrift.createHttpClient(ThriftTest, connection);
|
||||
runTests();
|
||||
} else if (type === 'websocket') {
|
||||
} else if (type === "websocket") {
|
||||
client = thrift.createWSClient(ThriftTest, connection);
|
||||
runTests();
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
testDriver(client, function (status) {
|
||||
testDriver(client, function(status) {
|
||||
console.log(status);
|
||||
if (type !== 'http' && type !== 'websocket') {
|
||||
if (type !== "http" && type !== "websocket") {
|
||||
connection.end();
|
||||
}
|
||||
if (type !== 'multiplex') {
|
||||
if (type !== "multiplex") {
|
||||
process.exit(0);
|
||||
}
|
||||
});
|
||||
|
|
316
vendor/git.apache.org/thrift.git/lib/nodejs/test/deep-constructor.test.js
generated
vendored
316
vendor/git.apache.org/thrift.git/lib/nodejs/test/deep-constructor.test.js
generated
vendored
|
@ -17,39 +17,36 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
var ttypes = require('./gen-nodejs/JsDeepConstructorTest_types');
|
||||
var thrift = require('thrift');
|
||||
var test = require('tape');
|
||||
var bufferEquals = require('buffer-equals');
|
||||
const ttypes = require("./gen-nodejs/JsDeepConstructorTest_types");
|
||||
const thrift = require("thrift");
|
||||
const test = require("tape");
|
||||
const bufferEquals = require("buffer-equals");
|
||||
|
||||
function serializeBinary(data) {
|
||||
var buff;
|
||||
var transport = new thrift.TBufferedTransport(null, function(msg){
|
||||
let buff;
|
||||
const transport = new thrift.TBufferedTransport(null, function(msg) {
|
||||
buff = msg;
|
||||
});
|
||||
var prot = new thrift.TBinaryProtocol(transport);
|
||||
const prot = new thrift.TBinaryProtocol(transport);
|
||||
data.write(prot);
|
||||
prot.flush();
|
||||
return buff;
|
||||
|
||||
}
|
||||
|
||||
|
||||
function deserializeBinary(serialized, type) {
|
||||
var t = new thrift.TFramedTransport(serialized);
|
||||
var p = new thrift.TBinaryProtocol(t);
|
||||
var data = new type();
|
||||
const t = new thrift.TFramedTransport(serialized);
|
||||
const p = new thrift.TBinaryProtocol(t);
|
||||
const data = new type();
|
||||
data.read(p);
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
function serializeJSON(data) {
|
||||
var buff;
|
||||
var transport = new thrift.TBufferedTransport(null, function(msg){
|
||||
let buff;
|
||||
const transport = new thrift.TBufferedTransport(null, function(msg) {
|
||||
buff = msg;
|
||||
});
|
||||
var protocol = new thrift.TJSONProtocol(transport);
|
||||
const protocol = new thrift.TJSONProtocol(transport);
|
||||
protocol.writeMessageBegin("", 0, 0);
|
||||
data.write(protocol);
|
||||
protocol.writeMessageEnd();
|
||||
|
@ -57,45 +54,41 @@ function serializeJSON(data) {
|
|||
return buff;
|
||||
}
|
||||
|
||||
|
||||
function deserializeJSON(serialized, type) {
|
||||
var transport = new thrift.TFramedTransport(serialized);
|
||||
var protocol = new thrift.TJSONProtocol(transport);
|
||||
const transport = new thrift.TFramedTransport(serialized);
|
||||
const protocol = new thrift.TJSONProtocol(transport);
|
||||
protocol.readMessageBegin();
|
||||
var data = new type();
|
||||
const data = new type();
|
||||
data.read(protocol);
|
||||
protocol.readMessageEnd();
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
function createThriftObj() {
|
||||
|
||||
return new ttypes.Complex({
|
||||
|
||||
struct_field: new ttypes.Simple({value: 'a'}),
|
||||
struct_field: new ttypes.Simple({ value: "a" }),
|
||||
|
||||
struct_list_field: [
|
||||
new ttypes.Simple({value: 'b'}),
|
||||
new ttypes.Simple({value: 'c'}),
|
||||
new ttypes.Simple({ value: "b" }),
|
||||
new ttypes.Simple({ value: "c" })
|
||||
],
|
||||
|
||||
struct_set_field: [
|
||||
new ttypes.Simple({value: 'd'}),
|
||||
new ttypes.Simple({value: 'e'}),
|
||||
new ttypes.Simple({ value: "d" }),
|
||||
new ttypes.Simple({ value: "e" })
|
||||
],
|
||||
|
||||
struct_map_field: {
|
||||
A: new ttypes.Simple({value: 'f'}),
|
||||
B: new ttypes.Simple({value: 'g'})
|
||||
A: new ttypes.Simple({ value: "f" }),
|
||||
B: new ttypes.Simple({ value: "g" })
|
||||
},
|
||||
|
||||
struct_nested_containers_field: [
|
||||
[
|
||||
{
|
||||
C: [
|
||||
new ttypes.Simple({value: 'h'}),
|
||||
new ttypes.Simple({value: 'i'})
|
||||
new ttypes.Simple({ value: "h" }),
|
||||
new ttypes.Simple({ value: "i" })
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -104,59 +97,57 @@ function createThriftObj() {
|
|||
struct_nested_containers_field2: {
|
||||
D: [
|
||||
{
|
||||
DA: new ttypes.Simple({value: 'j'})
|
||||
DA: new ttypes.Simple({ value: "j" })
|
||||
},
|
||||
{
|
||||
DB: new ttypes.Simple({value: 'k'})
|
||||
DB: new ttypes.Simple({ value: "k" })
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
list_of_list_field: [
|
||||
['l00', 'l01', 'l02'],
|
||||
['l10', 'l11', 'l12'],
|
||||
['l20', 'l21', 'l22'],
|
||||
["l00", "l01", "l02"],
|
||||
["l10", "l11", "l12"],
|
||||
["l20", "l21", "l22"]
|
||||
],
|
||||
|
||||
list_of_list_of_list_field: [
|
||||
[['m000', 'm001', 'm002'], ['m010', 'm011', 'm012'], ['m020', 'm021', 'm022']],
|
||||
[['m100', 'm101', 'm102'], ['m110', 'm111', 'm112'], ['m120', 'm121', 'm122']],
|
||||
[['m200', 'm201', 'm202'], ['m210', 'm211', 'm212'], ['m220', 'm221', 'm222']],
|
||||
],
|
||||
|
||||
|
||||
[
|
||||
["m000", "m001", "m002"],
|
||||
["m010", "m011", "m012"],
|
||||
["m020", "m021", "m022"]
|
||||
],
|
||||
[
|
||||
["m100", "m101", "m102"],
|
||||
["m110", "m111", "m112"],
|
||||
["m120", "m121", "m122"]
|
||||
],
|
||||
[
|
||||
["m200", "m201", "m202"],
|
||||
["m210", "m211", "m212"],
|
||||
["m220", "m221", "m222"]
|
||||
]
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function createJsObj() {
|
||||
|
||||
return {
|
||||
struct_field: { value: "a" },
|
||||
|
||||
struct_field: {value: 'a'},
|
||||
struct_list_field: [{ value: "b" }, { value: "c" }],
|
||||
|
||||
struct_list_field: [
|
||||
{value: 'b'},
|
||||
{value: 'c'},
|
||||
],
|
||||
|
||||
struct_set_field: [
|
||||
{value: 'd'},
|
||||
{value: 'e'},
|
||||
],
|
||||
struct_set_field: [{ value: "d" }, { value: "e" }],
|
||||
|
||||
struct_map_field: {
|
||||
A: {value: 'f'},
|
||||
B: {value: 'g'}
|
||||
A: { value: "f" },
|
||||
B: { value: "g" }
|
||||
},
|
||||
|
||||
struct_nested_containers_field: [
|
||||
[
|
||||
{
|
||||
C: [
|
||||
{value: 'h'},
|
||||
{value: 'i'}
|
||||
]
|
||||
C: [{ value: "h" }, { value: "i" }]
|
||||
}
|
||||
]
|
||||
],
|
||||
|
@ -164,131 +155,142 @@ function createJsObj() {
|
|||
struct_nested_containers_field2: {
|
||||
D: [
|
||||
{
|
||||
DA: {value: 'j'}
|
||||
DA: { value: "j" }
|
||||
},
|
||||
{
|
||||
DB: {value: 'k'}
|
||||
DB: { value: "k" }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
list_of_list_field: [
|
||||
['l00', 'l01', 'l02'],
|
||||
['l10', 'l11', 'l12'],
|
||||
['l20', 'l21', 'l22'],
|
||||
["l00", "l01", "l02"],
|
||||
["l10", "l11", "l12"],
|
||||
["l20", "l21", "l22"]
|
||||
],
|
||||
|
||||
list_of_list_of_list_field: [
|
||||
[['m000', 'm001', 'm002'], ['m010', 'm011', 'm012'], ['m020', 'm021', 'm022']],
|
||||
[['m100', 'm101', 'm102'], ['m110', 'm111', 'm112'], ['m120', 'm121', 'm122']],
|
||||
[['m200', 'm201', 'm202'], ['m210', 'm211', 'm212'], ['m220', 'm221', 'm222']],
|
||||
],
|
||||
|
||||
[
|
||||
["m000", "m001", "m002"],
|
||||
["m010", "m011", "m012"],
|
||||
["m020", "m021", "m022"]
|
||||
],
|
||||
[
|
||||
["m100", "m101", "m102"],
|
||||
["m110", "m111", "m112"],
|
||||
["m120", "m121", "m122"]
|
||||
],
|
||||
[
|
||||
["m200", "m201", "m202"],
|
||||
["m210", "m211", "m212"],
|
||||
["m220", "m221", "m222"]
|
||||
]
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function assertValues(obj, assert) {
|
||||
assert.equals(obj.struct_field.value, 'a');
|
||||
assert.equals(obj.struct_list_field[0].value, 'b');
|
||||
assert.equals(obj.struct_list_field[1].value, 'c');
|
||||
assert.equals(obj.struct_set_field[0].value, 'd');
|
||||
assert.equals(obj.struct_set_field[1].value, 'e');
|
||||
assert.equals(obj.struct_map_field.A.value, 'f');
|
||||
assert.equals(obj.struct_map_field.B.value, 'g');
|
||||
assert.equals(obj.struct_nested_containers_field[0][0].C[0].value, 'h');
|
||||
assert.equals(obj.struct_nested_containers_field[0][0].C[1].value, 'i');
|
||||
assert.equals(obj.struct_nested_containers_field2.D[0].DA.value, 'j');
|
||||
assert.equals(obj.struct_nested_containers_field2.D[1].DB.value, 'k');
|
||||
assert.equals(obj.list_of_list_field[0][0], 'l00');
|
||||
assert.equals(obj.list_of_list_field[0][1], 'l01');
|
||||
assert.equals(obj.list_of_list_field[0][2], 'l02');
|
||||
assert.equals(obj.list_of_list_field[1][0], 'l10');
|
||||
assert.equals(obj.list_of_list_field[1][1], 'l11');
|
||||
assert.equals(obj.list_of_list_field[1][2], 'l12');
|
||||
assert.equals(obj.list_of_list_field[2][0], 'l20');
|
||||
assert.equals(obj.list_of_list_field[2][1], 'l21');
|
||||
assert.equals(obj.list_of_list_field[2][2], 'l22');
|
||||
assert.equals(obj.struct_field.value, "a");
|
||||
assert.equals(obj.struct_list_field[0].value, "b");
|
||||
assert.equals(obj.struct_list_field[1].value, "c");
|
||||
assert.equals(obj.struct_set_field[0].value, "d");
|
||||
assert.equals(obj.struct_set_field[1].value, "e");
|
||||
assert.equals(obj.struct_map_field.A.value, "f");
|
||||
assert.equals(obj.struct_map_field.B.value, "g");
|
||||
assert.equals(obj.struct_nested_containers_field[0][0].C[0].value, "h");
|
||||
assert.equals(obj.struct_nested_containers_field[0][0].C[1].value, "i");
|
||||
assert.equals(obj.struct_nested_containers_field2.D[0].DA.value, "j");
|
||||
assert.equals(obj.struct_nested_containers_field2.D[1].DB.value, "k");
|
||||
assert.equals(obj.list_of_list_field[0][0], "l00");
|
||||
assert.equals(obj.list_of_list_field[0][1], "l01");
|
||||
assert.equals(obj.list_of_list_field[0][2], "l02");
|
||||
assert.equals(obj.list_of_list_field[1][0], "l10");
|
||||
assert.equals(obj.list_of_list_field[1][1], "l11");
|
||||
assert.equals(obj.list_of_list_field[1][2], "l12");
|
||||
assert.equals(obj.list_of_list_field[2][0], "l20");
|
||||
assert.equals(obj.list_of_list_field[2][1], "l21");
|
||||
assert.equals(obj.list_of_list_field[2][2], "l22");
|
||||
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][0], 'm000');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][1], 'm001');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][2], 'm002');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][0], 'm010');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][1], 'm011');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][2], 'm012');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][0], 'm020');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][1], 'm021');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][2], 'm022');
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][0], "m000");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][1], "m001");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][0][2], "m002");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][0], "m010");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][1], "m011");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][1][2], "m012");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][0], "m020");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][1], "m021");
|
||||
assert.equals(obj.list_of_list_of_list_field[0][2][2], "m022");
|
||||
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][0], 'm100');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][1], 'm101');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][2], 'm102');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][0], 'm110');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][1], 'm111');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][2], 'm112');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][0], 'm120');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][1], 'm121');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][2], 'm122');
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][0], "m100");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][1], "m101");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][0][2], "m102");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][0], "m110");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][1], "m111");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][1][2], "m112");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][0], "m120");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][1], "m121");
|
||||
assert.equals(obj.list_of_list_of_list_field[1][2][2], "m122");
|
||||
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][0], 'm200');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][1], 'm201');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][2], 'm202');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][0], 'm210');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][1], 'm211');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][2], 'm212');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][0], 'm220');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][1], 'm221');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][2], 'm222');
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][0], "m200");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][1], "m201");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][0][2], "m202");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][0], "m210");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][1], "m211");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][1][2], "m212");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][0], "m220");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][1], "m221");
|
||||
assert.equals(obj.list_of_list_of_list_field[2][2][2], "m222");
|
||||
}
|
||||
|
||||
function createTestCases(serialize, deserialize) {
|
||||
|
||||
var cases = {
|
||||
|
||||
"Serialize/deserialize should return equal object": function(assert){
|
||||
var tObj = createThriftObj();
|
||||
var received = deserialize(serialize(tObj), ttypes.Complex);
|
||||
assert.ok(tObj !== received, 'not the same object');
|
||||
const cases = {
|
||||
"Serialize/deserialize should return equal object": function(assert) {
|
||||
const tObj = createThriftObj();
|
||||
const received = deserialize(serialize(tObj), ttypes.Complex);
|
||||
assert.ok(tObj !== received, "not the same object");
|
||||
assert.deepEqual(tObj, received);
|
||||
assert.end();
|
||||
},
|
||||
|
||||
"Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects": function(assert) {
|
||||
var tObj1 = createThriftObj();
|
||||
var tObj2 = new ttypes.Complex(createJsObj());
|
||||
"Nested structs and containers initialized from plain js objects should serialize same as if initialized from thrift objects": function(
|
||||
assert
|
||||
) {
|
||||
const tObj1 = createThriftObj();
|
||||
const tObj2 = new ttypes.Complex(createJsObj());
|
||||
assertValues(tObj2, assert);
|
||||
var s1 = serialize(tObj1);
|
||||
var s2 = serialize(tObj2);
|
||||
const s1 = serialize(tObj1);
|
||||
const s2 = serialize(tObj2);
|
||||
assert.ok(bufferEquals(s1, s2));
|
||||
assert.end();
|
||||
},
|
||||
|
||||
"Modifications to args object should not affect constructed Thrift object": function (assert) {
|
||||
|
||||
var args = createJsObj();
|
||||
"Modifications to args object should not affect constructed Thrift object": function(
|
||||
assert
|
||||
) {
|
||||
const args = createJsObj();
|
||||
assertValues(args, assert);
|
||||
|
||||
var tObj = new ttypes.Complex(args);
|
||||
const tObj = new ttypes.Complex(args);
|
||||
assertValues(tObj, assert);
|
||||
|
||||
args.struct_field.value = 'ZZZ';
|
||||
args.struct_list_field[0].value = 'ZZZ';
|
||||
args.struct_list_field[1].value = 'ZZZ';
|
||||
args.struct_set_field[0].value = 'ZZZ';
|
||||
args.struct_set_field[1].value = 'ZZZ';
|
||||
args.struct_map_field.A.value = 'ZZZ';
|
||||
args.struct_map_field.B.value = 'ZZZ';
|
||||
args.struct_nested_containers_field[0][0].C[0] = 'ZZZ';
|
||||
args.struct_nested_containers_field[0][0].C[1] = 'ZZZ';
|
||||
args.struct_nested_containers_field2.D[0].DA = 'ZZZ';
|
||||
args.struct_nested_containers_field2.D[0].DB = 'ZZZ';
|
||||
args.struct_field.value = "ZZZ";
|
||||
args.struct_list_field[0].value = "ZZZ";
|
||||
args.struct_list_field[1].value = "ZZZ";
|
||||
args.struct_set_field[0].value = "ZZZ";
|
||||
args.struct_set_field[1].value = "ZZZ";
|
||||
args.struct_map_field.A.value = "ZZZ";
|
||||
args.struct_map_field.B.value = "ZZZ";
|
||||
args.struct_nested_containers_field[0][0].C[0] = "ZZZ";
|
||||
args.struct_nested_containers_field[0][0].C[1] = "ZZZ";
|
||||
args.struct_nested_containers_field2.D[0].DA = "ZZZ";
|
||||
args.struct_nested_containers_field2.D[0].DB = "ZZZ";
|
||||
|
||||
assertValues(tObj, assert);
|
||||
assert.end();
|
||||
},
|
||||
|
||||
"nulls are ok": function(assert) {
|
||||
var tObj = new ttypes.Complex({
|
||||
const tObj = new ttypes.Complex({
|
||||
struct_field: null,
|
||||
struct_list_field: null,
|
||||
struct_set_field: null,
|
||||
|
@ -296,7 +298,7 @@ function createTestCases(serialize, deserialize) {
|
|||
struct_nested_containers_field: null,
|
||||
struct_nested_containers_field2: null
|
||||
});
|
||||
var received = deserialize(serialize(tObj), ttypes.Complex);
|
||||
const received = deserialize(serialize(tObj), ttypes.Complex);
|
||||
assert.strictEqual(tObj.struct_field, null);
|
||||
assert.ok(tObj !== received);
|
||||
assert.deepEqual(tObj, received);
|
||||
|
@ -304,11 +306,11 @@ function createTestCases(serialize, deserialize) {
|
|||
},
|
||||
|
||||
"Can make list with objects": function(assert) {
|
||||
var tObj = new ttypes.ComplexList({
|
||||
"struct_list_field": [new ttypes.Complex({})]
|
||||
const tObj = new ttypes.ComplexList({
|
||||
struct_list_field: [new ttypes.Complex({})]
|
||||
});
|
||||
var innerObj = tObj.struct_list_field[0];
|
||||
assert.ok(innerObj instanceof ttypes.Complex)
|
||||
const innerObj = tObj.struct_list_field[0];
|
||||
assert.ok(innerObj instanceof ttypes.Complex);
|
||||
assert.strictEqual(innerObj.struct_field, null);
|
||||
assert.strictEqual(innerObj.struct_list_field, null);
|
||||
assert.strictEqual(innerObj.struct_set_field, null);
|
||||
|
@ -317,17 +319,15 @@ function createTestCases(serialize, deserialize) {
|
|||
assert.strictEqual(innerObj.struct_nested_containers_field2, null);
|
||||
assert.end();
|
||||
}
|
||||
|
||||
};
|
||||
return cases;
|
||||
}
|
||||
|
||||
|
||||
function run(name, cases){
|
||||
function run(name, cases) {
|
||||
Object.keys(cases).forEach(function(caseName) {
|
||||
test(name + ': ' + caseName, cases[caseName]);
|
||||
test(name + ": " + caseName, cases[caseName]);
|
||||
});
|
||||
}
|
||||
|
||||
run('binary', createTestCases(serializeBinary, deserializeBinary));
|
||||
run('json', createTestCases(serializeJSON, deserializeJSON));
|
||||
run("binary", createTestCases(serializeBinary, deserializeBinary));
|
||||
run("json", createTestCases(serializeJSON, deserializeJSON));
|
||||
|
|
166
vendor/git.apache.org/thrift.git/lib/nodejs/test/exceptions.js
generated
vendored
166
vendor/git.apache.org/thrift.git/lib/nodejs/test/exceptions.js
generated
vendored
|
@ -17,72 +17,130 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
var test = require('tape');
|
||||
var thrift = require('../lib/thrift/thrift.js');
|
||||
var InputBufferUnderrunError = require('../lib/thrift/input_buffer_underrun_error');
|
||||
"use strict";
|
||||
const test = require("tape");
|
||||
const thrift = require("../lib/thrift/thrift.js");
|
||||
const InputBufferUnderrunError = require("../lib/thrift/input_buffer_underrun_error");
|
||||
|
||||
test('TApplicationException', function t(assert) {
|
||||
var e = new thrift.TApplicationException(1, 'foo');
|
||||
assert.ok(e instanceof thrift.TApplicationException, 'is instanceof TApplicationException');
|
||||
assert.ok(e instanceof thrift.TException, 'is instanceof TException');
|
||||
assert.ok(e instanceof Error, 'is instanceof Error');
|
||||
assert.equal(typeof e.stack, 'string', 'has stack trace');
|
||||
assert.ok(/^TApplicationException: foo/.test(e.stack), 'Stack trace has correct error name and message');
|
||||
assert.ok(e.stack.indexOf('test/exceptions.js:7:11') !== -1, 'stack trace starts on correct line and column');
|
||||
assert.equal(e.name, 'TApplicationException', 'has function name TApplicationException');
|
||||
assert.equal(e.message, 'foo', 'has error message "foo"');
|
||||
assert.equal(e.type, 1, 'has type 1');
|
||||
test("TApplicationException", function t(assert) {
|
||||
const e = new thrift.TApplicationException(1, "foo");
|
||||
assert.ok(
|
||||
e instanceof thrift.TApplicationException,
|
||||
"is instanceof TApplicationException"
|
||||
);
|
||||
assert.ok(e instanceof thrift.TException, "is instanceof TException");
|
||||
assert.ok(e instanceof Error, "is instanceof Error");
|
||||
assert.equal(typeof e.stack, "string", "has stack trace");
|
||||
assert.ok(
|
||||
/^TApplicationException: foo/.test(e.stack),
|
||||
"Stack trace has correct error name and message"
|
||||
);
|
||||
assert.ok(
|
||||
e.stack.indexOf("test/exceptions.js:7:11") !== -1,
|
||||
"stack trace starts on correct line and column"
|
||||
);
|
||||
assert.equal(
|
||||
e.name,
|
||||
"TApplicationException",
|
||||
"has function name TApplicationException"
|
||||
);
|
||||
assert.equal(e.message, "foo", 'has error message "foo"');
|
||||
assert.equal(e.type, 1, "has type 1");
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('unexpected TApplicationException ', function t(assert) {
|
||||
var e = new thrift.TApplicationException(1, 100);
|
||||
assert.ok(e instanceof thrift.TApplicationException, 'is instanceof TApplicationException');
|
||||
assert.ok(e instanceof thrift.TException, 'is instanceof TException');
|
||||
assert.ok(e instanceof Error, 'is instanceof Error');
|
||||
assert.equal(typeof e.stack, 'string', 'has stack trace');
|
||||
assert.ok(/^TApplicationException: 100/.test(e.stack), 'Stack trace has correct error name and message');
|
||||
assert.ok(e.stack.indexOf('test/exceptions.js:7:11') !== -1, 'stack trace starts on correct line and column');
|
||||
assert.equal(e.name, 'TApplicationException', 'has function name TApplicationException');
|
||||
assert.equal(e.message, 100, 'has error message 100');
|
||||
assert.equal(e.type, 1, 'has type 1');
|
||||
test("unexpected TApplicationException ", function t(assert) {
|
||||
const e = new thrift.TApplicationException(1, 100);
|
||||
assert.ok(
|
||||
e instanceof thrift.TApplicationException,
|
||||
"is instanceof TApplicationException"
|
||||
);
|
||||
assert.ok(e instanceof thrift.TException, "is instanceof TException");
|
||||
assert.ok(e instanceof Error, "is instanceof Error");
|
||||
assert.equal(typeof e.stack, "string", "has stack trace");
|
||||
assert.ok(
|
||||
/^TApplicationException: 100/.test(e.stack),
|
||||
"Stack trace has correct error name and message"
|
||||
);
|
||||
assert.ok(
|
||||
e.stack.indexOf("test/exceptions.js:7:11") !== -1,
|
||||
"stack trace starts on correct line and column"
|
||||
);
|
||||
assert.equal(
|
||||
e.name,
|
||||
"TApplicationException",
|
||||
"has function name TApplicationException"
|
||||
);
|
||||
assert.equal(e.message, 100, "has error message 100");
|
||||
assert.equal(e.type, 1, "has type 1");
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('TException', function t(assert) {
|
||||
var e = new thrift.TException('foo');
|
||||
assert.ok(e instanceof thrift.TException, 'is instanceof TException');
|
||||
assert.ok(e instanceof Error, 'is instanceof Error');
|
||||
assert.equal(typeof e.stack, 'string', 'has stack trace');
|
||||
assert.ok(/^TException: foo/.test(e.stack), 'Stack trace has correct error name and message');
|
||||
assert.ok(e.stack.indexOf('test/exceptions.js:21:11') !== -1, 'stack trace starts on correct line and column');
|
||||
assert.equal(e.name, 'TException', 'has function name TException');
|
||||
assert.equal(e.message, 'foo', 'has error message "foo"');
|
||||
test("TException", function t(assert) {
|
||||
const e = new thrift.TException("foo");
|
||||
assert.ok(e instanceof thrift.TException, "is instanceof TException");
|
||||
assert.ok(e instanceof Error, "is instanceof Error");
|
||||
assert.equal(typeof e.stack, "string", "has stack trace");
|
||||
assert.ok(
|
||||
/^TException: foo/.test(e.stack),
|
||||
"Stack trace has correct error name and message"
|
||||
);
|
||||
assert.ok(
|
||||
e.stack.indexOf("test/exceptions.js:21:11") !== -1,
|
||||
"stack trace starts on correct line and column"
|
||||
);
|
||||
assert.equal(e.name, "TException", "has function name TException");
|
||||
assert.equal(e.message, "foo", 'has error message "foo"');
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('TProtocolException', function t(assert) {
|
||||
var e = new thrift.TProtocolException(1, 'foo');
|
||||
assert.ok(e instanceof thrift.TProtocolException, 'is instanceof TProtocolException');
|
||||
assert.ok(e instanceof Error, 'is instanceof Error');
|
||||
assert.equal(typeof e.stack, 'string', 'has stack trace');
|
||||
assert.ok(/^TProtocolException: foo/.test(e.stack), 'Stack trace has correct error name and message');
|
||||
assert.ok(e.stack.indexOf('test/exceptions.js:33:11') !== -1, 'stack trace starts on correct line and column');
|
||||
assert.equal(e.name, 'TProtocolException', 'has function name TProtocolException');
|
||||
assert.equal(e.message, 'foo', 'has error message "foo"');
|
||||
assert.equal(e.type, 1, 'has type 1');
|
||||
test("TProtocolException", function t(assert) {
|
||||
const e = new thrift.TProtocolException(1, "foo");
|
||||
assert.ok(
|
||||
e instanceof thrift.TProtocolException,
|
||||
"is instanceof TProtocolException"
|
||||
);
|
||||
assert.ok(e instanceof Error, "is instanceof Error");
|
||||
assert.equal(typeof e.stack, "string", "has stack trace");
|
||||
assert.ok(
|
||||
/^TProtocolException: foo/.test(e.stack),
|
||||
"Stack trace has correct error name and message"
|
||||
);
|
||||
assert.ok(
|
||||
e.stack.indexOf("test/exceptions.js:33:11") !== -1,
|
||||
"stack trace starts on correct line and column"
|
||||
);
|
||||
assert.equal(
|
||||
e.name,
|
||||
"TProtocolException",
|
||||
"has function name TProtocolException"
|
||||
);
|
||||
assert.equal(e.message, "foo", 'has error message "foo"');
|
||||
assert.equal(e.type, 1, "has type 1");
|
||||
assert.end();
|
||||
});
|
||||
|
||||
test('InputBufferUnderrunError', function t(assert) {
|
||||
var e = new InputBufferUnderrunError('foo');
|
||||
assert.ok(e instanceof InputBufferUnderrunError, 'is instanceof InputBufferUnderrunError');
|
||||
assert.ok(e instanceof Error, 'is instanceof Error');
|
||||
assert.equal(typeof e.stack, 'string', 'has stack trace');
|
||||
assert.ok(/^InputBufferUnderrunError: foo/.test(e.stack), 'Stack trace has correct error name and message');
|
||||
assert.ok(e.stack.indexOf('test/exceptions.js:46:11') !== -1, 'stack trace starts on correct line and column');
|
||||
assert.equal(e.name, 'InputBufferUnderrunError', 'has function name InputBufferUnderrunError');
|
||||
assert.equal(e.message, 'foo', 'has error message "foo"');
|
||||
test("InputBufferUnderrunError", function t(assert) {
|
||||
const e = new InputBufferUnderrunError("foo");
|
||||
assert.ok(
|
||||
e instanceof InputBufferUnderrunError,
|
||||
"is instanceof InputBufferUnderrunError"
|
||||
);
|
||||
assert.ok(e instanceof Error, "is instanceof Error");
|
||||
assert.equal(typeof e.stack, "string", "has stack trace");
|
||||
assert.ok(
|
||||
/^InputBufferUnderrunError: foo/.test(e.stack),
|
||||
"Stack trace has correct error name and message"
|
||||
);
|
||||
assert.ok(
|
||||
e.stack.indexOf("test/exceptions.js:46:11") !== -1,
|
||||
"stack trace starts on correct line and column"
|
||||
);
|
||||
assert.equal(
|
||||
e.name,
|
||||
"InputBufferUnderrunError",
|
||||
"has function name InputBufferUnderrunError"
|
||||
);
|
||||
assert.equal(e.message, "foo", 'has error message "foo"');
|
||||
assert.end();
|
||||
});
|
||||
|
|
19
vendor/git.apache.org/thrift.git/lib/nodejs/test/helpers.js
generated
vendored
19
vendor/git.apache.org/thrift.git/lib/nodejs/test/helpers.js
generated
vendored
|
@ -17,16 +17,21 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
var thrift = require('../lib/thrift');
|
||||
"use strict";
|
||||
const thrift = require("../lib/thrift");
|
||||
|
||||
module.exports.transports = {
|
||||
'buffered': thrift.TBufferedTransport,
|
||||
'framed': thrift.TFramedTransport
|
||||
buffered: thrift.TBufferedTransport,
|
||||
framed: thrift.TFramedTransport
|
||||
};
|
||||
|
||||
module.exports.protocols = {
|
||||
'json': thrift.TJSONProtocol,
|
||||
'binary': thrift.TBinaryProtocol,
|
||||
'compact': thrift.TCompactProtocol
|
||||
json: thrift.TJSONProtocol,
|
||||
binary: thrift.TBinaryProtocol,
|
||||
compact: thrift.TCompactProtocol
|
||||
};
|
||||
|
||||
module.exports.ecmaMode = process.argv.includes("--es6") ? "es6" : "es5";
|
||||
module.exports.genPath = process.argv.includes("--es6")
|
||||
? "gen-nodejs-es6"
|
||||
: "gen-nodejs";
|
||||
|
|
121
vendor/git.apache.org/thrift.git/lib/nodejs/test/server.js
generated
vendored
121
vendor/git.apache.org/thrift.git/lib/nodejs/test/server.js
generated
vendored
|
@ -19,96 +19,119 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var thrift = require('../lib/thrift');
|
||||
var program = require('commander');
|
||||
var helpers = require('./helpers');
|
||||
|
||||
var ThriftTest = require('./gen-nodejs/ThriftTest');
|
||||
var SecondService = require('./gen-nodejs/SecondService');
|
||||
var ThriftTestHandler = require('./test_handler').AsyncThriftTestHandler;
|
||||
var ThriftTestHandlerPromise = require('./test_handler').SyncThriftTestHandler;
|
||||
var ttypes = require('./gen-nodejs/ThriftTest_types');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const thrift = require("../lib/thrift");
|
||||
const program = require("commander");
|
||||
const helpers = require("./helpers");
|
||||
|
||||
program
|
||||
.option('-p, --protocol <protocol>', 'Set thrift protocol (binary|compact|json)', 'binary')
|
||||
.option('-t, --transport <transport>', 'Set thrift transport (buffered|framed|http)', 'buffered')
|
||||
.option('--ssl', 'use ssl transport')
|
||||
.option('--port <port>', 'Set thrift server port', 9090)
|
||||
.option('--domain-socket <path>', 'Set thift server unix domain socket')
|
||||
.option('--promise', 'test with promise style functions')
|
||||
.option('-t, --type <type>', 'Select server type (http|multiplex|tcp|websocket)', 'tcp')
|
||||
.option(
|
||||
"-p, --protocol <protocol>",
|
||||
"Set thrift protocol (binary|compact|json)",
|
||||
"binary"
|
||||
)
|
||||
.option(
|
||||
"-t, --transport <transport>",
|
||||
"Set thrift transport (buffered|framed|http)",
|
||||
"buffered"
|
||||
)
|
||||
.option("--ssl", "use ssl transport")
|
||||
.option("--port <port>", "Set thrift server port", 9090)
|
||||
.option("--domain-socket <path>", "Set thift server unix domain socket")
|
||||
.option(
|
||||
"-t, --type <type>",
|
||||
"Select server type (http|multiplex|tcp|websocket)",
|
||||
"tcp"
|
||||
)
|
||||
.option("--callback", "test with callback style functions")
|
||||
.option("--es6", "Use es6 code")
|
||||
.option("--es5", "Use es5 code")
|
||||
.parse(process.argv);
|
||||
|
||||
var port = program.port;
|
||||
var domainSocket = program.domainSocket;
|
||||
var type = program.type;
|
||||
var ssl = program.ssl;
|
||||
var promise = program.promise;
|
||||
const ThriftTest = require(`./${helpers.genPath}/ThriftTest`);
|
||||
const SecondService = require(`./${helpers.genPath}/SecondService`);
|
||||
const { ThriftTestHandler } = require("./test_handler");
|
||||
|
||||
var handler = program.promise ? ThriftTestHandler : ThriftTestHandlerPromise;
|
||||
const port = program.port;
|
||||
const domainSocket = program.domainSocket;
|
||||
const ssl = program.ssl;
|
||||
|
||||
if (program.transport === 'http') {
|
||||
program.transport = 'buffered';
|
||||
type = 'http';
|
||||
let type = program.type;
|
||||
if (program.transport === "http") {
|
||||
program.transport = "buffered";
|
||||
type = "http";
|
||||
}
|
||||
|
||||
var options = {
|
||||
let options = {
|
||||
transport: helpers.transports[program.transport],
|
||||
protocol: helpers.protocols[program.protocol]
|
||||
};
|
||||
|
||||
if (type === 'http' || type ==='websocket') {
|
||||
options.handler = handler;
|
||||
if (type === "http" || type === "websocket") {
|
||||
options.handler = ThriftTestHandler;
|
||||
options.processor = ThriftTest;
|
||||
|
||||
options = {
|
||||
services: { "/test": options },
|
||||
cors: {
|
||||
'*': true
|
||||
"*": true
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (type === 'multiplex') {
|
||||
var SecondServiceHandler = {
|
||||
let processor;
|
||||
if (type === "multiplex") {
|
||||
const SecondServiceHandler = {
|
||||
secondtestString: function(thing, result) {
|
||||
console.log('testString("' + thing + '")');
|
||||
result(null, 'testString("' + thing + '")');
|
||||
}
|
||||
};
|
||||
|
||||
var processor = new thrift.MultiplexedProcessor();
|
||||
processor = new thrift.MultiplexedProcessor();
|
||||
|
||||
processor.registerProcessor("ThriftTest",
|
||||
new ThriftTest.Processor(ThriftTestHandler));
|
||||
|
||||
processor.registerProcessor("SecondService",
|
||||
new SecondService.Processor(SecondServiceHandler));
|
||||
processor.registerProcessor(
|
||||
"ThriftTest",
|
||||
new ThriftTest.Processor(ThriftTestHandler)
|
||||
);
|
||||
|
||||
processor.registerProcessor(
|
||||
"SecondService",
|
||||
new SecondService.Processor(SecondServiceHandler)
|
||||
);
|
||||
}
|
||||
|
||||
if (ssl) {
|
||||
if (type === 'tcp' || type === 'multiplex' || type === 'http' || type === 'websocket') {
|
||||
if (
|
||||
type === "tcp" ||
|
||||
type === "multiplex" ||
|
||||
type === "http" ||
|
||||
type === "websocket"
|
||||
) {
|
||||
options.tls = {
|
||||
key: fs.readFileSync(path.resolve(__dirname, 'server.key')),
|
||||
cert: fs.readFileSync(path.resolve(__dirname, 'server.crt'))
|
||||
key: fs.readFileSync(path.resolve(__dirname, "server.key")),
|
||||
cert: fs.readFileSync(path.resolve(__dirname, "server.crt"))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var server;
|
||||
if (type === 'tcp') {
|
||||
server = thrift.createServer(ThriftTest, handler, options);
|
||||
} else if (type === 'multiplex') {
|
||||
let server;
|
||||
if (type === "tcp") {
|
||||
server = thrift.createServer(ThriftTest, ThriftTestHandler, options);
|
||||
} else if (type === "multiplex") {
|
||||
server = thrift.createMultiplexServer(processor, options);
|
||||
} else if (type === 'http' || type === 'websocket') {
|
||||
} else if (type === "http" || type === "websocket") {
|
||||
server = thrift.createWebServer(options);
|
||||
}
|
||||
|
||||
if (domainSocket) {
|
||||
server.listen(domainSocket);
|
||||
} else if (type === 'tcp' || type === 'multiplex' || type === 'http' || type === 'websocket') {
|
||||
} else if (
|
||||
type === "tcp" ||
|
||||
type === "multiplex" ||
|
||||
type === "http" ||
|
||||
type === "websocket"
|
||||
) {
|
||||
server.listen(port);
|
||||
}
|
||||
|
|
227
vendor/git.apache.org/thrift.git/lib/nodejs/test/test-cases.js
generated
vendored
227
vendor/git.apache.org/thrift.git/lib/nodejs/test/test-cases.js
generated
vendored
|
@ -17,139 +17,156 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
var ttypes = require('./gen-nodejs/ThriftTest_types');
|
||||
var Int64 = require('node-int64');
|
||||
const helpers = require("./helpers");
|
||||
const ttypes = require(`./${helpers.genPath}/ThriftTest_types`);
|
||||
const Int64 = require("node-int64");
|
||||
|
||||
//all Languages in UTF-8
|
||||
/*jshint -W100 */
|
||||
var stringTest = module.exports.stringTest = "Afrikaans, Alemannisch, Aragonés, العربية, مصرى, " +
|
||||
"Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, " +
|
||||
"Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, " +
|
||||
"বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, " +
|
||||
"Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, " +
|
||||
"Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, " +
|
||||
"Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, " +
|
||||
"Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, " +
|
||||
"Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, " +
|
||||
"Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, " +
|
||||
"Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, " +
|
||||
"ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, " +
|
||||
"Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, " +
|
||||
"Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa " +
|
||||
"Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa " +
|
||||
"Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, " +
|
||||
"Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, " +
|
||||
"Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, " +
|
||||
"Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, " +
|
||||
"Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple " +
|
||||
"English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, " +
|
||||
"Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, " +
|
||||
"Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, " +
|
||||
"Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, " +
|
||||
"Bân-lâm-gú, 粵語";
|
||||
const stringTest = (module.exports.stringTest =
|
||||
"Afrikaans, Alemannisch, Aragonés, العربية, مصرى, " +
|
||||
"Asturianu, Aymar aru, Azərbaycan, Башҡорт, Boarisch, Žemaitėška, " +
|
||||
"Беларуская, Беларуская (тарашкевіца), Български, Bamanankan, " +
|
||||
"বাংলা, Brezhoneg, Bosanski, Català, Mìng-dĕ̤ng-ngṳ̄, Нохчийн, " +
|
||||
"Cebuano, ᏣᎳᎩ, Česky, Словѣ́ньскъ / ⰔⰎⰑⰂⰡⰐⰠⰔⰍⰟ, Чӑвашла, Cymraeg, " +
|
||||
"Dansk, Zazaki, ދިވެހިބަސް, Ελληνικά, Emiliàn e rumagnòl, English, " +
|
||||
"Esperanto, Español, Eesti, Euskara, فارسی, Suomi, Võro, Føroyskt, " +
|
||||
"Français, Arpetan, Furlan, Frysk, Gaeilge, 贛語, Gàidhlig, Galego, " +
|
||||
"Avañe'ẽ, ગુજરાતી, Gaelg, עברית, हिन्दी, Fiji Hindi, Hrvatski, " +
|
||||
"Kreyòl ayisyen, Magyar, Հայերեն, Interlingua, Bahasa Indonesia, " +
|
||||
"Ilokano, Ido, Íslenska, Italiano, 日本語, Lojban, Basa Jawa, " +
|
||||
"ქართული, Kongo, Kalaallisut, ಕನ್ನಡ, 한국어, Къарачай-Малкъар, " +
|
||||
"Ripoarisch, Kurdî, Коми, Kernewek, Кыргызча, Latina, Ladino, " +
|
||||
"Lëtzebuergesch, Limburgs, Lingála, ລາວ, Lietuvių, Latviešu, Basa " +
|
||||
"Banyumasan, Malagasy, Македонски, മലയാളം, मराठी, مازِرونی, Bahasa " +
|
||||
"Melayu, Nnapulitano, Nedersaksisch, नेपाल भाषा, Nederlands, " +
|
||||
"Norsk (nynorsk), Norsk (bokmål), Nouormand, Diné bizaad, " +
|
||||
"Occitan, Иронау, Papiamentu, Deitsch, Polski, پنجابی, پښتو, " +
|
||||
"Norfuk / Pitkern, Português, Runa Simi, Rumantsch, Romani, Română, " +
|
||||
"Русский, Саха тыла, Sardu, Sicilianu, Scots, Sámegiella, Simple " +
|
||||
"English, Slovenčina, Slovenščina, Српски / Srpski, Seeltersk, " +
|
||||
"Svenska, Kiswahili, தமிழ், తెలుగు, Тоҷикӣ, ไทย, Türkmençe, Tagalog, " +
|
||||
"Türkçe, Татарча/Tatarça, Українська, اردو, Tiếng Việt, Volapük, " +
|
||||
"Walon, Winaray, 吴语, isiXhosa, ייִדיש, Yorùbá, Zeêuws, 中文, " +
|
||||
"Bân-lâm-gú, 粵語");
|
||||
/*jshint +W100 */
|
||||
|
||||
var specialCharacters = module.exports.specialCharacters = 'quote: \" backslash:' +
|
||||
' forwardslash-escaped: \/ ' +
|
||||
' backspace: \b formfeed: \f newline: \n return: \r tab: ' +
|
||||
' now-all-of-them-together: "\\\/\b\n\r\t' +
|
||||
' now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><' +
|
||||
' char-to-test-json-parsing: ]] \"]] \\" }}}{ [[[ ';
|
||||
const specialCharacters = (module.exports.specialCharacters =
|
||||
'quote: " backslash:' +
|
||||
" forwardslash-escaped: / " +
|
||||
" backspace: \b formfeed: \f newline: \n return: \r tab: " +
|
||||
' now-all-of-them-together: "\\/\b\n\r\t' +
|
||||
" now-a-bunch-of-junk: !@#$%&()(&%$#{}{}<><><" +
|
||||
' char-to-test-json-parsing: ]] "]] \\" }}}{ [[[ ');
|
||||
|
||||
var mapTestInput = module.exports.mapTestInput = {
|
||||
"a":"123", "a b":"with spaces ", "same":"same", "0":"numeric key",
|
||||
"longValue":stringTest, stringTest:"long key"
|
||||
};
|
||||
const mapTestInput = (module.exports.mapTestInput = {
|
||||
a: "123",
|
||||
"a b": "with spaces ",
|
||||
same: "same",
|
||||
"0": "numeric key",
|
||||
longValue: stringTest,
|
||||
stringTest: "long key"
|
||||
});
|
||||
|
||||
var simple = [
|
||||
['testVoid', undefined],
|
||||
['testString', 'Test'],
|
||||
['testString', ''],
|
||||
['testString', stringTest],
|
||||
['testString', specialCharacters],
|
||||
['testBool', true],
|
||||
['testBool', false],
|
||||
['testByte', 1],
|
||||
['testByte', 0],
|
||||
['testByte', -1],
|
||||
['testByte', -127],
|
||||
['testI32', -1],
|
||||
['testDouble', -5.2098523],
|
||||
['testDouble', 7.012052175215044],
|
||||
['testEnum', ttypes.Numberz.ONE],
|
||||
['testI64', 5],
|
||||
['testI64', -5],
|
||||
['testI64', 734359738368],
|
||||
['testI64', -734359738368],
|
||||
['testI64', new Int64(new Buffer([0, 0x20, 0, 0, 0, 0, 0, 1]))], // 2^53+1
|
||||
['testI64', new Int64(
|
||||
new Buffer([0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]))], // -2^53-1
|
||||
['testTypedef', 69]
|
||||
]
|
||||
const simple = [
|
||||
["testVoid", undefined],
|
||||
["testString", "Test"],
|
||||
["testString", ""],
|
||||
["testString", stringTest],
|
||||
["testString", specialCharacters],
|
||||
["testBool", true],
|
||||
["testBool", false],
|
||||
["testByte", 1],
|
||||
["testByte", 0],
|
||||
["testByte", -1],
|
||||
["testByte", -127],
|
||||
["testI32", -1],
|
||||
["testDouble", -5.2098523],
|
||||
["testDouble", 7.012052175215044],
|
||||
["testEnum", ttypes.Numberz.ONE],
|
||||
["testI64", 5],
|
||||
["testI64", -5],
|
||||
["testI64", 734359738368],
|
||||
["testI64", -734359738368],
|
||||
["testI64", new Int64(new Buffer([0, 0x20, 0, 0, 0, 0, 0, 1]))], // 2^53+1
|
||||
[
|
||||
"testI64",
|
||||
new Int64(new Buffer([0xff, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff]))
|
||||
], // -2^53-1
|
||||
["testTypedef", 69]
|
||||
];
|
||||
|
||||
var mapout = {};
|
||||
for (var i = 0; i < 5; ++i) {
|
||||
mapout[i] = i-10;
|
||||
const mapout = {};
|
||||
for (let i = 0; i < 5; ++i) {
|
||||
mapout[i] = i - 10;
|
||||
}
|
||||
|
||||
var deep = [
|
||||
['testList', [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]],
|
||||
const deep = [
|
||||
[
|
||||
"testList",
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
|
||||
]
|
||||
];
|
||||
|
||||
var deepUnordered = [
|
||||
['testMap', mapout],
|
||||
['testSet', [1,2,3]],
|
||||
['testStringMap', mapTestInput]
|
||||
const deepUnordered = [
|
||||
["testMap", mapout],
|
||||
["testSet", [1, 2, 3]],
|
||||
["testStringMap", mapTestInput]
|
||||
];
|
||||
|
||||
var out = new ttypes.Xtruct({
|
||||
string_thing: 'Zero',
|
||||
const out = new ttypes.Xtruct({
|
||||
string_thing: "Zero",
|
||||
byte_thing: 1,
|
||||
i32_thing: -3,
|
||||
i64_thing: 1000000
|
||||
});
|
||||
|
||||
var out2 = new ttypes.Xtruct2();
|
||||
const out2 = new ttypes.Xtruct2();
|
||||
out2.byte_thing = 1;
|
||||
out2.struct_thing = out;
|
||||
out2.i32_thing = 5;
|
||||
|
||||
var crazy = new ttypes.Insanity({
|
||||
"userMap":{ "5":5, "8":8 },
|
||||
"xtructs":[new ttypes.Xtruct({
|
||||
"string_thing":"Goodbye4",
|
||||
"byte_thing":4,
|
||||
"i32_thing":4,
|
||||
"i64_thing":4
|
||||
}), new ttypes.Xtruct({
|
||||
"string_thing":"Hello2",
|
||||
"byte_thing":2,
|
||||
"i32_thing":2,
|
||||
"i64_thing":2
|
||||
})]
|
||||
const crazy = new ttypes.Insanity({
|
||||
userMap: { "5": 5, "8": 8 },
|
||||
xtructs: [
|
||||
new ttypes.Xtruct({
|
||||
string_thing: "Goodbye4",
|
||||
byte_thing: 4,
|
||||
i32_thing: 4,
|
||||
i64_thing: 4
|
||||
}),
|
||||
new ttypes.Xtruct({
|
||||
string_thing: "Hello2",
|
||||
byte_thing: 2,
|
||||
i32_thing: 2,
|
||||
i64_thing: 2
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
var crazy2 = new ttypes.Insanity({
|
||||
"userMap":{ "5":5, "8":8 },
|
||||
"xtructs":[{
|
||||
"string_thing":"Goodbye4",
|
||||
"byte_thing":4,
|
||||
"i32_thing":4,
|
||||
"i64_thing":4
|
||||
}, {
|
||||
"string_thing":"Hello2",
|
||||
"byte_thing":2,
|
||||
"i32_thing":2,
|
||||
"i64_thing":2
|
||||
}]
|
||||
const crazy2 = new ttypes.Insanity({
|
||||
userMap: { "5": 5, "8": 8 },
|
||||
xtructs: [
|
||||
{
|
||||
string_thing: "Goodbye4",
|
||||
byte_thing: 4,
|
||||
i32_thing: 4,
|
||||
i64_thing: 4
|
||||
},
|
||||
{
|
||||
string_thing: "Hello2",
|
||||
byte_thing: 2,
|
||||
i32_thing: 2,
|
||||
i64_thing: 2
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
var insanity = {
|
||||
"1":{ "2": crazy, "3": crazy },
|
||||
"2":{ "6":{ "userMap":{}, "xtructs":[] } }
|
||||
const insanity = {
|
||||
"1": { "2": crazy, "3": crazy },
|
||||
"2": { "6": { userMap: {}, xtructs: [] } }
|
||||
};
|
||||
|
||||
module.exports.simple = simple;
|
||||
|
|
24
vendor/git.apache.org/thrift.git/lib/nodejs/test/testAll.sh
generated
vendored
24
vendor/git.apache.org/thrift.git/lib/nodejs/test/testAll.sh
generated
vendored
|
@ -33,21 +33,21 @@ export NODE_PATH="${DIR}:${DIR}/../lib:${NODE_PATH}"
|
|||
|
||||
testServer()
|
||||
{
|
||||
echo " Testing $1 Client/Server with protocol $2 and transport $3 $4";
|
||||
echo " [ECMA $1] Testing $2 Client/Server with protocol $3 and transport $4 $5";
|
||||
RET=0
|
||||
if [ -n "${COVER}" ]; then
|
||||
${ISTANBUL} cover ${DIR}/server.js --dir ${REPORT_PREFIX}${COUNT} --handle-sigint -- --type $1 -p $2 -t $3 $4 &
|
||||
${ISTANBUL} cover ${DIR}/server.js --dir ${REPORT_PREFIX}${COUNT} --handle-sigint -- --type $2 -p $3 -t $4 $5 &
|
||||
COUNT=$((COUNT+1))
|
||||
else
|
||||
node ${DIR}/server.js --type $1 -p $2 -t $3 $4 &
|
||||
node ${DIR}/server.js --${1} --type $2 -p $3 -t $4 $5 &
|
||||
fi
|
||||
SERVERPID=$!
|
||||
sleep 0.1
|
||||
if [ -n "${COVER}" ]; then
|
||||
${ISTANBUL} cover ${DIR}/client.js --dir ${REPORT_PREFIX}${COUNT} -- --type $1 -p $2 -t $3 $4 || RET=1
|
||||
${ISTANBUL} cover ${DIR}/client.js --dir ${REPORT_PREFIX}${COUNT} -- --${1} --type $2 -p $3 -t $4 $5 || RET=1
|
||||
COUNT=$((COUNT+1))
|
||||
else
|
||||
node ${DIR}/client.js --type $1 -p $2 -t $3 $4 || RET=1
|
||||
node ${DIR}/client.js --${1} --type $2 -p $3 -t $4 $5 || RET=1
|
||||
fi
|
||||
kill -2 $SERVERPID || RET=1
|
||||
wait $SERVERPID
|
||||
|
@ -61,6 +61,9 @@ TESTOK=0
|
|||
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node ${DIR}/../../../test/ThriftTest.thrift
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node ${DIR}/../../../test/JsDeepConstructorTest.thrift
|
||||
mkdir ${DIR}/gen-nodejs-es6
|
||||
${DIR}/../../../compiler/cpp/thrift -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${DIR}/../../../test/ThriftTest.thrift
|
||||
${DIR}/../../../compiler/cpp/thrift -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${DIR}/../../../test/JsDeepConstructorTest.thrift
|
||||
|
||||
#unit tests
|
||||
|
||||
|
@ -71,15 +74,16 @@ node ${DIR}/deep-constructor.test.js || TESTOK=1
|
|||
|
||||
for type in tcp multiplex websocket http
|
||||
do
|
||||
|
||||
for protocol in compact binary json
|
||||
do
|
||||
|
||||
for transport in buffered framed
|
||||
do
|
||||
testServer $type $protocol $transport || TESTOK=1
|
||||
testServer $type $protocol $transport --ssl || TESTOK=1
|
||||
testServer $type $protocol $transport --promise || TESTOK=1
|
||||
for ecma_version in es5 es6
|
||||
do
|
||||
testServer $ecma_version $type $protocol $transport || TESTOK=1
|
||||
testServer $ecma_version $type $protocol $transport --ssl || TESTOK=1
|
||||
testServer $ecma_version $type $protocol $transport --callback || TESTOK=1
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
|
409
vendor/git.apache.org/thrift.git/lib/nodejs/test/test_driver.js
generated
vendored
409
vendor/git.apache.org/thrift.git/lib/nodejs/test/test_driver.js
generated
vendored
|
@ -17,252 +17,279 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
// This is the Node.js test driver for the standard Apache Thrift
|
||||
// test service. The driver invokes every function defined in the
|
||||
// Thrift Test service with a representative range of parameters.
|
||||
//
|
||||
// The ThriftTestDriver function requires a client object
|
||||
// connected to a server hosting the Thrift Test service and
|
||||
// supports an optional callback function which is called with
|
||||
// a status message when the test is complete.
|
||||
// This is the Node.js test driver for the standard Apache Thrift
|
||||
// test service. The driver invokes every function defined in the
|
||||
// Thrift Test service with a representative range of parameters.
|
||||
//
|
||||
// The ThriftTestDriver function requires a client object
|
||||
// connected to a server hosting the Thrift Test service and
|
||||
// supports an optional callback function which is called with
|
||||
// a status message when the test is complete.
|
||||
|
||||
var test = require('tape');
|
||||
//var assert = require('assert');
|
||||
var ttypes = require('./gen-nodejs/ThriftTest_types');
|
||||
var TException = require('thrift').Thrift.TException;
|
||||
var Int64 = require('node-int64');
|
||||
var testCases = require('./test-cases');
|
||||
const test = require("tape");
|
||||
|
||||
const helpers = require("./helpers");
|
||||
const ttypes = require(`./${helpers.genPath}/ThriftTest_types`);
|
||||
const TException = require("thrift").Thrift.TException;
|
||||
const Int64 = require("node-int64");
|
||||
const testCases = require("./test-cases");
|
||||
|
||||
exports.ThriftTestDriver = function(client, callback) {
|
||||
test(
|
||||
"NodeJS Style Callback Client Tests",
|
||||
{ skip: helpers.ecmaMode === "es6" },
|
||||
function(assert) {
|
||||
const checkRecursively = makeRecursiveCheck(assert);
|
||||
|
||||
test('NodeJS Style Callback Client Tests', function(assert) {
|
||||
|
||||
var checkRecursively = makeRecursiveCheck(assert);
|
||||
|
||||
function makeAsserter(assertionFn) {
|
||||
return function(c) {
|
||||
var fnName = c[0];
|
||||
var expected = c[1];
|
||||
client[fnName](expected, function(err, actual) {
|
||||
assert.error(err, fnName + ': no callback error');
|
||||
assertionFn(actual, expected, fnName);
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
testCases.simple.forEach(makeAsserter(function(a, e, m){
|
||||
if (a instanceof Int64) {
|
||||
var e64 = e instanceof Int64 ? e : new Int64(e);
|
||||
assert.deepEqual(a.buffer, e64.buffer, m);
|
||||
} else {
|
||||
assert.equal(a, e, m);
|
||||
function makeAsserter(assertionFn) {
|
||||
return function(c) {
|
||||
const fnName = c[0];
|
||||
const expected = c[1];
|
||||
client[fnName](expected, function(err, actual) {
|
||||
assert.error(err, fnName + ": no callback error");
|
||||
assertionFn(actual, expected, fnName);
|
||||
});
|
||||
};
|
||||
}
|
||||
}));
|
||||
testCases.deep.forEach(makeAsserter(assert.deepEqual));
|
||||
testCases.deepUnordered.forEach(makeAsserter(makeUnorderedDeepEqual(assert)));
|
||||
|
||||
var arr = [];
|
||||
for (var i = 0; i < 256; ++i) {
|
||||
arr[i] = 255 - i;
|
||||
}
|
||||
var buf = new Buffer(arr);
|
||||
client.testBinary(buf, function(err, response) {
|
||||
assert.error(err, 'testBinary: no callback error');
|
||||
assert.equal(response.length, 256, 'testBinary');
|
||||
assert.deepEqual(response, buf, 'testBinary(Buffer)');
|
||||
});
|
||||
var buf = new Buffer(arr);
|
||||
client.testBinary(buf.toString('binary'), function(err, response) {
|
||||
assert.error(err, 'testBinary: no callback error');
|
||||
assert.equal(response.length, 256, 'testBinary');
|
||||
assert.deepEqual(response, buf, 'testBinary(string)');
|
||||
});
|
||||
testCases.simple.forEach(
|
||||
makeAsserter(function(a, e, m) {
|
||||
if (a instanceof Int64) {
|
||||
const e64 = e instanceof Int64 ? e : new Int64(e);
|
||||
assert.deepEqual(a.buffer, e64.buffer, m);
|
||||
} else {
|
||||
assert.equal(a, e, m);
|
||||
}
|
||||
})
|
||||
);
|
||||
testCases.deep.forEach(makeAsserter(assert.deepEqual));
|
||||
testCases.deepUnordered.forEach(
|
||||
makeAsserter(makeUnorderedDeepEqual(assert))
|
||||
);
|
||||
|
||||
client.testMapMap(42, function(err, response) {
|
||||
var expected = {
|
||||
"4": {"1":1, "2":2, "3":3, "4":4},
|
||||
"-4": {"-4":-4, "-3":-3, "-2":-2, "-1":-1}
|
||||
};
|
||||
assert.error(err, 'testMapMap: no callback error');
|
||||
assert.deepEqual(expected, response, 'testMapMap');
|
||||
});
|
||||
|
||||
client.testStruct(testCases.out, function(err, response) {
|
||||
assert.error(err, 'testStruct: no callback error');
|
||||
checkRecursively(testCases.out, response, 'testStruct');
|
||||
});
|
||||
|
||||
client.testNest(testCases.out2, function(err, response) {
|
||||
assert.error(err, 'testNest: no callback error');
|
||||
checkRecursively(testCases.out2, response, 'testNest');
|
||||
});
|
||||
|
||||
client.testInsanity(testCases.crazy, function(err, response) {
|
||||
assert.error(err, 'testInsanity: no callback error');
|
||||
checkRecursively(testCases.insanity, response, 'testInsanity');
|
||||
});
|
||||
|
||||
client.testInsanity(testCases.crazy2, function(err, response) {
|
||||
assert.error(err, 'testInsanity2: no callback error');
|
||||
checkRecursively(testCases.insanity, response, 'testInsanity2');
|
||||
});
|
||||
|
||||
client.testException('TException', function(err, response) {
|
||||
assert.ok(err instanceof TException, 'testException: correct error type');
|
||||
assert.ok(!response, 'testException: no response');
|
||||
});
|
||||
|
||||
client.testException('Xception', function(err, response) {
|
||||
assert.ok(err instanceof ttypes.Xception, 'testException: correct error type');
|
||||
assert.ok(!response, 'testException: no response');
|
||||
assert.equal(err.errorCode, 1001, 'testException: correct error code');
|
||||
assert.equal('Xception', err.message, 'testException: correct error message');
|
||||
});
|
||||
|
||||
client.testException('no Exception', function(err, response) {
|
||||
assert.error(err, 'testException: no callback error');
|
||||
assert.ok(!response, 'testException: no response');
|
||||
});
|
||||
|
||||
client.testOneway(0, function(err, response) {
|
||||
assert.error(err, 'testOneway: no callback error');
|
||||
assert.strictEqual(response, undefined, 'testOneway: void response');
|
||||
});
|
||||
|
||||
checkOffByOne(function(done) {
|
||||
client.testI32(-1, function(err, response) {
|
||||
assert.error(err, 'checkOffByOne: no callback error');
|
||||
assert.equal(-1, response);
|
||||
assert.end();
|
||||
done();
|
||||
const arr = [];
|
||||
for (let i = 0; i < 256; ++i) {
|
||||
arr[i] = 255 - i;
|
||||
}
|
||||
let buf = new Buffer(arr);
|
||||
client.testBinary(buf, function(err, response) {
|
||||
assert.error(err, "testBinary: no callback error");
|
||||
assert.equal(response.length, 256, "testBinary");
|
||||
assert.deepEqual(response, buf, "testBinary(Buffer)");
|
||||
});
|
||||
buf = new Buffer(arr);
|
||||
client.testBinary(buf.toString("binary"), function(err, response) {
|
||||
assert.error(err, "testBinary: no callback error");
|
||||
assert.equal(response.length, 256, "testBinary");
|
||||
assert.deepEqual(response, buf, "testBinary(string)");
|
||||
});
|
||||
}, callback);
|
||||
|
||||
});
|
||||
client.testMapMap(42, function(err, response) {
|
||||
const expected = {
|
||||
"4": { "1": 1, "2": 2, "3": 3, "4": 4 },
|
||||
"-4": { "-4": -4, "-3": -3, "-2": -2, "-1": -1 }
|
||||
};
|
||||
assert.error(err, "testMapMap: no callback error");
|
||||
assert.deepEqual(expected, response, "testMapMap");
|
||||
});
|
||||
|
||||
client.testStruct(testCases.out, function(err, response) {
|
||||
assert.error(err, "testStruct: no callback error");
|
||||
checkRecursively(testCases.out, response, "testStruct");
|
||||
});
|
||||
|
||||
client.testNest(testCases.out2, function(err, response) {
|
||||
assert.error(err, "testNest: no callback error");
|
||||
checkRecursively(testCases.out2, response, "testNest");
|
||||
});
|
||||
|
||||
client.testInsanity(testCases.crazy, function(err, response) {
|
||||
assert.error(err, "testInsanity: no callback error");
|
||||
checkRecursively(testCases.insanity, response, "testInsanity");
|
||||
});
|
||||
|
||||
client.testInsanity(testCases.crazy2, function(err, response) {
|
||||
assert.error(err, "testInsanity2: no callback error");
|
||||
checkRecursively(testCases.insanity, response, "testInsanity2");
|
||||
});
|
||||
|
||||
client.testException("TException", function(err, response) {
|
||||
assert.ok(
|
||||
err instanceof TException,
|
||||
"testException: correct error type"
|
||||
);
|
||||
assert.ok(!response, "testException: no response");
|
||||
});
|
||||
|
||||
client.testException("Xception", function(err, response) {
|
||||
assert.ok(
|
||||
err instanceof ttypes.Xception,
|
||||
"testException: correct error type"
|
||||
);
|
||||
assert.ok(!response, "testException: no response");
|
||||
assert.equal(err.errorCode, 1001, "testException: correct error code");
|
||||
assert.equal(
|
||||
"Xception",
|
||||
err.message,
|
||||
"testException: correct error message"
|
||||
);
|
||||
});
|
||||
|
||||
client.testException("no Exception", function(err, response) {
|
||||
assert.error(err, "testException: no callback error");
|
||||
assert.ok(!response, "testException: no response");
|
||||
});
|
||||
|
||||
client.testOneway(0, function(err, response) {
|
||||
assert.error(err, "testOneway: no callback error");
|
||||
assert.strictEqual(response, undefined, "testOneway: void response");
|
||||
});
|
||||
|
||||
checkOffByOne(function(done) {
|
||||
client.testI32(-1, function(err, response) {
|
||||
assert.error(err, "checkOffByOne: no callback error");
|
||||
assert.equal(-1, response);
|
||||
assert.end();
|
||||
done();
|
||||
});
|
||||
}, callback);
|
||||
}
|
||||
);
|
||||
|
||||
// ES6 does not support callback style
|
||||
if (helpers.ecmaMode === "es6") {
|
||||
checkOffByOne(done => done(), callback);
|
||||
}
|
||||
};
|
||||
|
||||
exports.ThriftTestDriverPromise = function(client, callback) {
|
||||
|
||||
test('Q Promise Client Tests', function(assert) {
|
||||
|
||||
var checkRecursively = makeRecursiveCheck(assert);
|
||||
|
||||
function fail(msg) {
|
||||
return function() {
|
||||
assert.fail(msg);
|
||||
}
|
||||
}
|
||||
test("Promise Client Tests", function(assert) {
|
||||
const checkRecursively = makeRecursiveCheck(assert);
|
||||
|
||||
function makeAsserter(assertionFn) {
|
||||
return function(c) {
|
||||
var fnName = c[0];
|
||||
var expected = c[1];
|
||||
const fnName = c[0];
|
||||
const expected = c[1];
|
||||
client[fnName](expected)
|
||||
.then(function(actual) {
|
||||
assertionFn(actual, expected, fnName);
|
||||
})
|
||||
.fail(fail('fnName'));
|
||||
.catch(() => assert.fail("fnName"));
|
||||
};
|
||||
}
|
||||
|
||||
testCases.simple.forEach(makeAsserter(function(a, e, m){
|
||||
if (a instanceof Int64) {
|
||||
var e64 = e instanceof Int64 ? e : new Int64(e);
|
||||
assert.deepEqual(a.buffer, e64.buffer, m);
|
||||
} else {
|
||||
assert.equal(a, e, m);
|
||||
}
|
||||
}));
|
||||
testCases.simple.forEach(
|
||||
makeAsserter(function(a, e, m) {
|
||||
if (a instanceof Int64) {
|
||||
const e64 = e instanceof Int64 ? e : new Int64(e);
|
||||
assert.deepEqual(a.buffer, e64.buffer, m);
|
||||
} else {
|
||||
assert.equal(a, e, m);
|
||||
}
|
||||
})
|
||||
);
|
||||
testCases.deep.forEach(makeAsserter(assert.deepEqual));
|
||||
testCases.deepUnordered.forEach(makeAsserter(makeUnorderedDeepEqual(assert)));
|
||||
testCases.deepUnordered.forEach(
|
||||
makeAsserter(makeUnorderedDeepEqual(assert))
|
||||
);
|
||||
|
||||
client.testStruct(testCases.out)
|
||||
client
|
||||
.testStruct(testCases.out)
|
||||
.then(function(response) {
|
||||
checkRecursively(testCases.out, response, 'testStruct');
|
||||
checkRecursively(testCases.out, response, "testStruct");
|
||||
})
|
||||
.fail(fail('testStruct'));
|
||||
.catch(() => assert.fail("testStruct"));
|
||||
|
||||
client.testNest(testCases.out2)
|
||||
client
|
||||
.testNest(testCases.out2)
|
||||
.then(function(response) {
|
||||
checkRecursively(testCases.out2, response, 'testNest');
|
||||
checkRecursively(testCases.out2, response, "testNest");
|
||||
})
|
||||
.fail(fail('testNest'));
|
||||
.catch(() => assert.fail("testNest"));
|
||||
|
||||
client.testInsanity(testCases.crazy)
|
||||
client
|
||||
.testInsanity(testCases.crazy)
|
||||
.then(function(response) {
|
||||
checkRecursively(testCases.insanity, response, 'testInsanity');
|
||||
checkRecursively(testCases.insanity, response, "testInsanity");
|
||||
})
|
||||
.fail(fail('testInsanity'));
|
||||
.catch(() => assert.fail("testInsanity"));
|
||||
|
||||
client.testInsanity(testCases.crazy2)
|
||||
client
|
||||
.testInsanity(testCases.crazy2)
|
||||
.then(function(response) {
|
||||
checkRecursively(testCases.insanity, response, 'testInsanity2');
|
||||
checkRecursively(testCases.insanity, response, "testInsanity2");
|
||||
})
|
||||
.fail(fail('testInsanity2'));
|
||||
.catch(() => assert.fail("testInsanity2"));
|
||||
|
||||
client.testException('TException')
|
||||
.then(function(response) {
|
||||
fail('testException: TException');
|
||||
client
|
||||
.testException("TException")
|
||||
.then(function() {
|
||||
assert.fail("testException: TException");
|
||||
})
|
||||
.fail(function(err) {
|
||||
.catch(function(err) {
|
||||
assert.ok(err instanceof TException);
|
||||
});
|
||||
|
||||
client.testException('Xception')
|
||||
.then(function(response) {
|
||||
fail('testException: Xception');
|
||||
client
|
||||
.testException("Xception")
|
||||
.then(function() {
|
||||
assert.fail("testException: Xception");
|
||||
})
|
||||
.fail(function(err) {
|
||||
.catch(function(err) {
|
||||
assert.ok(err instanceof ttypes.Xception);
|
||||
assert.equal(err.errorCode, 1001);
|
||||
assert.equal('Xception', err.message);
|
||||
assert.equal("Xception", err.message);
|
||||
});
|
||||
|
||||
client.testException('no Exception')
|
||||
client
|
||||
.testException("no Exception")
|
||||
.then(function(response) {
|
||||
assert.equal(undefined, response); //void
|
||||
})
|
||||
.fail(fail('testException'));
|
||||
.catch(() => assert.fail("testException"));
|
||||
|
||||
client.testOneway(0)
|
||||
client
|
||||
.testOneway(0)
|
||||
.then(function(response) {
|
||||
assert.strictEqual(response, undefined, 'testOneway: void response')
|
||||
assert.strictEqual(response, undefined, "testOneway: void response");
|
||||
})
|
||||
.fail(fail('testOneway: should not reject'));
|
||||
.catch(() => assert.fail("testOneway: should not reject"));
|
||||
|
||||
checkOffByOne(function(done) {
|
||||
client.testI32(-1)
|
||||
client
|
||||
.testI32(-1)
|
||||
.then(function(response) {
|
||||
assert.equal(-1, response);
|
||||
assert.end();
|
||||
done();
|
||||
assert.equal(-1, response);
|
||||
assert.end();
|
||||
done();
|
||||
})
|
||||
.fail(fail('checkOffByOne'));
|
||||
.catch(() => assert.fail("checkOffByOne"));
|
||||
}, callback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
// Helper Functions
|
||||
// =========================================================
|
||||
|
||||
function makeRecursiveCheck(assert) {
|
||||
|
||||
return function (map1, map2, msg) {
|
||||
var equal = true;
|
||||
|
||||
var equal = checkRecursively(map1, map2);
|
||||
return function(map1, map2, msg) {
|
||||
const equal = checkRecursively(map1, map2);
|
||||
|
||||
assert.ok(equal, msg);
|
||||
|
||||
// deepEqual doesn't work with fields using node-int64
|
||||
function checkRecursively(map1, map2) {
|
||||
if (typeof map1 !== 'function' && typeof map2 !== 'function') {
|
||||
if (!map1 || typeof map1 !== 'object') {
|
||||
if (typeof map1 !== "function" && typeof map2 !== "function") {
|
||||
if (!map1 || typeof map1 !== "object") {
|
||||
//Handle int64 types (which use node-int64 in Node.js JavaScript)
|
||||
if ((typeof map1 === "number") && (typeof map2 === "object") &&
|
||||
(map2.buffer) && (map2.buffer instanceof Buffer) && (map2.buffer.length === 8)) {
|
||||
var n = new Int64(map2.buffer);
|
||||
if (
|
||||
typeof map1 === "number" &&
|
||||
typeof map2 === "object" &&
|
||||
map2.buffer &&
|
||||
map2.buffer instanceof Buffer &&
|
||||
map2.buffer.length === 8
|
||||
) {
|
||||
const n = new Int64(map2.buffer);
|
||||
return map1 === n.toNumber();
|
||||
} else {
|
||||
return map1 == map2;
|
||||
|
@ -274,15 +301,14 @@ function makeRecursiveCheck(assert) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function checkOffByOne(done, callback) {
|
||||
|
||||
var retry_limit = 30;
|
||||
var retry_interval = 100;
|
||||
var test_complete = false;
|
||||
var retrys = 0;
|
||||
const retry_limit = 30;
|
||||
const retry_interval = 100;
|
||||
let test_complete = false;
|
||||
let retrys = 0;
|
||||
|
||||
/**
|
||||
* redo a simple test after the oneway to make sure we aren't "off by one" --
|
||||
|
@ -299,14 +325,17 @@ function checkOffByOne(done, callback) {
|
|||
|
||||
//We wait up to retry_limit * retry_interval for the test suite to complete
|
||||
function TestForCompletion() {
|
||||
if(test_complete && callback) {
|
||||
if (test_complete && callback) {
|
||||
callback("Server successfully tested!");
|
||||
} else {
|
||||
if (++retrys < retry_limit) {
|
||||
setTimeout(TestForCompletion, retry_interval);
|
||||
} else if (callback) {
|
||||
callback("Server test failed to complete after " +
|
||||
(retry_limit * retry_interval / 1000) + " seconds");
|
||||
callback(
|
||||
"Server test failed to complete after " +
|
||||
(retry_limit * retry_interval) / 1000 +
|
||||
" seconds"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,15 +346,15 @@ function checkOffByOne(done, callback) {
|
|||
function makeUnorderedDeepEqual(assert) {
|
||||
return function(actual, expected, name) {
|
||||
assert.equal(actual.length, expected.length, name);
|
||||
for (var k in actual) {
|
||||
var found = false;
|
||||
for (var k2 in expected) {
|
||||
for (const k in actual) {
|
||||
let found = false;
|
||||
for (const k2 in expected) {
|
||||
if (actual[k] === expected[k2]) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
assert.fail('Unexpected value ' + actual[k] + ' with key ' + k);
|
||||
assert.fail("Unexpected value " + actual[k] + " with key " + k);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
129
vendor/git.apache.org/thrift.git/lib/nodejs/test/test_handler.js
generated
vendored
129
vendor/git.apache.org/thrift.git/lib/nodejs/test/test_handler.js
generated
vendored
|
@ -19,18 +19,17 @@
|
|||
|
||||
//This is the server side Node test handler for the standard
|
||||
// Apache Thrift test service.
|
||||
const helpers = require("./helpers");
|
||||
const ttypes = require(`./${helpers.genPath}/ThriftTest_types`);
|
||||
const TException = require("thrift").Thrift.TException;
|
||||
|
||||
var ttypes = require('./gen-nodejs/ThriftTest_types');
|
||||
var TException = require('thrift').Thrift.TException;
|
||||
|
||||
function makeSyncHandler(label) {
|
||||
function makeSyncHandler() {
|
||||
return function(thing) {
|
||||
//console.log(label + '(\'' + thing + '\')');
|
||||
return thing;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var syncHandlers = {
|
||||
const syncHandlers = {
|
||||
testVoid: testVoid,
|
||||
testMapMap: testMapMap,
|
||||
testInsanity: testInsanity,
|
||||
|
@ -44,10 +43,10 @@ function makeAsyncHandler(label) {
|
|||
return function(thing, result) {
|
||||
thing = syncHandlers[label](thing);
|
||||
result(null, thing);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var asyncHandlers = {
|
||||
const asyncHandlers = {
|
||||
testVoid: testVoidAsync,
|
||||
testMulti: testMultiAsync,
|
||||
testException: testExceptionAsync,
|
||||
|
@ -55,22 +54,22 @@ var asyncHandlers = {
|
|||
testOneway: testOnewayAsync
|
||||
};
|
||||
|
||||
var identityHandlers = [
|
||||
'testString',
|
||||
'testBool',
|
||||
'testByte',
|
||||
'testI32',
|
||||
'testI64',
|
||||
'testDouble',
|
||||
'testBinary',
|
||||
'testStruct',
|
||||
'testNest',
|
||||
'testMap',
|
||||
'testStringMap',
|
||||
'testSet',
|
||||
'testList',
|
||||
'testEnum',
|
||||
'testTypedef'
|
||||
const identityHandlers = [
|
||||
"testString",
|
||||
"testBool",
|
||||
"testByte",
|
||||
"testI32",
|
||||
"testI64",
|
||||
"testDouble",
|
||||
"testBinary",
|
||||
"testStruct",
|
||||
"testNest",
|
||||
"testMap",
|
||||
"testStringMap",
|
||||
"testSet",
|
||||
"testList",
|
||||
"testEnum",
|
||||
"testTypedef"
|
||||
];
|
||||
|
||||
function testVoid() {
|
||||
|
@ -81,13 +80,11 @@ function testVoidAsync(result) {
|
|||
result(testVoid());
|
||||
}
|
||||
|
||||
function testMapMap(hello) {
|
||||
//console.log('testMapMap(' + hello + ')');
|
||||
|
||||
var mapmap = [];
|
||||
var pos = [];
|
||||
var neg = [];
|
||||
for (var i = 1; i < 5; i++) {
|
||||
function testMapMap() {
|
||||
const mapmap = [];
|
||||
const pos = [];
|
||||
const neg = [];
|
||||
for (let i = 1; i < 5; i++) {
|
||||
pos[i] = i;
|
||||
neg[-i] = -i;
|
||||
}
|
||||
|
@ -102,16 +99,16 @@ function testInsanity(argument) {
|
|||
//console.log(argument);
|
||||
//console.log(')');
|
||||
|
||||
var first_map = [];
|
||||
var second_map = [];
|
||||
const first_map = [];
|
||||
const second_map = [];
|
||||
|
||||
first_map[ttypes.Numberz.TWO] = argument;
|
||||
first_map[ttypes.Numberz.THREE] = argument;
|
||||
|
||||
var looney = new ttypes.Insanity();
|
||||
const looney = new ttypes.Insanity();
|
||||
second_map[ttypes.Numberz.SIX] = looney;
|
||||
|
||||
var insane = [];
|
||||
const insane = [];
|
||||
insane[1] = first_map;
|
||||
insane[2] = second_map;
|
||||
|
||||
|
@ -120,11 +117,11 @@ function testInsanity(argument) {
|
|||
return insane;
|
||||
}
|
||||
|
||||
function testMulti(arg0, arg1, arg2, arg3, arg4, arg5) {
|
||||
function testMulti(arg0, arg1, arg2) {
|
||||
//console.log('testMulti()');
|
||||
|
||||
var hello = new ttypes.Xtruct();
|
||||
hello.string_thing = 'Hello2';
|
||||
const hello = new ttypes.Xtruct();
|
||||
hello.string_thing = "Hello2";
|
||||
hello.byte_thing = arg0;
|
||||
hello.i32_thing = arg1;
|
||||
hello.i64_thing = arg2;
|
||||
|
@ -132,18 +129,18 @@ function testMulti(arg0, arg1, arg2, arg3, arg4, arg5) {
|
|||
}
|
||||
|
||||
function testMultiAsync(arg0, arg1, arg2, arg3, arg4, arg5, result) {
|
||||
var hello = testMulti(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
const hello = testMulti(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||
result(null, hello);
|
||||
}
|
||||
|
||||
function testException(arg) {
|
||||
//console.log('testException('+arg+')');
|
||||
if (arg === 'Xception') {
|
||||
var x = new ttypes.Xception();
|
||||
if (arg === "Xception") {
|
||||
const x = new ttypes.Xception();
|
||||
x.errorCode = 1001;
|
||||
x.message = arg;
|
||||
throw x;
|
||||
} else if (arg === 'TException') {
|
||||
} else if (arg === "TException") {
|
||||
throw new TException(arg);
|
||||
} else {
|
||||
return;
|
||||
|
@ -152,12 +149,12 @@ function testException(arg) {
|
|||
|
||||
function testExceptionAsync(arg, result) {
|
||||
//console.log('testException('+arg+')');
|
||||
if (arg === 'Xception') {
|
||||
var x = new ttypes.Xception();
|
||||
if (arg === "Xception") {
|
||||
const x = new ttypes.Xception();
|
||||
x.errorCode = 1001;
|
||||
x.message = arg;
|
||||
result(x);
|
||||
} else if (arg === 'TException') {
|
||||
} else if (arg === "TException") {
|
||||
result(new TException(arg));
|
||||
} else {
|
||||
result(null);
|
||||
|
@ -166,49 +163,48 @@ function testExceptionAsync(arg, result) {
|
|||
|
||||
function testMultiException(arg0, arg1) {
|
||||
//console.log('testMultiException(' + arg0 + ', ' + arg1 + ')');
|
||||
if (arg0 === ('Xception')) {
|
||||
var x = new ttypes.Xception();
|
||||
if (arg0 === "Xception") {
|
||||
const x = new ttypes.Xception();
|
||||
x.errorCode = 1001;
|
||||
x.message = 'This is an Xception';
|
||||
x.message = "This is an Xception";
|
||||
throw x;
|
||||
} else if (arg0 === ('Xception2')) {
|
||||
var x2 = new ttypes.Xception2();
|
||||
} else if (arg0 === "Xception2") {
|
||||
const x2 = new ttypes.Xception2();
|
||||
x2.errorCode = 2002;
|
||||
x2.struct_thing = new ttypes.Xtruct();
|
||||
x2.struct_thing.string_thing = 'This is an Xception2';
|
||||
x2.struct_thing.string_thing = "This is an Xception2";
|
||||
throw x2;
|
||||
}
|
||||
|
||||
var res = new ttypes.Xtruct();
|
||||
const res = new ttypes.Xtruct();
|
||||
res.string_thing = arg1;
|
||||
return res;
|
||||
}
|
||||
|
||||
function testMultiExceptionAsync(arg0, arg1, result) {
|
||||
//console.log('testMultiException(' + arg0 + ', ' + arg1 + ')');
|
||||
if (arg0 === ('Xception')) {
|
||||
var x = new ttypes.Xception();
|
||||
if (arg0 === "Xception") {
|
||||
const x = new ttypes.Xception();
|
||||
x.errorCode = 1001;
|
||||
x.message = 'This is an Xception';
|
||||
x.message = "This is an Xception";
|
||||
result(x);
|
||||
} else if (arg0 === ('Xception2')) {
|
||||
var x2 = new ttypes.Xception2();
|
||||
} else if (arg0 === "Xception2") {
|
||||
const x2 = new ttypes.Xception2();
|
||||
x2.errorCode = 2002;
|
||||
x2.struct_thing = new ttypes.Xtruct();
|
||||
x2.struct_thing.string_thing = 'This is an Xception2';
|
||||
x2.struct_thing.string_thing = "This is an Xception2";
|
||||
result(x2);
|
||||
} else {
|
||||
var res = new ttypes.Xtruct();
|
||||
const res = new ttypes.Xtruct();
|
||||
res.string_thing = arg1;
|
||||
result(null, res);
|
||||
}
|
||||
}
|
||||
|
||||
function testOneway(sleepFor) {
|
||||
//console.log('testOneway(' + sleepFor + ') => JavaScript (like Rust) never sleeps!');
|
||||
}
|
||||
//console.log('testOneway(' + sleepFor + ') => JavaScript (like Rust) never sleeps!');
|
||||
function testOneway() {}
|
||||
|
||||
function testOnewayAsync(sleepFor, result) {
|
||||
function testOnewayAsync(sleepFor) {
|
||||
testOneway(sleepFor);
|
||||
}
|
||||
|
||||
|
@ -217,11 +213,8 @@ identityHandlers.forEach(function(label) {
|
|||
asyncHandlers[label] = makeAsyncHandler(label);
|
||||
});
|
||||
|
||||
['testMapMap', 'testInsanity'].forEach(function(label) {
|
||||
["testMapMap", "testInsanity"].forEach(function(label) {
|
||||
asyncHandlers[label] = makeAsyncHandler(label);
|
||||
});
|
||||
|
||||
exports.ThriftTestHandler = asyncHandlers;
|
||||
|
||||
exports.AsyncThriftTestHandler = asyncHandlers;
|
||||
exports.SyncThriftTestHandler = asyncHandlers;
|
||||
|
|
1
vendor/git.apache.org/thrift.git/lib/nodets/.gitignore
generated
vendored
Normal file
1
vendor/git.apache.org/thrift.git/lib/nodets/.gitignore
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
test-compiled/
|
45
vendor/git.apache.org/thrift.git/lib/nodets/Makefile.am
generated
vendored
Executable file
45
vendor/git.apache.org/thrift.git/lib/nodets/Makefile.am
generated
vendored
Executable file
|
@ -0,0 +1,45 @@
|
|||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
# We call npm twice to work around npm issues
|
||||
|
||||
stubs: $(top_srcdir)/test/ThriftTest.thrift
|
||||
mkdir -p test-compiled
|
||||
$(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/ThriftTest.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/ThriftTest.thrift
|
||||
|
||||
ts-compile: stubs
|
||||
mkdir -p test-compiled
|
||||
../../node_modules/typescript/bin/tsc --outDir test-compiled/ --project test/tsconfig.json
|
||||
|
||||
deps: $(top_srcdir)/package.json
|
||||
$(NPM) install $(top_srcdir)/ || $(NPM) install $(top_srcdir)/
|
||||
|
||||
all-local: deps ts-compile
|
||||
|
||||
precross: deps stubs ts-compile
|
||||
|
||||
check: deps ts-compile
|
||||
cd $(top_srcdir) && $(NPM) run test-ts && cd lib/nodets
|
||||
|
||||
clean-local:
|
||||
$(RM) -r test/gen-nodejs
|
||||
$(RM) -r $(top_srcdir)/node_modules
|
||||
$(RM) -r test-compiled
|
||||
|
||||
EXTRA_DIST = \
|
||||
test \
|
||||
coding_standards.md
|
1
vendor/git.apache.org/thrift.git/lib/nodets/coding_standards.md
generated
vendored
Normal file
1
vendor/git.apache.org/thrift.git/lib/nodets/coding_standards.md
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Please follow [General Coding Standards](/doc/coding_standards.md)
|
63
vendor/git.apache.org/thrift.git/lib/nodets/test/client.ts
generated
vendored
Normal file
63
vendor/git.apache.org/thrift.git/lib/nodets/test/client.ts
generated
vendored
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import assert = require("assert");
|
||||
import thrift = require("thrift");
|
||||
import Thrift = thrift.Thrift;
|
||||
import ThriftTest = require("./gen-nodejs/ThriftTest");
|
||||
import test_driver = require("./test_driver");
|
||||
import ThriftTestDriver = test_driver.ThriftTestDriver;
|
||||
import ThriftTestDriverPromise = test_driver.ThriftTestDriverPromise;
|
||||
|
||||
// var program = require("commander");
|
||||
import * as program from "commander";
|
||||
|
||||
program
|
||||
.option("--port <port>", "Set thrift server port number to connect", 9090)
|
||||
.option("--promise", "test with promise style functions")
|
||||
.option("--protocol", "Set thrift protocol (binary) [protocol]")
|
||||
.parse(process.argv);
|
||||
|
||||
var port: number = program.port;
|
||||
var promise = program.promise;
|
||||
|
||||
var options = {
|
||||
transport: Thrift.TBufferedTransport,
|
||||
protocol: Thrift.TBinaryProtocol
|
||||
};
|
||||
|
||||
var testDriver = promise ? ThriftTestDriverPromise : ThriftTestDriver;
|
||||
|
||||
var connection = thrift.createConnection("localhost", port, options);
|
||||
|
||||
connection.on("error", function(err: string) {
|
||||
assert(false, err);
|
||||
});
|
||||
|
||||
var client = thrift.createClient(ThriftTest.Client, connection);
|
||||
runTests();
|
||||
|
||||
function runTests() {
|
||||
testDriver(client, function (status: string) {
|
||||
console.log(status);
|
||||
process.exit(0);
|
||||
});
|
||||
}
|
||||
|
||||
exports.expressoTest = function() {};
|
18
vendor/git.apache.org/thrift.git/lib/nodets/test/runClient.sh
generated
vendored
Executable file
18
vendor/git.apache.org/thrift.git/lib/nodets/test/runClient.sh
generated
vendored
Executable file
|
@ -0,0 +1,18 @@
|
|||
#! /bin/sh
|
||||
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
|
||||
mkdir -p $DIR/../test-compiled
|
||||
|
||||
COMPILEDDIR="$(cd $DIR && cd ../test-compiled && pwd)"
|
||||
export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
|
||||
|
||||
compile()
|
||||
{
|
||||
#generating thrift code
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
|
||||
}
|
||||
compile
|
||||
|
||||
node ${COMPILEDDIR}/client.js $*
|
20
vendor/git.apache.org/thrift.git/lib/nodets/test/runServer.sh
generated
vendored
Executable file
20
vendor/git.apache.org/thrift.git/lib/nodets/test/runServer.sh
generated
vendored
Executable file
|
@ -0,0 +1,20 @@
|
|||
#! /bin/sh
|
||||
|
||||
DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
|
||||
mkdir -p $DIR/../test-compiled
|
||||
|
||||
COMPILEDDIR="$(cd $DIR && cd ../test-compiled && pwd)"
|
||||
export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
|
||||
|
||||
compile()
|
||||
{
|
||||
#generating thrift code
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
|
||||
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
|
||||
}
|
||||
compile
|
||||
|
||||
node ${COMPILEDDIR}/server.js $*
|
||||
|
||||
|
26
vendor/git.apache.org/thrift.git/lib/nodets/test/server.ts
generated
vendored
Normal file
26
vendor/git.apache.org/thrift.git/lib/nodets/test/server.ts
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
import thrift = require("thrift");
|
||||
var program = require('commander');
|
||||
import ThriftTest = require('./gen-nodejs/ThriftTest');
|
||||
import test_handler = require('./test_handler');
|
||||
|
||||
|
||||
program
|
||||
.option('--port <port>', 'Set thrift server port', 9090)
|
||||
.option('--promise', 'test with promise style functions')
|
||||
.option('--protocol', '"Set thrift protocol (binary) [protocol]"')
|
||||
.parse(process.argv);
|
||||
|
||||
var port: number = program.port;
|
||||
|
||||
var options: thrift.ServerOptions = {
|
||||
transport: thrift.TBufferedTransport,
|
||||
protocol: thrift.TBinaryProtocol
|
||||
};
|
||||
|
||||
var server: thrift.Server;
|
||||
if (program.promise) {
|
||||
server = thrift.createServer(ThriftTest.Processor, new test_handler.AsyncThriftTestHandler(), options);
|
||||
} else {
|
||||
server = thrift.createServer(ThriftTest.Processor, new test_handler.SyncThriftTestHandler(), options);
|
||||
}
|
||||
server.listen(port);
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue