Replace ThriftTest.thrift with v0.16/ThriftTest.thrift to allow for merging the partially completed uuid implementation to master

This commit is contained in:
Jens Geyer 2022-06-13 23:37:25 +02:00
parent 3f4fa2947d
commit f066d84ffb
49 changed files with 1005 additions and 98 deletions

4
.gitignore vendored
View File

@ -285,7 +285,7 @@ project.lock.json
/lib/go/src
/lib/go/test/fuzz/gopathfuzz
/lib/go/test/gopath/
/lib/go/test/ThriftTest.thrift
/lib/go/test/ThriftTest*.thrift
/lib/nodets/test-compiled/
/lib/ocaml/_build/
/lib/ocaml/_tags
@ -355,7 +355,7 @@ project.lock.json
/test/erl/_build/
/test/erl/rebar.lock
/test/go/bin/
/test/go/ThriftTest.thrift
/test/go/ThriftTest*.thrift
/test/go/gopath
/test/go/pkg/
/test/go/src/code.google.com/

1
debian/copyright vendored
View File

@ -80,6 +80,7 @@ under the Apache 2.0 License:
lib/cpp/test/OptionalRequiredTest.cpp
test/OptionalRequiredTest.thrift
test/ThriftTest.thrift
test/v0.16/ThriftTest.thrift
--------------------------------------------------
For the aclocal/ax_boost_base.m4 and contrib/fb303/aclocal/ax_boost_base.m4 components:

View File

@ -197,7 +197,7 @@ add_custom_command(OUTPUT
gen-c_glib/t_test_service_for_exception_with_a_map.h
gen-c_glib/t_test_srv.c
gen-c_glib/t_test_srv.h
COMMAND ${THRIFT_COMPILER} --gen c_glib ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
COMMAND ${THRIFT_COMPILER} --gen c_glib ${PROJECT_SOURCE_DIR}/test/v0.16/DebugProtoTest.thrift
)
add_custom_command(OUTPUT
@ -221,7 +221,7 @@ add_custom_command(OUTPUT
gen-c_glib/t_test_second_service.h
gen-c_glib/t_test_thrift_test.h
gen-c_glib/t_test_thrift_test_types.h
COMMAND ${THRIFT_COMPILER} --gen c_glib ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
COMMAND ${THRIFT_COMPILER} --gen c_glib ${PROJECT_SOURCE_DIR}/test/v0.16/ThriftTest.thrift
)
add_custom_command(OUTPUT
@ -231,7 +231,7 @@ add_custom_command(OUTPUT
gen-cpp/ThriftTest.h
gen-cpp/ThriftTest_constants.h
gen-cpp/ThriftTest_types.h
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/v0.16/ThriftTest.thrift
)
# TODO: Add memory checks using ctest_memcheck or similar

View File

@ -323,7 +323,7 @@ libtestgencpp_la_CPPFLAGS = -I../../cpp/src $(BOOST_CPPFLAGS) -I./gen-cpp
gen-c_glib/t_test_container_test_types.c gen-c_glib/t_test_container_test_types.h gen-c_glib/t_test_container_service.c gen-c_glib/t_test_container_service.h: ContainerTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib $<
gen-c_glib/t_test_debug_proto_test_types.c gen-c_glib/t_test_debug_proto_test_types.h gen-c_glib/t_test_empty_service.c gen-c_glib/t_test_empty_service.h gen-c_glib/t_test_inherited.c gen-c_glib/t_test_inherited.h gen-c_glib/t_test_reverse_order_service.c gen-c_glib/t_test_reverse_order_service.h gen-c_glib/t_test_service_for_exception_with_a_map.c gen-c_glib/t_test_service_for_exception_with_a_map.h gen-c_glib/t_test_srv.c gen-c_glib/t_test_srv.h: ../../../test/DebugProtoTest.thrift $(THRIFT)
gen-c_glib/t_test_debug_proto_test_types.c gen-c_glib/t_test_debug_proto_test_types.h gen-c_glib/t_test_empty_service.c gen-c_glib/t_test_empty_service.h gen-c_glib/t_test_inherited.c gen-c_glib/t_test_inherited.h gen-c_glib/t_test_reverse_order_service.c gen-c_glib/t_test_reverse_order_service.h gen-c_glib/t_test_service_for_exception_with_a_map.c gen-c_glib/t_test_service_for_exception_with_a_map.h gen-c_glib/t_test_srv.c gen-c_glib/t_test_srv.h: ../../../test/v0.16/DebugProtoTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib $<
gen-c_glib/t_test_enum_test_types.c gen-c_glib/t_test_enum_test_types.h gen-c_glib/t_test_enum_test_service.c gen-c_glib/t_test_enum_test_service.h : ../../../test/EnumTest.thrift $(THRIFT)
@ -332,10 +332,10 @@ gen-c_glib/t_test_enum_test_types.c gen-c_glib/t_test_enum_test_types.h gen-c_gl
gen-c_glib/t_test_optional_required_test_types.c gen-c_glib/t_test_optional_required_test_types.h: ../../../test/OptionalRequiredTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib $<
gen-c_glib/t_test_second_service.c gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.h: ../../../test/ThriftTest.thrift $(THRIFT)
gen-c_glib/t_test_second_service.c gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.h: ../../../test/v0.16/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib $<
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest_types.cpp: ../../../test/ThriftTest.thrift $(THRIFT)
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest_types.cpp: ../../../test/v0.16/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen cpp $<
TESTS = \

View File

@ -360,7 +360,7 @@ add_custom_command(OUTPUT gen-cpp/AnnotationTest_constants.cpp
)
add_custom_command(OUTPUT gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/DebugProtoTest.thrift
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/v0.16/DebugProtoTest.thrift
)
add_custom_command(OUTPUT gen-cpp/EnumTest_types.cpp gen-cpp/EnumTest_types.h
@ -384,7 +384,7 @@ add_custom_command(OUTPUT gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp
)
add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
COMMAND ${THRIFT_COMPILER} --gen cpp ${PROJECT_SOURCE_DIR}/test/v0.16/ThriftTest.thrift
)
add_custom_command(OUTPUT gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h

View File

@ -386,7 +386,7 @@ OpenSSLManualInitTest_LDADD = \
gen-cpp/AnnotationTest_constants.cpp gen-cpp/AnnotationTest_constants.h gen-cpp/AnnotationTest_types.cpp gen-cpp/AnnotationTest_types.h: $(top_srcdir)/test/AnnotationTest.thrift
$(THRIFT) --gen cpp $<
gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h: $(top_srcdir)/test/DebugProtoTest.thrift
gen-cpp/DebugProtoTest_types.cpp gen-cpp/DebugProtoTest_types.h gen-cpp/EmptyService.cpp gen-cpp/EmptyService.h: $(top_srcdir)/test/v0.16/DebugProtoTest.thrift
$(THRIFT) --gen cpp $<
gen-cpp/DoubleConstantsTest_constants.cpp gen-cpp/DoubleConstantsTest_constants.h: $(top_srcdir)/test/DoubleConstantsTest.thrift
@ -408,7 +408,7 @@ gen-cpp/Recursive_types.cpp gen-cpp/Recursive_types.h: $(top_srcdir)/test/Recurs
gen-cpp/Service.cpp gen-cpp/StressTest_types.cpp: $(top_srcdir)/test/StressTest.thrift
$(THRIFT) --gen cpp $<
gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h: $(top_srcdir)/test/ThriftTest.thrift
gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h: $(top_srcdir)/test/v0.16/ThriftTest.thrift
$(THRIFT) --gen cpp $<
gen-cpp/OneWayService.cpp gen-cpp/OneWayTest_types.h gen-cpp/OneWayService.h: OneWayTest.thrift

View File

@ -23,7 +23,7 @@ AUTOMAKE_OPTIONS = serial-tests
debug_proto_gen = $(addprefix gen-d/, DebugProtoTest_types.d)
$(debug_proto_gen): $(top_srcdir)/test/DebugProtoTest.thrift
$(debug_proto_gen): $(top_srcdir)/test/v0.16/DebugProtoTest.thrift
$(THRIFT) --gen d -nowarn $<
stress_test_gen = $(addprefix gen-d/thrift/test/stress/, Service.d \
@ -35,7 +35,7 @@ $(stress_test_gen): $(top_srcdir)/test/StressTest.thrift
thrift_test_gen = $(addprefix gen-d/thrift/test/, SecondService.d \
ThriftTest.d ThriftTest_constants.d ThriftTest_types.d)
$(thrift_test_gen): $(top_srcdir)/test/ThriftTest.thrift
$(thrift_test_gen): $(top_srcdir)/test/v0.16/ThriftTest.thrift
$(THRIFT) --gen d $<

View File

@ -21,10 +21,10 @@ THRIFT = ../../compiler/cpp/thrift
THRIFT_OMIT_FILE = test/Thrift_omit_without.thrift
THRIFT_FILES = $(wildcard test/*.thrift) \
$(THRIFT_OMIT_FILE) \
../../test/ConstantsDemo.thrift \
../../test/v0.16/ConstantsDemo.thrift \
../../test/NameConflictTest.thrift \
../../test/DoubleConstantsTest.thrift \
../../test/ThriftTest.thrift
../../test/v0.16/ThriftTest.thrift
ERL_FLAG = erl
ERL_FLAG_LEGACY = erl:legacynames

View File

@ -26,7 +26,7 @@ endif
THRIFT_GO_ARGS_BASE = thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/lib/go/test/gopath/src/
THRIFTARGS = -out gopath/src/ --gen go:$(THRIFT_GO_ARGS_BASE)$(COMPILER_EXTRAFLAG)
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
THRIFTTEST = $(top_srcdir)/test/v0.16/ThriftTest.thrift
THRIFTARGS_SKIP_REMOTE = -out gopath/src/ --gen go:skip_remote,$(THRIFT_GO_ARGS_BASE)$(COMPILER_EXTRAFLAG)

View File

@ -49,16 +49,16 @@ module.exports = function(grunt) {
},
ThriftGen: {
command: [
'"../../compiler/cpp/thrift" -gen js --out test/gen-js ../../test/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js --out test/gen-js ../../test/v0.16/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js --out test/gen-js ../../test/JsDeepConstructorTest.thrift',
'"../../compiler/cpp/thrift" -gen js:jquery --out test/gen-js-jquery ../../test/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:node --out test/gen-nodejs ../../test/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:es6 --out test/gen-js-es6 ../../test/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:node,es6 --out ./test/gen-nodejs-es6 ../../test/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:jquery --out test/gen-js-jquery ../../test/v0.16/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:node --out test/gen-nodejs ../../test/v0.16/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:es6 --out test/gen-js-es6 ../../test/v0.16/ThriftTest.thrift',
'"../../compiler/cpp/thrift" -gen js:node,es6 --out ./test/gen-nodejs-es6 ../../test/v0.16/ThriftTest.thrift',
].join(' && ')
},
ThriftGenJQ: {
command: '../../compiler/cpp/thrift -gen js:jquery -gen js:node -o test ../../test/ThriftTest.thrift'
command: '../../compiler/cpp/thrift -gen js:jquery -gen js:node -o test ../../test/v0.16/ThriftTest.thrift'
},
ThriftGenDeepConstructor: {
command: '../../compiler/cpp/thrift -gen js -o test ../../test/JsDeepConstructorTest.thrift'

View File

@ -162,10 +162,10 @@
<target name="generate">
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen java ${thrift.dir}/test/ThriftTest.thrift" />
<arg line="--gen java ${thrift.dir}/test/v0.16/ThriftTest.thrift" />
</exec>
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen js:jquery ${thrift.dir}/test/ThriftTest.thrift" />
<arg line="--gen js:jquery ${thrift.dir}/test/v0.16/ThriftTest.thrift" />
</exec>
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen js:jquery ${thrift.dir}/test/DoubleConstantsTest.thrift" />

View File

@ -22,7 +22,8 @@
"map",
"union",
"struct",
"binary"
"binary",
"uuid"
]
},
"base-type": {
@ -30,7 +31,7 @@
"type": "object",
"properties": {
"typeId": {
"enum": ["void", "string", "bool", "byte", "i8", "i16", "i32", "i64", "double", "binary" ]
"enum": ["void", "string", "bool", "byte", "i8", "i16", "i32", "i64", "double", "binary", "uuid" ]
}
},
"required": [ "typeId" ]

View File

@ -70,7 +70,7 @@
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen json"/>
<arg line="-out ${gen.json.dir}"/>
<arg line="${thrift.test.dir}/ThriftTest.thrift"/>
<arg line="${thrift.test.dir}/v0.16/ThriftTest.thrift"/>
</exec>
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen json:merge"/>

View File

@ -17,8 +17,8 @@
# We call npm twice to work around npm issues
stubs: $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/ThriftTest.thrift
stubs: $(top_srcdir)/test/v0.16/ThriftTest.thrift
$(THRIFT) --gen js:node -o test/ $(top_srcdir)/test/v0.16/ThriftTest.thrift
deps: $(top_srcdir)/package.json
$(NPM) install $(top_srcdir)/ || $(NPM) install $(top_srcdir)/

View File

@ -87,11 +87,11 @@ TESTOK=0
# generating Thrift code
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/ThriftTest.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/v0.16/ThriftTest.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/JsDeepConstructorTest.thrift
${THRIFT_COMPILER} -o ${DIR} --gen js:node ${THRIFT_FILES_DIR}/Int64Test.thrift
mkdir ${DIR}/gen-nodejs-es6
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/ThriftTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/v0.16/ThriftTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/JsDeepConstructorTest.thrift
${THRIFT_COMPILER} -out ${DIR}/gen-nodejs-es6 --gen js:node,es6 ${THRIFT_FILES_DIR}/Int64Test.thrift

View File

@ -17,9 +17,9 @@
# We call npm twice to work around npm issues
stubs: $(top_srcdir)/test/ThriftTest.thrift
stubs: $(top_srcdir)/test/v0.16/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
$(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/v0.16/ThriftTest.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/v0.16/ThriftTest.thrift
$(THRIFT) --gen js:node,ts -o test/ $(top_srcdir)/test/Int64Test.thrift && $(THRIFT) --gen js:node,ts -o test-compiled $(top_srcdir)/test/Int64Test.thrift
ts-compile: stubs

View File

@ -10,8 +10,8 @@ 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
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
}
compile

View File

@ -10,8 +10,8 @@ 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
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
}
compile

View File

@ -10,9 +10,9 @@ 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 ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
tsc --outDir $COMPILEDDIR --project $DIR/tsconfig.json

View File

@ -68,7 +68,7 @@ EXTRA_DIST = \
README.md
THRIFT = @top_builddir@/compiler/cpp/thrift
THRIFT_IF = @top_srcdir@/test/ThriftTest.thrift
THRIFT_IF = @top_srcdir@/test/v0.16/ThriftTest.thrift
NAME_BENCHMARKSERVICE = @top_srcdir@/lib/rb/benchmark/Benchmark.thrift
NAME_AGGR = @top_srcdir@/contrib/async-test/aggr.thrift

View File

@ -19,9 +19,9 @@
PHPUNIT=php $(top_srcdir)/vendor/bin/phpunit
stubs: ../../../test/ThriftTest.thrift TestValidators.thrift
stubs: ../../../test/v0.16/ThriftTest.thrift TestValidators.thrift
mkdir -p ./packages/php
$(THRIFT) --gen php -r --out ./packages/php ../../../test/ThriftTest.thrift
$(THRIFT) --gen php -r --out ./packages/php ../../../test/v0.16/ThriftTest.thrift
mkdir -p ./packages/phpv
mkdir -p ./packages/phpvo
mkdir -p ./packages/phpjs

View File

@ -19,7 +19,7 @@
namespace php TestValidators
include "../../../test/ThriftTest.thrift"
include "../../../test/v0.16/ThriftTest.thrift"
union UnionOfStrings {
1: string aa;

View File

@ -65,7 +65,7 @@ namespace :'gen-rb' do
task :'debug_proto' do
sh "mkdir", "-p", "test/debug_proto"
sh THRIFT, '--gen', 'rb', "-o", "test/debug_proto", "../../test/DebugProtoTest.thrift"
sh THRIFT, '--gen', 'rb', "-o", "test/debug_proto", "../../test/v0.16/DebugProtoTest.thrift"
end
end

View File

@ -32,9 +32,9 @@ module.exports = function(grunt) {
ThriftGen: {
command: [
'mkdir -p test/gen-js',
'../../compiler/cpp/thrift -gen js:ts --out test/gen-js ../../test/ThriftTest.thrift',
'../../compiler/cpp/thrift -gen js:ts --out test/gen-js ../../test/v0.16/ThriftTest.thrift',
'mkdir -p test/gen-nodejs',
'../../compiler/cpp/thrift -gen js:node,ts --out test/gen-nodejs ../../test/ThriftTest.thrift',
'../../compiler/cpp/thrift -gen js:node,ts --out test/gen-nodejs ../../test/v0.16/ThriftTest.thrift',
].join(' && ')
},
ThriftBrowserifyNodeInt64: {

View File

@ -167,10 +167,10 @@
<target name="generate">
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen java ${thrift.dir}/test/ThriftTest.thrift" />
<arg line="--gen java ${thrift.dir}/test/v0.16/ThriftTest.thrift" />
</exec>
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen js:jquery ${thrift.dir}/test/ThriftTest.thrift" />
<arg line="--gen js:jquery ${thrift.dir}/test/v0.16/ThriftTest.thrift" />
</exec>
<exec executable="${thrift.compiler}" failonerror="true">
<arg line="--gen js:jquery ${thrift.dir}/test/DoubleConstantsTest.thrift" />

View File

@ -17,7 +17,7 @@
* under the License.
*/
include "ThriftTest.thrift"
include "v0.16/ThriftTest.thrift"
struct IncludeTest {
1: required ThriftTest.Bools bools

View File

@ -139,6 +139,7 @@ EXTRA_DIST = \
BrokenConstants.thrift \
ConstantsDemo.thrift \
DebugProtoTest.thrift \
v0.16/DebugProtoTest.thrift \
DenseLinkingTest.thrift \
DocTest.thrift \
DoubleConstantsTest.thrift \
@ -158,6 +159,7 @@ EXTRA_DIST = \
SmallTest.thrift \
StressTest.thrift \
ThriftTest.thrift \
v0.16/ThriftTest.thrift \
TypedefTest.thrift \
Types.thrift \
UnsafeTypes.thrift \

View File

@ -21,7 +21,7 @@
namespace java thrift.test
include "ThriftTest.thrift"
include "v0.16/ThriftTest.thrift"
struct Reuse {
1: i32 val1;

View File

@ -56,5 +56,5 @@ target_link_libraries(test_client crosstestgencglib "${OPENSSL_LIBRARIES}")
#
add_custom_command(OUTPUT gen-c_glib/t_test_second_service.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_thrift_test_types.h
COMMAND ${THRIFT_COMPILER} --gen c_glib -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
COMMAND ${THRIFT_COMPILER} --gen c_glib -r ${PROJECT_SOURCE_DIR}/test/v0.16/ThriftTest.thrift
)

View File

@ -56,7 +56,7 @@ test_server_LDADD = \
#
# Common thrift code generation rules
#
gen-c_glib/t_test_second_service.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_thrift_test_types.h: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
gen-c_glib/t_test_second_service.c gen-c_glib/t_test_second_service.h gen-c_glib/t_test_thrift_test.c gen-c_glib/t_test_thrift_test.h gen-c_glib/t_test_thrift_test_types.c gen-c_glib/t_test_thrift_test_types.h: $(top_srcdir)/test/v0.16/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen c_glib -r $<
AM_CFLAGS = -g -Wall -Wextra $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)

View File

@ -100,7 +100,7 @@ add_test(NAME SpecificNameTest COMMAND SpecificNameTest)
#
add_custom_command(OUTPUT gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest.h gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp
COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/ThriftTest.thrift
COMMAND ${THRIFT_COMPILER} --gen cpp:templates,cob_style -r ${PROJECT_SOURCE_DIR}/test/v0.16/ThriftTest.thrift
)
add_custom_command(OUTPUT gen-cpp/Service.cpp

View File

@ -97,7 +97,7 @@ StressTestNonBlocking_LDADD = \
#
# Common thrift code generation rules
#
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/ThriftTest.thrift $(THRIFT)
gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/SecondService.cpp gen-cpp/SecondService.h gen-cpp/SecondService.tcc: $(top_srcdir)/test/v0.16/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen cpp:templates,cob_style -r $<
gen-cpp/Service.cpp: $(top_srcdir)/test/StressTest.thrift $(THRIFT)

View File

@ -21,7 +21,7 @@ import copy
def domain_socket_path(port):
return '/tmp/ThriftTest.thrift.%d' % port
return '/tmp/v0.16/ThriftTest.thrift.%d' % port
def merge_dict(base, update):

View File

@ -17,8 +17,8 @@
# under the License.
#
gen-dart/thrift_test/lib/thrift_test.dart: ../ThriftTest.thrift
$(THRIFT) --gen dart ../ThriftTest.thrift
gen-dart/thrift_test/lib/thrift_test.dart: ../v0.16/ThriftTest.thrift
$(THRIFT) --gen dart ../v0.16/ThriftTest.thrift
pub-get-gen: gen-dart/thrift_test/lib/thrift_test.dart
cd gen-dart/thrift_test; ${DARTPUB} get

View File

@ -25,7 +25,7 @@ ERL_FLAG = erl
for f in $(THRIFT_FILES) ; do \
$(THRIFT) --gen $(ERL_FLAG) -o src $$f ; \
done ; \
$(THRIFT) --gen $(ERL_FLAG) -o src ../ThriftTest.thrift
$(THRIFT) --gen $(ERL_FLAG) -o src ../v0.16/ThriftTest.thrift
touch .generated
precross: .generated

View File

@ -26,7 +26,7 @@ GOINSTALLEXTRA =
endif
THRIFTCMD = $(THRIFT) -out src/gen --gen go:thrift_import=github.com/apache/thrift/lib/go/thrift,package_prefix=github.com/apache/thrift/test/go/src/gen/$(COMPILER_EXTRAFLAG)
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
THRIFTTEST = $(top_srcdir)/test/v0.16/ThriftTest.thrift
precross: bin/testclient bin/testserver

View File

@ -20,7 +20,7 @@
THRIFT = $(top_builddir)/compiler/cpp/thrift
# Remove "MapType =" line to ignore some map bug for now
stubs: ../ThriftTest.thrift $(THRIFT)
stubs: ../v0.16/ThriftTest.thrift $(THRIFT)
$(THRIFT) --gen lua $<
$(SED) -i.bak 's/MapType =//g' gen-lua/ThriftTest_ttypes.lua
$(RM) gen-lua/ThriftTest_ttypes.lua.bak

View File

@ -17,8 +17,8 @@
# under the License.
#
stubs: ../ThriftTest.thrift
$(THRIFT) --gen perl ../ThriftTest.thrift
stubs: ../v0.16/ThriftTest.thrift
$(THRIFT) --gen perl ../v0.16/ThriftTest.thrift
precross: stubs

View File

@ -17,11 +17,11 @@
# under the License.
#
stubs: ../ThriftTest.thrift
$(THRIFT) --gen php ../ThriftTest.thrift
$(THRIFT) --gen php:inlined ../ThriftTest.thrift
stubs: ../v0.16/ThriftTest.thrift
$(THRIFT) --gen php ../v0.16/ThriftTest.thrift
$(THRIFT) --gen php:inlined ../v0.16/ThriftTest.thrift
$(MKDIR_P) gen-php-classmap
$(THRIFT) -out gen-php-classmap --gen php:classmap ../ThriftTest.thrift
$(THRIFT) -out gen-php-classmap --gen php:classmap ../v0.16/ThriftTest.thrift
php_ext_dir:
mkdir -p php_ext_dir

View File

@ -19,8 +19,8 @@
THRIFT = $(top_srcdir)/compiler/cpp/thrift
thrift_gen: ../ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen py:tornado ../ThriftTest.thrift
thrift_gen: ../v0.16/ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen py:tornado ../v0.16/ThriftTest.thrift
$(THRIFT) --gen py:tornado ../SmallTest.thrift
check: thrift_gen

View File

@ -19,8 +19,8 @@
TRIAL ?= trial
stubs: ../ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen py:twisted ../ThriftTest.thrift
stubs: ../v0.16/ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen py:twisted ../v0.16/ThriftTest.thrift
$(THRIFT) --gen py:twisted ../SmallTest.thrift
check: stubs

View File

@ -71,35 +71,51 @@ TESTS= $(py_unit_tests)
gen-py/%/__init__.py: ../%.thrift $(THRIFT)
$(THRIFT) --gen py $<
test -f ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py $<
gen-py-default/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-default || $(MKDIR_P) gen-py-default
$(THRIFT) --gen py -out gen-py-default $<
test -f ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py -out gen-py-default ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py -out gen-py-default $<
gen-py-slots/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-slots || $(MKDIR_P) gen-py-slots
$(THRIFT) --gen py:slots -out gen-py-slots $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:slots -out gen-py-slots ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:slots -out gen-py-slots $<
gen-py-oldstyle/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-oldstyle || $(MKDIR_P) gen-py-oldstyle
$(THRIFT) --gen py:old_style -out gen-py-oldstyle $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:old_style -out gen-py-oldstyle ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:old_style -out gen-py-oldstyle $<
gen-py-no_utf8strings/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-no_utf8strings || $(MKDIR_P) gen-py-no_utf8strings
$(THRIFT) --gen py:no_utf8strings -out gen-py-no_utf8strings $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:no_utf8strings -out gen-py-no_utf8strings ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:no_utf8strings -out gen-py-no_utf8strings $<
gen-py-dynamic/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-dynamic || $(MKDIR_P) gen-py-dynamic
$(THRIFT) --gen py:dynamic -out gen-py-dynamic $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:dynamic -out gen-py-dynamic ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:dynamic -out gen-py-dynamic $<
gen-py-dynamicslots/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-dynamicslots || $(MKDIR_P) gen-py-dynamicslots
$(THRIFT) --gen py:dynamic,slots -out gen-py-dynamicslots $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:dynamic,slots -out gen-py-dynamicslots ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:dynamic,slots -out gen-py-dynamicslots $<
gen-py-enum/%/__init__.py: ../%.thrift $(THRIFT)
test -d gen-py-enum || $(MKDIR_P) gen-py-enum
$(THRIFT) --gen py:enum -out gen-py-enum $<
test ../v0.16/$(notdir $<) \
&& $(THRIFT) --gen py:enum -out gen-py-enum ../v0.16/$(notdir $<) \
|| $(THRIFT) --gen py:enum -out gen-py-enum $<
clean-local:
$(RM) -r build

View File

@ -7,21 +7,21 @@ macro(GENERATE FILENAME GENERATOR OUTPUTDIR)
endif()
endmacro(GENERATE)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py gen-py-default)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:slots gen-py-slots)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:old_style gen-py-oldstyle)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:no_utf8strings gen-py-no_utf8strings)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:dynamic gen-py-dynamic)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:dynamic,slots gen-py-dynamicslots)
generate(${MY_PROJECT_DIR}/test/ThriftTest.thrift py:enum gen-py-enum)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py gen-py-default)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:slots gen-py-slots)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:old_style gen-py-oldstyle)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:no_utf8strings gen-py-no_utf8strings)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:dynamic gen-py-dynamic)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:dynamic,slots gen-py-dynamicslots)
generate(${MY_PROJECT_DIR}/test/v0.16/ThriftTest.thrift py:enum gen-py-enum)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py gen-py-default)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:slots gen-py-slots)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:old_style gen-py-oldstyle)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:no_utf8strings gen-py-no_utf8strings)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:dynamic gen-py-dynamic)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:dynamic,slots gen-py-dynamicslots)
generate(${MY_PROJECT_DIR}/test/DebugProtoTest.thrift py:enum gen-py-enum)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py gen-py-default)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:slots gen-py-slots)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:old_style gen-py-oldstyle)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:no_utf8strings gen-py-no_utf8strings)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:dynamic gen-py-dynamic)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:dynamic,slots gen-py-dynamicslots)
generate(${MY_PROJECT_DIR}/test/v0.16/DebugProtoTest.thrift py:enum gen-py-enum)
generate(${MY_PROJECT_DIR}/test/DoubleConstantsTest.thrift py gen-py-default)
generate(${MY_PROJECT_DIR}/test/DoubleConstantsTest.thrift py:slots gen-py-slots)

View File

@ -17,8 +17,8 @@
# under the License.
#
stubs: $(THRIFT) ../ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen rb ../ThriftTest.thrift
stubs: $(THRIFT) ../v0.16/ThriftTest.thrift ../SmallTest.thrift
$(THRIFT) --gen rb ../v0.16/ThriftTest.thrift
$(THRIFT) --gen rb ../SmallTest.thrift
$(THRIFT) --gen rb ../Recursive.thrift

View File

@ -17,8 +17,8 @@
# under the License.
#
stubs: ../ThriftTest.thrift
$(THRIFT) -I ./thrifts -out src --gen rs ../ThriftTest.thrift
stubs: ../v0.16/ThriftTest.thrift
$(THRIFT) -I ./thrifts -out src --gen rs ../v0.16/ThriftTest.thrift
precross: stubs
$(CARGO) build

View File

@ -0,0 +1,76 @@
/*
* 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.
*/
namespace cpp yozone
namespace erl consts_
namespace haxe constantsDemo
struct thing {
1: i32 hello,
2: i32 goodbye
}
enum enumconstants {
ONE = 1,
TWO = 2
}
// struct thing2 {
// /** standard docstring */
// 1: enumconstants val = TWO
// }
typedef i32 myIntType
const myIntType myInt = 3
//const map<enumconstants,string> GEN_ENUM_NAMES = {ONE : "HOWDY", TWO: "PARTNER"}
const i32 hex_const = 0x0001F
const i32 negative_hex_constant = -0x0001F
const i32 GEN_ME = -3523553
const double GEn_DUB = 325.532
const double GEn_DU = 085.2355
const string GEN_STRING = "asldkjasfd"
const double e10 = 1e10 // fails with 0.9.3 and earlier
const double e11 = -1e10
const map<i32,i32> GEN_MAP = { 35532 : 233, 43523 : 853 }
const list<i32> GEN_LIST = [ 235235, 23598352, 3253523 ]
const map<i32, map<i32, i32>> GEN_MAPMAP = { 235 : { 532 : 53255, 235:235}}
const map<string,i32> GEN_MAP2 = { "hello" : 233, "lkj98d" : 853, 'lkjsdf' : 098325 }
const thing GEN_THING = { 'hello' : 325, 'goodbye' : 325352 }
const map<i32,thing> GEN_WHAT = { 35 : { 'hello' : 325, 'goodbye' : 325352 } }
const set<i32> GEN_SET = [ 235, 235, 53235 ]
exception Blah {
1: i32 bing }
exception Gak {}
service yowza {
void blingity(),
i32 blangity() throws (1: Blah hoot )
}

View File

@ -0,0 +1,393 @@
/*
* 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.
*/
namespace c_glib TTest
namespace cpp thrift.test.debug
namespace java thrift.test
namespace rb thrift.test
struct Doubles {
1: double nan,
2: double inf,
3: double neginf,
4: double repeating,
5: double big,
6: double tiny,
7: double zero,
8: double negzero,
}
struct OneOfEach {
1: bool im_true,
2: bool im_false,
3: i8 a_bite = 0x7f,
4: i16 integer16 = 0x7fff,
5: i32 integer32,
6: i64 integer64 = 10000000000,
7: double double_precision,
8: string some_characters,
9: string zomg_unicode,
10: bool what_who,
11: binary base64,
12: list<i8> byte_list = [1, 2, 3],
13: list<i16> i16_list = [1,2,3],
14: list<i64> i64_list = [1,2,3]
}
struct Bonk {
1: i32 type,
2: string message,
}
struct Nesting {
1: Bonk my_bonk,
2: OneOfEach my_ooe,
}
struct HolyMoley {
1: list<OneOfEach> big,
2: set<list<string> (python.immutable = "")> contain,
3: map<string,list<Bonk>> bonks,
}
struct Backwards {
2: i32 first_tag2,
1: i32 second_tag1,
}
struct Empty {
} (
python.immutable = "",
)
struct Wrapper {
1: Empty foo
} (
python.immutable = "",
)
struct RandomStuff {
1: i32 a,
2: i32 b,
3: i32 c,
4: i32 d,
5: list<i32> myintlist,
6: map<i32,Wrapper> maps,
7: i64 bigint,
8: double triple,
}
struct Base64 {
1: i32 a,
2: binary b1,
3: binary b2,
4: binary b3,
5: binary b4,
6: binary b5,
7: binary b6,
}
struct CompactProtoTestStruct {
// primitive fields
1: i8 a_byte;
2: i16 a_i16;
3: i32 a_i32;
4: i64 a_i64;
5: double a_double;
6: string a_string;
7: binary a_binary;
8: bool true_field;
9: bool false_field;
10: Empty empty_struct_field;
// primitives in lists
11: list<i8> byte_list;
12: list<i16> i16_list;
13: list<i32> i32_list;
14: list<i64> i64_list;
15: list<double> double_list;
16: list<string> string_list;
17: list<binary> binary_list;
18: list<bool> boolean_list;
19: list<Empty> struct_list;
// primitives in sets
20: set<i8> byte_set;
21: set<i16> i16_set;
22: set<i32> i32_set;
23: set<i64> i64_set;
24: set<double> double_set;
25: set<string> string_set;
26: set<binary> binary_set;
27: set<bool> boolean_set;
28: set<Empty> struct_set;
// maps
// primitives as keys
29: map<i8, i8> byte_byte_map;
30: map<i16, i8> i16_byte_map;
31: map<i32, i8> i32_byte_map;
32: map<i64, i8> i64_byte_map;
33: map<double, i8> double_byte_map;
34: map<string, i8> string_byte_map;
35: map<binary, i8> binary_byte_map;
36: map<bool, i8> boolean_byte_map;
// primitives as values
37: map<i8, i16> byte_i16_map;
38: map<i8, i32> byte_i32_map;
39: map<i8, i64> byte_i64_map;
40: map<i8, double> byte_double_map;
41: map<i8, string> byte_string_map;
42: map<i8, binary> byte_binary_map;
43: map<i8, bool> byte_boolean_map;
// collections as keys
44: map<list<i8> (python.immutable = ""), i8> list_byte_map;
45: map<set<i8> (python.immutable = ""), i8> set_byte_map;
46: map<map<i8,i8> (python.immutable = ""), i8> map_byte_map;
// collections as values
47: map<i8, map<i8,i8>> byte_map_map;
48: map<i8, set<i8>> byte_set_map;
49: map<i8, list<i8>> byte_list_map;
// large field IDs
500 : i64 field500;
5000 : i64 field5000;
20000 : i64 field20000;
}
// To be used to test the serialization of an empty map
struct SingleMapTestStruct {
1: required map<i32, i32> i32_map;
}
const CompactProtoTestStruct COMPACT_TEST = {
'a_byte' : 127,
'a_i16' : 32000,
'a_i32' : 1000000000,
'a_i64' : 0xffffffffff,
'a_double' : 5.6789,
'a_string' : "my string",
//'a_binary,'
'true_field' : 1,
'false_field' : 0,
'empty_struct_field' : {},
'byte_list' : [-127, -1, 0, 1, 127],
'i16_list' : [-1, 0, 1, 0x7fff],
'i32_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff],
'i64_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
'double_list' : [0.1, 0.2, 0.3],
'string_list' : ["first", "second", "third"],
//'binary_list,'
'boolean_list' : [1, 1, 1, 0, 0, 0],
'struct_list' : [{}, {}],
'byte_set' : [-127, -1, 0, 1, 127],
'i16_set' : [-1, 0, 1, 0x7fff],
'i32_set' : [1, 2, 3],
'i64_set' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
'double_set' : [0.1, 0.2, 0.3],
'string_set' : ["first", "second", "third"],
//'binary_set,'
'boolean_set' : [1, 0],
'struct_set' : [{}],
'byte_byte_map' : {1 : 2},
'i16_byte_map' : {1 : 1, -1 : 1, 0x7fff : 1},
'i32_byte_map' : {1 : 1, -1 : 1, 0x7fffffff : 1},
'i64_byte_map' : {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1},
'double_byte_map' : {-1.1 : 1, 1.1 : 1},
'string_byte_map' : {"first" : 1, "second" : 2, "third" : 3, "" : 0},
//'binary_byte_map,'
'boolean_byte_map' : {1 : 1, 0 : 0},
'byte_i16_map' : {1 : 1, 2 : -1, 3 : 0x7fff},
'byte_i32_map' : {1 : 1, 2 : -1, 3 : 0x7fffffff},
'byte_i64_map' : {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff},
'byte_double_map' : {1 : 0.1, 2 : -0.1, 3 : 1000000.1},
'byte_string_map' : {1 : "", 2 : "blah", 3 : "loooooooooooooong string"},
//'byte_binary_map,'
'byte_boolean_map' : {1 : 1, 2 : 0},
'list_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
'set_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
'map_byte_map' : {{1 : 1} : 1, {2 : 2} : 2, {} : 0},
'byte_map_map' : {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}},
'byte_set_map' : {0 : [], 1 : [1], 2 : [1, 2]},
'byte_list_map' : {0 : [], 1 : [1], 2 : [1, 2]},
'field500' : 500,
'field5000' : 5000,
'field20000' : 20000,
}
const i32 MYCONST = 2
exception ExceptionWithAMap {
1: string blah;
2: map<string, string> map_field;
}
exception MutableException {
1: string msg;
} (python.immutable = "false")
exception ExceptionWithoutFields {}
service ServiceForExceptionWithAMap {
void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap);
}
service Srv {
i32 Janky(1: i32 arg);
// return type only methods
void voidMethod();
i32 primitiveMethod();
CompactProtoTestStruct structMethod();
void methodWithDefaultArgs(1: i32 something = MYCONST);
oneway void onewayMethod();
bool declaredExceptionMethod(1: bool shouldThrow) throws (1: ExceptionWithAMap xwamap);
}
service Inherited extends Srv {
i32 identity(1: i32 arg)
}
service EmptyService {}
// The only purpose of this thing is to increase the size of the generated code
// so that ZlibTest has more highly compressible data to play with.
struct BlowUp {
1: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b1;
2: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b2;
3: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b3;
4: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b4;
}
struct ReverseOrderStruct {
4: string first;
3: i16 second;
2: i32 third;
1: i64 fourth;
}
service ReverseOrderService {
void myMethod(4: string first, 3: i16 second, 2: i32 third, 1: i64 fourth);
}
enum SomeEnum {
ONE = 1
TWO = 2
}
/** This is a docstring on a constant! */
const SomeEnum MY_SOME_ENUM = SomeEnum.ONE
const SomeEnum MY_SOME_ENUM_1 = 1
/*const SomeEnum MY_SOME_ENUM_2 = 7*/
const map<SomeEnum,SomeEnum> MY_ENUM_MAP = {
SomeEnum.ONE : SomeEnum.TWO
}
struct StructWithSomeEnum {
1: SomeEnum blah;
}
const map<SomeEnum,StructWithSomeEnum> EXTRA_CRAZY_MAP = {
SomeEnum.ONE : {"blah" : SomeEnum.TWO}
}
union TestUnion {
/**
* A doc string
*/
1: string string_field;
2: i32 i32_field;
3: OneOfEach struct_field;
4: list<RandomStuff> struct_list;
5: i32 other_i32_field;
6: SomeEnum enum_field;
7: set<i32> i32_set;
8: map<i32, i32> i32_map;
}
union TestUnionMinusStringField {
2: i32 i32_field;
3: OneOfEach struct_field;
4: list<RandomStuff> struct_list;
5: i32 other_i32_field;
6: SomeEnum enum_field;
7: set<i32> i32_set;
8: map<i32, i32> i32_map;
}
union ComparableUnion {
1: string string_field;
2: binary binary_field;
}
struct StructWithAUnion {
1: TestUnion test_union;
}
struct PrimitiveThenStruct {
1: i32 blah;
2: i32 blah2;
3: Backwards bw;
}
typedef map<i32,i32> SomeMap
struct StructWithASomemap {
1: required SomeMap somemap_field;
}
struct BigFieldIdStruct {
1: string field1;
45: string field2;
}
struct BreaksRubyCompactProtocol {
1: string field1;
2: BigFieldIdStruct field2;
3: i32 field3;
}
struct TupleProtocolTestStruct {
optional i32 field1;
optional i32 field2;
optional i32 field3;
optional i32 field4;
optional i32 field5;
optional i32 field6;
optional i32 field7;
optional i32 field8;
optional i32 field9;
optional i32 field10;
optional i32 field11;
optional i32 field12;
}
struct ListDoublePerf {
1: list<double> field;
}

View File

@ -0,0 +1,418 @@
/*
* 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.
*
* Contains some contributions under the Thrift Software License.
* Please see doc/old-thrift-license.txt in the Thrift distribution for
* details.
*/
namespace c_glib TTest
namespace cpp thrift.test
namespace delphi Thrift.Test
namespace go thrifttest
namespace java thrift.test
namespace js ThriftTest
namespace lua ThriftTest
namespace netstd ThriftTest
namespace perl ThriftTest
namespace php ThriftTest
namespace py ThriftTest
namespace py.twisted ThriftTest
namespace rb Thrift.Test
namespace st ThriftTest
namespace xsd test (uri = 'http://thrift.apache.org/ns/ThriftTest')
// Presence of namespaces and sub-namespaces for which there is
// no generator should compile with warnings only
namespace noexist ThriftTest
namespace cpp.noexist ThriftTest
namespace * thrift.test
/**
* Docstring!
*/
enum Numberz
{
ONE = 1,
TWO,
THREE,
FIVE = 5,
SIX,
EIGHT = 8
}
const Numberz myNumberz = Numberz.ONE;
// the following is expected to fail:
// const Numberz urNumberz = ONE;
typedef i64 UserId
struct Bonk
{
1: string message,
2: i32 type
}
typedef map<string,Bonk> MapType
struct Bools {
1: bool im_true,
2: bool im_false,
}
struct Xtruct
{
1: string string_thing,
4: i8 byte_thing,
9: i32 i32_thing,
11: i64 i64_thing
}
struct Xtruct2
{
1: i8 byte_thing, // used to be byte, hence the name
2: Xtruct struct_thing,
3: i32 i32_thing
}
struct Xtruct3
{
1: string string_thing,
4: i32 changed,
9: i32 i32_thing,
11: i64 i64_thing
}
struct Insanity
{
1: map<Numberz, UserId> userMap,
2: list<Xtruct> xtructs
} (python.immutable= "")
struct CrazyNesting {
1: string string_field,
2: optional set<Insanity> set_field,
// Do not insert line break as test/go/Makefile.am is removing this line with pattern match
3: required list<map<set<i32> (python.immutable = ""), map<i32,set<list<map<Insanity,string>(python.immutable = "")> (python.immutable = "")>>>> list_field,
4: binary binary_field
}
union SomeUnion {
1: map<Numberz, UserId> map_thing,
2: string string_thing,
3: i32 i32_thing,
4: Xtruct3 xtruct_thing,
5: Insanity insanity_thing
}
exception Xception {
1: i32 errorCode,
2: string message
}
exception Xception2 {
1: i32 errorCode,
2: Xtruct struct_thing
}
struct EmptyStruct {}
struct OneField {
1: EmptyStruct field
}
service ThriftTest
{
/**
* Prints "testVoid()" and returns nothing.
*/
void testVoid(),
/**
* Prints 'testString("%s")' with thing as '%s'
* @param string thing - the string to print
* @return string - returns the string 'thing'
*/
string testString(1: string thing),
/**
* Prints 'testBool("%s")' where '%s' with thing as 'true' or 'false'
* @param bool thing - the bool data to print
* @return bool - returns the bool 'thing'
*/
bool testBool(1: bool thing),
/**
* Prints 'testByte("%d")' with thing as '%d'
* The types i8 and byte are synonyms, use of i8 is encouraged, byte still exists for the sake of compatibility.
* @param byte thing - the i8/byte to print
* @return i8 - returns the i8/byte 'thing'
*/
i8 testByte(1: i8 thing),
/**
* Prints 'testI32("%d")' with thing as '%d'
* @param i32 thing - the i32 to print
* @return i32 - returns the i32 'thing'
*/
i32 testI32(1: i32 thing),
/**
* Prints 'testI64("%d")' with thing as '%d'
* @param i64 thing - the i64 to print
* @return i64 - returns the i64 'thing'
*/
i64 testI64(1: i64 thing),
/**
* Prints 'testDouble("%f")' with thing as '%f'
* @param double thing - the double to print
* @return double - returns the double 'thing'
*/
double testDouble(1: double thing),
/**
* Prints 'testBinary("%s")' where '%s' is a hex-formatted string of thing's data
* @param binary thing - the binary data to print
* @return binary - returns the binary 'thing'
*/
binary testBinary(1: binary thing),
/**
* Prints 'testStruct("{%s}")' where thing has been formatted into a string of comma separated values
* @param Xtruct thing - the Xtruct to print
* @return Xtruct - returns the Xtruct 'thing'
*/
Xtruct testStruct(1: Xtruct thing),
/**
* Prints 'testNest("{%s}")' where thing has been formatted into a string of the nested struct
* @param Xtruct2 thing - the Xtruct2 to print
* @return Xtruct2 - returns the Xtruct2 'thing'
*/
Xtruct2 testNest(1: Xtruct2 thing),
/**
* Prints 'testMap("{%s")' where thing has been formatted into a string of 'key => value' pairs
* separated by commas and new lines
* @param map<i32,i32> thing - the map<i32,i32> to print
* @return map<i32,i32> - returns the map<i32,i32> 'thing'
*/
map<i32,i32> testMap(1: map<i32,i32> thing),
/**
* Prints 'testStringMap("{%s}")' where thing has been formatted into a string of 'key => value' pairs
* separated by commas and new lines
* @param map<string,string> thing - the map<string,string> to print
* @return map<string,string> - returns the map<string,string> 'thing'
*/
map<string,string> testStringMap(1: map<string,string> thing),
/**
* Prints 'testSet("{%s}")' where thing has been formatted into a string of values
* separated by commas and new lines
* @param set<i32> thing - the set<i32> to print
* @return set<i32> - returns the set<i32> 'thing'
*/
set<i32> testSet(1: set<i32> thing),
/**
* Prints 'testList("{%s}")' where thing has been formatted into a string of values
* separated by commas and new lines
* @param list<i32> thing - the list<i32> to print
* @return list<i32> - returns the list<i32> 'thing'
*/
list<i32> testList(1: list<i32> thing),
/**
* Prints 'testEnum("%d")' where thing has been formatted into its numeric value
* @param Numberz thing - the Numberz to print
* @return Numberz - returns the Numberz 'thing'
*/
Numberz testEnum(1: Numberz thing),
/**
* Prints 'testTypedef("%d")' with thing as '%d'
* @param UserId thing - the UserId to print
* @return UserId - returns the UserId 'thing'
*/
UserId testTypedef(1: UserId thing),
/**
* Prints 'testMapMap("%d")' with hello as '%d'
* @param i32 hello - the i32 to print
* @return map<i32,map<i32,i32>> - returns a dictionary with these values:
* {-4 => {-4 => -4, -3 => -3, -2 => -2, -1 => -1, }, 4 => {1 => 1, 2 => 2, 3 => 3, 4 => 4, }, }
*/
map<i32,map<i32,i32>> testMapMap(1: i32 hello),
/**
* So you think you've got this all worked out, eh?
*
* Creates a map with these values and prints it out:
* { 1 => { 2 => argument,
* 3 => argument,
* },
* 2 => { 6 => <empty Insanity struct>, },
* }
* @return map<UserId, map<Numberz,Insanity>> - a map with the above values
*/
map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
/**
* Prints 'testMulti()'
* @param i8 arg0 -
* @param i32 arg1 -
* @param i64 arg2 -
* @param map<i16, string> arg3 -
* @param Numberz arg4 -
* @param UserId arg5 -
* @return Xtruct - returns an Xtruct with string_thing = "Hello2, byte_thing = arg0, i32_thing = arg1
* and i64_thing = arg2
*/
Xtruct testMulti(1: i8 arg0, 2: i32 arg1, 3: i64 arg2, 4: map<i16, string> arg3, 5: Numberz arg4, 6: UserId arg5),
/**
* Print 'testException(%s)' with arg as '%s'
* @param string arg - a string indication what type of exception to throw
* if arg == "Xception" throw Xception with errorCode = 1001 and message = arg
* else if arg == "TException" throw TException
* else do not throw anything
*/
void testException(1: string arg) throws(1: Xception err1),
/**
* Print 'testMultiException(%s, %s)' with arg0 as '%s' and arg1 as '%s'
* @param string arg - a string indicating what type of exception to throw
* if arg0 == "Xception" throw Xception with errorCode = 1001 and message = "This is an Xception"
* else if arg0 == "Xception2" throw Xception2 with errorCode = 2002 and struct_thing.string_thing = "This is an Xception2"
* else do not throw anything
* @return Xtruct - an Xtruct with string_thing = arg1
*/
Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2)
/**
* Print 'testOneway(%d): Sleeping...' with secondsToSleep as '%d'
* sleep 'secondsToSleep'
* Print 'testOneway(%d): done sleeping!' with secondsToSleep as '%d'
* @param i32 secondsToSleep - the number of seconds to sleep
*/
oneway void testOneway(1:i32 secondsToSleep)
}
service SecondService
{
/**
* Prints 'testString("%s")' with thing as '%s'
* @param string thing - the string to print
* @return string - returns the string 'thing'
*/
string secondtestString(1: string thing)
}
struct VersioningTestV1 {
1: i32 begin_in_both,
3: string old_string,
12: i32 end_in_both
}
struct VersioningTestV2 {
1: i32 begin_in_both,
2: i32 newint,
3: i8 newbyte,
4: i16 newshort,
5: i64 newlong,
6: double newdouble
7: Bonk newstruct,
8: list<i32> newlist,
9: set<i32> newset,
10: map<i32, i32> newmap,
11: string newstring,
12: i32 end_in_both
}
struct ListTypeVersioningV1 {
1: list<i32> myints;
2: string hello;
}
struct ListTypeVersioningV2 {
1: list<string> strings;
2: string hello;
}
struct GuessProtocolStruct {
7: map<string,string> map_field,
}
struct LargeDeltas {
1: Bools b1,
10: Bools b10,
100: Bools b100,
500: bool check_true,
1000: Bools b1000,
1500: bool check_false,
2000: VersioningTestV2 vertwo2000,
2500: set<string> a_set2500,
3000: VersioningTestV2 vertwo3000,
4000: list<i32> big_numbers
}
struct NestedListsI32x2 {
1: list<list<i32>> integerlist
}
struct NestedListsI32x3 {
1: list<list<list<i32>>> integerlist
}
struct NestedMixedx2 {
1: list<set<i32>> int_set_list
2: map<i32,set<string>> map_int_strset
3: list<map<i32,set<string>>> map_int_strset_list
}
struct ListBonks {
1: list<Bonk> bonk
}
struct NestedListsBonk {
1: list<list<list<Bonk>>> bonk
}
struct BoolTest {
1: optional bool b = true;
2: optional string s = "true";
}
struct StructA {
1: required string s;
}
struct StructB {
1: optional StructA aa;
2: required StructA ab;
}
struct OptionalSetDefaultTest {
1: optional set<string> with_default = [ "test" ]
}
struct OptionalBinary {
1: optional set<binary> bin_set = {}
2: optional map<binary,i32> bin_map = {}
}

View File

@ -87,7 +87,7 @@ SUBDIRS += php
endif
#
# generate html for ThriftTest.thrift
# generate html for tutorial.thrift
#
all-local:
$(top_builddir)/compiler/cpp/thrift --gen html -r $(top_srcdir)/tutorial/tutorial.thrift