From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- .../thrift/lib/haxe/test/HaxeTests.hxproj | 69 +++++++ src/jaegertracing/thrift/lib/haxe/test/Makefile.am | 85 ++++++++ src/jaegertracing/thrift/lib/haxe/test/cpp.hxml | 41 ++++ src/jaegertracing/thrift/lib/haxe/test/csharp.hxml | 38 ++++ src/jaegertracing/thrift/lib/haxe/test/flash.hxml | 38 ++++ src/jaegertracing/thrift/lib/haxe/test/java.hxml | 38 ++++ .../thrift/lib/haxe/test/javascript.hxml | 44 ++++ .../thrift/lib/haxe/test/make_all.bat | 70 +++++++ src/jaegertracing/thrift/lib/haxe/test/make_all.sh | 43 ++++ src/jaegertracing/thrift/lib/haxe/test/neko.hxml | 38 ++++ src/jaegertracing/thrift/lib/haxe/test/php.hxml | 39 ++++ .../thrift/lib/haxe/test/project.hide | 67 ++++++ src/jaegertracing/thrift/lib/haxe/test/python.hxml | 38 ++++ src/jaegertracing/thrift/lib/haxe/test/src/Main.hx | 93 +++++++++ .../thrift/lib/haxe/test/src/MultiplexTest.hx | 224 +++++++++++++++++++++ .../thrift/lib/haxe/test/src/StreamTest.hx | 95 +++++++++ .../thrift/lib/haxe/test/src/TestBase.hx | 46 +++++ 17 files changed, 1106 insertions(+) create mode 100644 src/jaegertracing/thrift/lib/haxe/test/HaxeTests.hxproj create mode 100644 src/jaegertracing/thrift/lib/haxe/test/Makefile.am create mode 100644 src/jaegertracing/thrift/lib/haxe/test/cpp.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/csharp.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/flash.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/java.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/javascript.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/make_all.bat create mode 100644 src/jaegertracing/thrift/lib/haxe/test/make_all.sh create mode 100644 src/jaegertracing/thrift/lib/haxe/test/neko.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/php.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/project.hide create mode 100644 src/jaegertracing/thrift/lib/haxe/test/python.hxml create mode 100644 src/jaegertracing/thrift/lib/haxe/test/src/Main.hx create mode 100644 src/jaegertracing/thrift/lib/haxe/test/src/MultiplexTest.hx create mode 100644 src/jaegertracing/thrift/lib/haxe/test/src/StreamTest.hx create mode 100644 src/jaegertracing/thrift/lib/haxe/test/src/TestBase.hx (limited to 'src/jaegertracing/thrift/lib/haxe/test') diff --git a/src/jaegertracing/thrift/lib/haxe/test/HaxeTests.hxproj b/src/jaegertracing/thrift/lib/haxe/test/HaxeTests.hxproj new file mode 100644 index 000000000..3beed8244 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/HaxeTests.hxproj @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + thrift -r -gen haxe ../../../test/ThriftTest.thrift +thrift -r -gen haxe ../../../contrib/async-test/aggr.thrift +thrift -r -gen haxe ../../../lib/rb/benchmark/Benchmark.thrift + + + + + + + + \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/Makefile.am b/src/jaegertracing/thrift/lib/haxe/test/Makefile.am new file mode 100644 index 000000000..2b8b24524 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/Makefile.am @@ -0,0 +1,85 @@ +# +# 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. +# + +THRIFTCMD = $(THRIFT) --gen haxe -r +THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift +AGGR = $(top_srcdir)/contrib/async-test/aggr.thrift +BENCHMARK = $(top_srcdir)/lib/rb/benchmark/Benchmark.thrift + +BIN_CPP = bin/Main-debug +BIN_PHP = bin/php/Main-debug.php + +gen-haxe/thrift/test/ThriftTest.hx: $(THRIFTTEST) + $(THRIFTCMD) $(THRIFTTEST) + +gen-haxe/thrift/test/Aggr.hx: $(AGGR) + $(THRIFTCMD) $(AGGR) + +gen-haxe/thrift/test/BenchmarkService.hx: $(BENCHMARK) + $(THRIFTCMD) $(BENCHMARK) + +all-local: $(BIN_CPP) $(BIN_PHP) + +$(BIN_CPP): \ + src/*.hx \ + ../src/org/apache/thrift/**/*.hx \ + gen-haxe/thrift/test/ThriftTest.hx \ + gen-haxe/thrift/test/Aggr.hx \ + gen-haxe/thrift/test/BenchmarkService.hx + $(HAXE) --cwd . cpp.hxml + +$(BIN_PHP): \ + src/*.hx \ + ../src/org/apache/thrift/**/*.hx \ + gen-haxe/thrift/test/ThriftTest.hx \ + gen-haxe/thrift/test/Aggr.hx \ + gen-haxe/thrift/test/BenchmarkService.hx + $(HAXE) --cwd . php.hxml + + +#TODO: other haxe targets +# $(HAXE) --cwd . csharp +# $(HAXE) --cwd . flash +# $(HAXE) --cwd . java +# $(HAXE) --cwd . javascript +# $(HAXE) --cwd . neko +# $(HAXE) --cwd . python # needs Haxe 3.2.0 + + +clean-local: + $(RM) -r gen-haxe bin + +check: $(BIN_CPP) $(BIN_PHP) + $(BIN_CPP) + php -f $(BIN_PHP) + +EXTRA_DIST = \ + src \ + cpp.hxml \ + csharp.hxml \ + flash.hxml \ + java.hxml \ + javascript.hxml \ + neko.hxml \ + php.hxml \ + python.hxml \ + project.hide \ + HaxeTests.hxproj \ + make_all.bat \ + make_all.sh diff --git a/src/jaegertracing/thrift/lib/haxe/test/cpp.hxml b/src/jaegertracing/thrift/lib/haxe/test/cpp.hxml new file mode 100644 index 000000000..73848a8bc --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/cpp.hxml @@ -0,0 +1,41 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#CPP target +-cpp bin + +#To produce 64 bit binaries the file should define the HXCPP_M64 compile variable: +#-D HXCPP_M64 + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/csharp.hxml b/src/jaegertracing/thrift/lib/haxe/test/csharp.hxml new file mode 100644 index 000000000..4c34b0d94 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/csharp.hxml @@ -0,0 +1,38 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#CSHARP target +-cs bin/Test.exe + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/flash.hxml b/src/jaegertracing/thrift/lib/haxe/test/flash.hxml new file mode 100644 index 000000000..8b1763190 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/flash.hxml @@ -0,0 +1,38 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#Flash target +-swf bin/Test.swf + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/java.hxml b/src/jaegertracing/thrift/lib/haxe/test/java.hxml new file mode 100644 index 000000000..c9471597c --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/java.hxml @@ -0,0 +1,38 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#Java target +-java bin/Test.jar + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/javascript.hxml b/src/jaegertracing/thrift/lib/haxe/test/javascript.hxml new file mode 100644 index 000000000..18d9964c2 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/javascript.hxml @@ -0,0 +1,44 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#JavaScript target +-js bin/Test.js + +#You can use -D source-map-content (requires Haxe 3.1+) to have the .hx +#files directly embedded into the map file, this way you only have to +#upload it, and it will be always in sync with the compiled .js even if +#you modify your .hx files. +-D source-map-content + +#Generate source map and add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/make_all.bat b/src/jaegertracing/thrift/lib/haxe/test/make_all.bat new file mode 100644 index 000000000..0314e18a3 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/make_all.bat @@ -0,0 +1,70 @@ +@echo off +rem /* +rem * Licensed to the Apache Software Foundation (ASF) under one +rem * or more contributor license agreements. See the NOTICE file +rem * distributed with this work for additional information +rem * regarding copyright ownership. The ASF licenses this file +rem * to you under the Apache License, Version 2.0 (the +rem * "License"); you may not use this file except in compliance +rem * with the License. You may obtain a copy of the License at +rem * +rem * http://www.apache.org/licenses/LICENSE-2.0 +rem * +rem * Unless required by applicable law or agreed to in writing, +rem * software distributed under the License is distributed on an +rem * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +rem * KIND, either express or implied. See the License for the +rem * specific language governing permissions and limitations +rem * under the License. +rem */ + +setlocal +if "%HOMEDRIVE%"=="" goto MISSINGVARS +if "%HOMEPATH%"=="" goto MISSINGVARS +if "%HAXEPATH%"=="" goto NOTINSTALLED + +set path=%HAXEPATH%;%HAXEPATH%\..\neko;%path% + +rem # invoke Thrift comnpiler +thrift -r -gen haxe ..\..\..\test\ThriftTest.thrift +thrift -r -gen haxe ..\..\..\contrib\async-test\aggr.thrift +thrift -r -gen haxe ..\..\..\lib\rb\benchmark\Benchmark.thrift +if errorlevel 1 goto STOP + +rem # invoke Haxe compiler for all targets +for %%a in (*.hxml) do ( + rem * filter Python, as it is not supported by Haxe 3.1.3 (but will be in 3.1.4) + if not "%%a"=="python.hxml" ( + echo -------------------------- + echo Building %%a ... + echo -------------------------- + haxe --cwd . %%a + ) +) + + +echo. +echo done. +pause +goto eof + +:NOTINSTALLED +echo FATAL: Either Haxe is not installed, or the HAXEPATH variable is not set. +pause +goto eof + +:MISSINGVARS +echo FATAL: Unable to locate home folder. +echo. +echo Both HOMEDRIVE and HOMEPATH need to be set to point to your Home folder. +echo The current values are: +echo HOMEDRIVE=%HOMEDRIVE% +echo HOMEPATH=%HOMEPATH% +pause +goto eof + +:STOP +pause +goto eof + +:eof diff --git a/src/jaegertracing/thrift/lib/haxe/test/make_all.sh b/src/jaegertracing/thrift/lib/haxe/test/make_all.sh new file mode 100644 index 000000000..512f5ec03 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/make_all.sh @@ -0,0 +1,43 @@ +#!/bin/sh +# +# 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. +# + +# invoke Thrift comnpiler +thrift -r -gen haxe ../../../test/ThriftTest.thrift +thrift -r -gen haxe ../../../contrib/async-test/aggr.thrift +thrift -r -gen haxe ../../../lib/rb/benchmark/Benchmark.thrift + +# output folder +if [ ! -d bin ]; then + mkdir bin +fi + +# invoke Haxe compiler +for target in *.hxml; do + echo -------------------------- + echo Building ${target} ... + echo -------------------------- + if [ ! -d bin/${target} ]; then + mkdir bin/${target} + fi + haxe --cwd . ${target} +done + + +#eof diff --git a/src/jaegertracing/thrift/lib/haxe/test/neko.hxml b/src/jaegertracing/thrift/lib/haxe/test/neko.hxml new file mode 100644 index 000000000..2db70c8e6 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/neko.hxml @@ -0,0 +1,38 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#neko target +-neko bin/Test.n + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/php.hxml b/src/jaegertracing/thrift/lib/haxe/test/php.hxml new file mode 100644 index 000000000..14f2b2d01 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/php.hxml @@ -0,0 +1,39 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#PHP target +-php bin/php/ +--php-front Main-debug.php + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full diff --git a/src/jaegertracing/thrift/lib/haxe/test/project.hide b/src/jaegertracing/thrift/lib/haxe/test/project.hide new file mode 100644 index 000000000..16ef98e98 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/project.hide @@ -0,0 +1,67 @@ +{ + "type" : 0 + ,"target" : 4 + ,"name" : "Test" + ,"main" : null + ,"projectPackage" : "" + ,"company" : "" + ,"license" : "" + ,"url" : "" + ,"targetData" : [ + { + "pathToHxml" : "flash.hxml" + ,"runActionType" : 1 + ,"runActionText" : "bin/Test.swf" + } + ,{ + "pathToHxml" : "javascript.hxml" + ,"runActionType" : 1 + ,"runActionText" : "bin\\index.html" + } + ,{ + "pathToHxml" : "neko.hxml" + ,"runActionType" : 2 + ,"runActionText" : "neko bin/Test.n" + } + ,{ + "pathToHxml" : "php.hxml" + } + ,{ + "pathToHxml" : "cpp.hxml" + ,"runActionType" : 2 + ,"runActionText" : "bin/Main-debug.exe" + } + ,{ + "pathToHxml" : "java.hxml" + } + ,{ + "pathToHxml" : "csharp.hxml" + } + ,{ + "pathToHxml" : "python.hxml" + ,"runActionType" : 2 + ,"runActionText" : "python bin/Test.py" + } + ] + ,"files" : [ + { + "path" : "src\\Main.hx" + ,"useTabs" : true + ,"indentSize" : 4 + ,"foldedRegions" : [ + + ] + ,"activeLine" : 13 + } + ] + ,"activeFile" : "src\\Main.hx" + ,"openFLTarget" : null + ,"openFLBuildMode" : "Debug" + ,"runActionType" : null + ,"runActionText" : null + ,"buildActionCommand" : null + ,"hiddenItems" : [ + + ] + ,"showHiddenItems" : false +} \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/python.hxml b/src/jaegertracing/thrift/lib/haxe/test/python.hxml new file mode 100644 index 000000000..4d6a133d6 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/python.hxml @@ -0,0 +1,38 @@ +# +# 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. +# + +#integrate files to classpath +-cp src +-cp ../src +-cp gen-haxe + +#this class wil be used as entry point for your app. +-main Main + +#Python target +-python bin/Test.py + +#Add debug information +-debug + +#dead code elimination : remove unused code +#"-dce no" : do not remove unused code +#"-dce std" : remove unused code in the std lib (default) +#"-dce full" : remove all unused code +-dce full \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/src/Main.hx b/src/jaegertracing/thrift/lib/haxe/test/src/Main.hx new file mode 100644 index 000000000..6c262d78f --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/src/Main.hx @@ -0,0 +1,93 @@ +/* + * 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. + */ + +package; + +import org.apache.thrift.*; +import org.apache.thrift.protocol.*; +import org.apache.thrift.transport.*; +import org.apache.thrift.server.*; +import org.apache.thrift.meta_data.*; + +import thrift.test.*; // generated code + + +enum WhatTests { + Normal; + Multiplex; +} + +class Main +{ + static private var tests : WhatTests = Normal; + static private var server : Bool = false; + + static private inline var CMDLINEHELP : String + = "\nHaxeTests [client|server] [multiplex]\n" + + " client|server ... determines run mode for some tests, default is client\n" + + " multiplex ........ run multiplex test server or client\n"; + + static private function ParseArgs() { + #if sys + + var args = Sys.args(); + if ( args != null) { + for ( arg in args) { + switch(arg.toLowerCase()) { + case "client": + server = false; + case "server" : + server = true; + case "multiplex" : + tests = Multiplex; + default: + throw 'Invalid argument "$arg"\n'+CMDLINEHELP; + } + } + } + + #end + } + + static public function main() + { + try + { + ParseArgs(); + + switch( tests) { + case Normal: + StreamTest.Run(server); + case Multiplex: + MultiplexTest.Run(server); + default: + throw "Unhandled test mode $tests"; + } + + trace("All tests completed."); + } + catch( e: Dynamic) + { + trace('$e'); + #if sys + Sys.exit(1); // indicate error + #end + } + } +} \ No newline at end of file diff --git a/src/jaegertracing/thrift/lib/haxe/test/src/MultiplexTest.hx b/src/jaegertracing/thrift/lib/haxe/test/src/MultiplexTest.hx new file mode 100644 index 000000000..3818b6609 --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/src/MultiplexTest.hx @@ -0,0 +1,224 @@ +/* + * 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. + */ + +package; + +import haxe.Int64; +import haxe.Int32; + +import org.apache.thrift.*; +import org.apache.thrift.protocol.*; +import org.apache.thrift.transport.*; +import org.apache.thrift.server.*; +import org.apache.thrift.meta_data.*; + +// debug only +import org.apache.thrift.protocol.TProtocolDecorator; +import org.apache.thrift.protocol.TMultiplexedProtocol; +import org.apache.thrift.protocol.TMultiplexedProcessor; + +// generated code imports +import Aggr; +import AggrImpl; +import AggrProcessor; +import BenchmarkService; +import BenchmarkServiceImpl; +import BenchmarkServiceProcessor; +import Error; + + +class BenchmarkServiceHandler implements BenchmarkService +{ + public function new() { + } + + public function fibonacci(n : haxe.Int32) : haxe.Int32 { + trace('Benchmark.fibonacci($n)'); + var next : Int; + var prev = 0; + var result = 1; + while( n > 0) + { + next = result + prev; + prev = result; + result = next; + --n; + } + return result; + } +} + + +class AggrServiceHandler implements Aggr +{ + private var values : List = new List(); + + public function new() { + } + + public function addValue(value : haxe.Int32) : Void { + trace('Aggr.addValue($value)'); + values.add( value); + } + + public function getValues() : List< haxe.Int32> { + trace('Aggr.getValues()'); + return values; + } +} + + + +class MultiplexTest extends TestBase { + + private inline static var NAME_BENCHMARKSERVICE : String = "BenchmarkService"; + private inline static var NAME_AGGR : String = "Aggr"; + + + public static override function Run(server : Bool) : Void { + if ( server) { + RunMultiplexServer(); + } else { + RunMultiplexClient(); + RunDefaultClient(); + } + } + + + // run the multiplex server + public static override function RunMultiplexServer() : Void { + try + { + var benchHandler : BenchmarkService = new BenchmarkServiceHandler(); + var benchProcessor : TProcessor = new BenchmarkServiceProcessor( benchHandler); + + var aggrHandler : Aggr = new AggrServiceHandler(); + var aggrProcessor : TProcessor = new AggrProcessor( aggrHandler); + + var multiplex : TMultiplexedProcessor = new TMultiplexedProcessor(); + multiplex.RegisterProcessor( NAME_BENCHMARKSERVICE, benchProcessor, true); // default + multiplex.RegisterProcessor( NAME_AGGR, aggrProcessor); + + // protocol+transport stack + var protfact : TProtocolFactory = new TBinaryProtocolFactory(true,true); + var servertrans : TServerTransport = new TServerSocket( 9090, 5, false); + var transfact : TTransportFactory = new TFramedTransportFactory(); + + var server : TServer = new TSimpleServer( multiplex, servertrans, transfact, protfact); + + trace("Starting the server ..."); + server.Serve(); + } + catch( e : TApplicationException) + { + TestBase.Expect(false,'${e.errorID} ${e.errorMsg}'); + } + catch( e : TException) + { + TestBase.Expect(false,'$e'); + } + } + + + // run multiplex client against multiplex server + public static override function RunMultiplexClient() : Void { + try + { + var trans : TTransport; + trans = new TSocket("localhost", 9090); + trans = new TFramedTransport(trans); + trans.open(); + + var protocol : TProtocol = new TBinaryProtocol(trans,true,true); + var multiplex : TMultiplexedProtocol; + + multiplex = new TMultiplexedProtocol( protocol, NAME_BENCHMARKSERVICE); + var bench = new BenchmarkServiceImpl( multiplex); + + multiplex = new TMultiplexedProtocol( protocol, NAME_AGGR); + var aggr = new AggrImpl( multiplex); + + trace('calling aggr.add( bench.fibo())...'); + for( i in 1 ... 10) + { + trace('$i'); + aggr.addValue( bench.fibonacci(i)); + } + + trace('calling aggr ...'); + var i = 1; + var values = aggr.getValues(); + TestBase.Expect(values != null,'aggr.getValues() == null'); + for( k in values) + { + trace('fib($i) = $k'); + ++i; + } + + trans.close(); + trace('done.'); + + } + catch( e : TApplicationException) + { + TestBase.Expect(false,'${e.errorID} ${e.errorMsg}'); + } + catch( e : TException) + { + TestBase.Expect(false,'$e'); + } + } + + + // run non-multiplex client against multiplex server to test default fallback + public static override function RunDefaultClient() : Void { + try + { + var trans : TTransport; + trans = new TSocket("localhost", 9090); + trans = new TFramedTransport(trans); + trans.open(); + + var protocol : TProtocol = new TBinaryProtocol(trans,true,true); + + var bench = new BenchmarkServiceImpl( protocol); + + trace('calling bench (via default) ...'); + for( i in 1 ... 10) + { + var k = bench.fibonacci(i); + trace('fib($i) = $k'); + } + + trans.close(); + trace('done.'); + } + catch( e : TApplicationException) + { + TestBase.Expect(false,'${e.errorID} ${e.errorMsg}'); + } + catch( e : TException) + { + TestBase.Expect(false,'$e'); + } + } + +} + + diff --git a/src/jaegertracing/thrift/lib/haxe/test/src/StreamTest.hx b/src/jaegertracing/thrift/lib/haxe/test/src/StreamTest.hx new file mode 100644 index 000000000..244f1ea9d --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/src/StreamTest.hx @@ -0,0 +1,95 @@ +/* + * 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. + */ + +package; + +import haxe.Int64; +import sys.FileSystem; + +import org.apache.thrift.*; +import org.apache.thrift.protocol.*; +import org.apache.thrift.transport.*; +import org.apache.thrift.server.*; +import org.apache.thrift.meta_data.*; + +import thrift.test.*; // generated code + + +class StreamTest extends TestBase { + + + private inline static var tmpfile : String = "data.tmp"; + + + private static function MakeTestData() : Xtruct { + var data : Xtruct = new Xtruct(); + data.string_thing = "Streamtest"; + data.byte_thing = -128; + data.i32_thing = 4711; + data.i64_thing = Int64.make(0x12345678,0x9ABCDEF0); + return data; + } + + public static function WriteData() : Xtruct + { + var stream : TStream = new TFileStream( tmpfile, CreateNew); + var trans : TTransport = new TStreamTransport( null, stream); + var prot = new TJSONProtocol( trans); + + var data = MakeTestData(); + data.write(prot); + trans.close(); + + return data; + } + + public static function ReadData() : Xtruct + { + var stream : TStream = new TFileStream( tmpfile, Read); + var trans : TTransport = new TStreamTransport( stream, null); + var prot = new TJSONProtocol( trans); + + var data : Xtruct = new Xtruct(); + data.read(prot); + trans.close(); + + return data; + } + + public static override function Run(server : Bool) : Void + { + try { + var written = WriteData(); + var read = ReadData(); + FileSystem.deleteFile(tmpfile); + + TestBase.Expect( read.string_thing == written.string_thing, "string data"); + TestBase.Expect( read.byte_thing == written.byte_thing, "byte data"); + TestBase.Expect( read.i32_thing == written.i32_thing, "i32 data"); + TestBase.Expect( Int64.compare( read.i64_thing, written.i64_thing) == 0, "i64 data"); + + } catch(e:Dynamic) { + FileSystem.deleteFile(tmpfile); + throw e; + } + } + +} + + diff --git a/src/jaegertracing/thrift/lib/haxe/test/src/TestBase.hx b/src/jaegertracing/thrift/lib/haxe/test/src/TestBase.hx new file mode 100644 index 000000000..12327737a --- /dev/null +++ b/src/jaegertracing/thrift/lib/haxe/test/src/TestBase.hx @@ -0,0 +1,46 @@ +/* + * 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. + */ + +package; + +import org.apache.thrift.*; +import org.apache.thrift.protocol.*; +import org.apache.thrift.transport.*; +import org.apache.thrift.server.*; +import org.apache.thrift.meta_data.*; + + +class TestBase { + + private function new() { + // override, if necessary + } + + public static function Run(server : Bool) : Void { + throw new AbstractMethodError(); + } + + public static function Expect( expr : Bool, info : String, ?pos : haxe.PosInfos) : Void { + if( ! expr) { + throw ('Test "$info" failed at '+pos.methodName+' in '+pos.fileName+':'+pos.lineNumber); + } + } + +} + \ No newline at end of file -- cgit v1.2.3