remove unused code from vendor

This commit is contained in:
bergquist
2018-01-19 09:54:22 +01:00
parent e023f79c5a
commit 7ed643f302
6531 changed files with 6 additions and 2907556 deletions
-24
View File
@@ -1,24 +0,0 @@
#
# 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.
#
# Make sure that thrift produce compilable code for binary key
struct testStruct {
1: required map<binary,string> bin_to_string
}
-27
View File
@@ -1,27 +0,0 @@
#
# 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.
#
struct InnerStruct {
1: required string id
}
struct TestStruct {
1: required string id
2: required InnerStruct inner
}
-35
View File
@@ -1,35 +0,0 @@
/*
* 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.
*/
struct TestStruct
{
1: map<string, string> m,
2: list<string> l,
3: set<string> s,
4: i32 i
}
service ErrorTest
{
TestStruct testStruct(1: TestStruct thing)
string testString(1: string s)
}
-24
View File
@@ -1,24 +0,0 @@
#
# 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.
#
struct tagged {
1: string string_thing,
2: i64 int_thing (go.tag = "json:\"int_thing,string\""),
3: optional i64 optional_int_thing
}
@@ -1,26 +0,0 @@
#
# 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.
#
struct IgnoreInitialismsTest {
1: i64 id,
2: i64 my_id,
3: i64 num_cpu,
4: i64 num_gpu,
5: i64 my_ID,
}
-67
View File
@@ -1,67 +0,0 @@
#
# 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.
#
include "ThriftTest.thrift"
include "NamespacedTest.thrift"
const ThriftTest.UserId USERID = 42
const NamespacedTest.UserId USERID1 = 41
const ThriftTest.MapType MAPCONSTANT = {'hello':{}, 'goodnight':{}}
const i32 TWO = NamespacedTest.Stuff.TWO
const i32 THREE = NamespacedTest.THREE
struct testStruct {
1: list<ThriftTest.Numberz> listNumbers
}
struct TestStruct2 {
1: testStruct blah,
2: ThriftTest.UserId id,
3: NamespacedTest.Stuff stuff,
}
service testService extends ThriftTest.SecondService {
ThriftTest.CrazyNesting getCrazyNesting(
1: ThriftTest.StructA a,
2: ThriftTest.Numberz numbers
) throws(1: ThriftTest.Xception err1),
void getSomeValue_DO_NOT_CALL(),
}
service ExtendedService extends testService {
void extendedMethod(),
NamespacedTest.StuffStruct extendedMethod2(),
}
service Extended2Service extends NamespacedTest.NamespacedService {
void extendedMethod3(),
}
typedef map<ThriftTest.UserId, map<NamespacedTest.UserId, list<TestStruct2> > > ComplexMapType
struct ComplexMapStruct {
1: ComplexMapType complex,
}
service ComplexMapService {
ComplexMapStruct transformMap(1: ComplexMapStruct input),
}
-24
View File
@@ -1,24 +0,0 @@
#
# 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.
#
struct InitialismsTest {
1: string user_id,
2: string server_url,
3: string id,
}
-103
View File
@@ -1,103 +0,0 @@
#
# 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.
#
THRIFT = $(top_builddir)/compiler/cpp/thrift
THRIFTARGS = -out gopath/src/ --gen go:thrift_import=thrift
THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
# Thrift for GO has problems with complex map keys: THRIFT-2063
gopath: $(THRIFT) $(THRIFTTEST) \
IncludesTest.thrift \
NamespacedTest.thrift \
MultiplexedProtocolTest.thrift \
OnewayTest.thrift \
OptionalFieldsTest.thrift \
ServicesTest.thrift \
GoTagTest.thrift \
TypedefFieldTest.thrift \
RefAnnotationFieldsTest.thrift \
UnionDefaultValueTest.thrift \
ErrorTest.thrift \
NamesTest.thrift \
InitialismsTest.thrift \
DontExportRWTest.thrift \
dontexportrwtest/compile_test.go \
IgnoreInitialismsTest.thrift
mkdir -p gopath/src
grep -v list.*map.*list.*map $(THRIFTTEST) | grep -v 'set<Insanity>' > ThriftTest.thrift
$(THRIFT) $(THRIFTARGS) -r IncludesTest.thrift
$(THRIFT) $(THRIFTARGS) BinaryKeyTest.thrift
$(THRIFT) $(THRIFTARGS) MultiplexedProtocolTest.thrift
$(THRIFT) $(THRIFTARGS) OnewayTest.thrift
$(THRIFT) $(THRIFTARGS) OptionalFieldsTest.thrift
$(THRIFT) $(THRIFTARGS) ServicesTest.thrift
$(THRIFT) $(THRIFTARGS) GoTagTest.thrift
$(THRIFT) $(THRIFTARGS) TypedefFieldTest.thrift
$(THRIFT) $(THRIFTARGS) RefAnnotationFieldsTest.thrift
$(THRIFT) $(THRIFTARGS) UnionDefaultValueTest.thrift
$(THRIFT) $(THRIFTARGS) ErrorTest.thrift
$(THRIFT) $(THRIFTARGS) NamesTest.thrift
$(THRIFT) $(THRIFTARGS) InitialismsTest.thrift
$(THRIFT) $(THRIFTARGS),read_write_private DontExportRWTest.thrift
$(THRIFT) $(THRIFTARGS),ignore_initialisms IgnoreInitialismsTest.thrift
GOPATH=`pwd`/gopath $(GO) get github.com/golang/mock/gomock
ln -nfs ../../../thrift gopath/src/thrift
ln -nfs ../../tests gopath/src/tests
cp -r ./dontexportrwtest gopath/src
touch gopath
check: gopath
GOPATH=`pwd`/gopath $(GO) build \
includestest \
binarykeytest \
servicestest \
typedeffieldtest \
refannotationfieldstest \
errortest \
namestest \
initialismstest \
dontexportrwtest \
ignoreinitialismstest
GOPATH=`pwd`/gopath $(GO) test thrift tests dontexportrwtest
clean-local:
$(RM) -r gopath ThriftTest.thrift gen-go
client: stubs
$(GO) run TestClient.go
EXTRA_DIST = \
dontexportrwtest \
tests \
BinaryKeyTest.thrift \
GoTagTest.thrift \
IncludesTest.thrift \
MultiplexedProtocolTest.thrift \
NamespacedTest.thrift \
OnewayTest.thrift \
OptionalFieldsTest.thrift \
RefAnnotationFieldsTest.thrift \
UnionDefaultValueTest.thrift \
ServicesTest.thrift \
TypedefFieldTest.thrift \
ErrorTest.thrift \
NamesTest.thrift \
InitialismsTest.thrift \
DontExportRWTest.thrift \
IgnoreInitialismsTest.thrift
@@ -1,27 +0,0 @@
#
# 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.
#
service First {
i64 returnOne();
}
service Second {
i64 returnTwo();
}
-32
View File
@@ -1,32 +0,0 @@
#
# 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.
#
struct NamesTest {
1: required string type
}
service NameCollisionOne
{
void blahBlah()
}
service NameCollisionTwo
{
void blahBlah()
}
-40
View File
@@ -1,40 +0,0 @@
#
# 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.
#
include "ThriftTest.thrift"
namespace go lib.go.test.namespacedtest
enum Stuff {
ONE = 1,
TWO = 2,
}
const i32 THREE = 3;
typedef i64 UserId
struct StuffStruct {
2: Stuff stuff,
}
service NamespacedService {
ThriftTest.UserId getUserID(),
}
-24
View File
@@ -1,24 +0,0 @@
#
# 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.
#
service OneWay {
oneway void hi(1: i64 i, 2: string s)
void emptyfunc()
i64 echo_int(1: i64 param)
}
-50
View File
@@ -1,50 +0,0 @@
#
# 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.
#
struct structA {
1: required i64 sa_i
}
struct all_optional {
1: optional string s = "DEFAULT",
2: optional i64 i = 42,
3: optional bool b = false,
4: optional string s2,
5: optional i64 i2,
6: optional bool b2,
7: optional structA aa,
9: optional list<i64> l,
10: optional list<i64> l2 = [1, 2],
11: optional map<i64, i64> m,
12: optional map<i64, i64> m2 = {1:2, 3:4},
13: optional binary bin,
14: optional binary bin2 = "asdf",
}
struct structB {
1: required structA required_struct_thing
2: optional structA optional_struct_thing
}
struct structC {
1: string s,
2: required i32 i,
3: optional bool b,
4: required string s2,
}
@@ -1,58 +0,0 @@
#
# 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.
#
struct structA {
1: required i64 sa_i
}
struct all_referenced {
1: optional string s = "DEFAULT" (cpp.ref = ""),
2: optional i64 i = 42 (cpp.ref = ""),
3: optional bool b = false (cpp.ref = ""),
4: optional string s2 (cpp.ref = ""),
5: optional i64 i2 (cpp.ref = ""),
6: optional bool b2 (cpp.ref = ""),
7: optional structA aa (cpp.ref = ""),
9: optional list<i64> l (cpp.ref = ""),
10: optional list<i64> l2 = [1, 2] (cpp.ref = ""),
11: optional map<i64, i64> m (cpp.ref = ""),
12: optional map<i64, i64> m2 = {1:2, 3:4} (cpp.ref = ""),
13: optional binary bin (cpp.ref = ""),
14: optional binary bin2 = "asdf" (cpp.ref = ""),
15: required string ref_s = "DEFAULT" (cpp.ref = ""),
16: required i64 ref_i = 42 (cpp.ref = ""),
17: required bool ref_b = false (cpp.ref = ""),
18: required string ref_s2 (cpp.ref = ""),
19: required i64 ref_i2 (cpp.ref = ""),
20: required bool ref_b2 (cpp.ref = ""),
21: required structA ref_aa (cpp.ref = ""),
22: required list<i64> ref_l (cpp.ref = ""),
23: required list<i64> ref_l2 = [1, 2] (cpp.ref = ""),
24: required map<i64, i64> ref_m (cpp.ref = ""),
25: required map<i64, i64> ref_m2 = {1:2, 3:4} (cpp.ref = ""),
26: required binary ref_bin (cpp.ref = ""),
27: required binary ref_bin2 = "asdf" (cpp.ref = ""),
}
struct structB {
1: required structA required_struct_thing
2: optional structA optional_struct_thing
}
-111
View File
@@ -1,111 +0,0 @@
#
# 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 are only testing that generated code compiles, no correctness checking is done
exception moderate_disaster {
1: i32 errorCode,
2: string message
}
exception total_disaster {
1: string message
2: optional bool president_was_woken_up = false
}
struct struct_a {
1: required i64 whatever
}
service a_serv {
void voidfunc(),
void void_with_1ex() throws(1: moderate_disaster err1)
void void_with_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
string stringfunc()
string stringfunc_1ex() throws(1: moderate_disaster err1)
string stringfunc_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
i64 i64func()
i64 i64func_1ex() throws(1: moderate_disaster err1)
i64 i64func_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
list<string> list_of_strings_func()
list<string> list_of_strings_func_1ex() throws(1: moderate_disaster err1)
list<string> list_of_strings_func_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
map<i64,string> map_func()
map<i64,string> map_func_1ex() throws(1: moderate_disaster err1)
map<i64,string> map_func_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
struct_a struct_a_func()
struct_a struct_a_func_1ex() throws(1: moderate_disaster err1)
struct_a struct_a_func_2ex() throws(1: moderate_disaster err1, 2:total_disaster err2)
void voidfunc_1int(1: i64 i),
void void_with_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
void void_with_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
string stringfunc_1int(1: i64 i)
string stringfunc_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
string stringfunc_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
i64 i64func_1int(1: i64 i)
i64 i64func_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
i64 i64func_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
list<string> list_of_strings_func_1int(1: i64 i)
list<string> list_of_strings_func_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
list<string> list_of_strings_func_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
map<i64,string> map_func_1int(1: i64 i)
map<i64,string> map_func_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
map<i64,string> map_func_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
struct_a struct_a_func_1int(1: i64 i)
struct_a struct_a_func_1ex_1int(1: i64 i) throws(1: moderate_disaster err1)
struct_a struct_a_func_2ex_1int(1: i64 i) throws(1: moderate_disaster err1, 2:total_disaster err2)
void voidfunc_1int_1s(1: i64 i, 2: string s),
void void_with_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
void void_with_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
string stringfunc_1int_1s(1: i64 i, 2: string s)
string stringfunc_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
string stringfunc_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
i64 i64func_1int_1s(1: i64 i, 2: string s)
i64 i64func_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
i64 i64func_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
list<string> list_of_strings_func_1int_1s(1: i64 i, 2: string s)
list<string> list_of_strings_func_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
list<string> list_of_strings_func_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
map<i64,string> map_func_1int_1s(1: i64 i, 2: string s)
map<i64,string> map_func_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
map<i64,string> map_func_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
struct_a struct_a_func_1int_1s(1: i64 i, 2: string s)
struct_a struct_a_func_1ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1)
struct_a struct_a_func_2ex_1int_1s(1: i64 i, 2: string s) throws(1: moderate_disaster err1, 2:total_disaster err2)
struct_a struct_a_func_1struct_a(1: struct_a st)
}
-39
View File
@@ -1,39 +0,0 @@
#
# 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 are only testing that generated code compiles, no correctness checking is done
enum Details {
Everything = 0
StateOnly = 1
StateAndOptions = 2
SomethingElse = 3
}
typedef list< Details> DetailsWanted
struct BaseRequest {
1 : optional string RequestID
}
struct GetMyDetails {
1 : required BaseRequest base_
2 : required string ObjectID
3 : optional DetailsWanted DetailsWanted
}
@@ -1,34 +0,0 @@
#
# 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.
#
struct Option1 {
}
struct Option2 {
1: optional string name
}
union Descendant {
1: Option1 option1
2: Option2 option2
}
struct TestStruct {
1: optional Descendant descendant = { "option1": {}}
}
-511
View File
@@ -1,511 +0,0 @@
/*
* 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.
*/
// Automatically generated by MockGen. DO NOT EDIT!
// Source: thrift (interfaces: TProtocol)
package tests
import (
thrift "thrift"
gomock "github.com/golang/mock/gomock"
)
// Mock of TProtocol interface
type MockTProtocol struct {
ctrl *gomock.Controller
recorder *_MockTProtocolRecorder
}
// Recorder for MockTProtocol (not exported)
type _MockTProtocolRecorder struct {
mock *MockTProtocol
}
func NewMockTProtocol(ctrl *gomock.Controller) *MockTProtocol {
mock := &MockTProtocol{ctrl: ctrl}
mock.recorder = &_MockTProtocolRecorder{mock}
return mock
}
func (_m *MockTProtocol) EXPECT() *_MockTProtocolRecorder {
return _m.recorder
}
func (_m *MockTProtocol) Flush() error {
ret := _m.ctrl.Call(_m, "Flush")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) Flush() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Flush")
}
func (_m *MockTProtocol) ReadBinary() ([]byte, error) {
ret := _m.ctrl.Call(_m, "ReadBinary")
ret0, _ := ret[0].([]byte)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadBinary() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBinary")
}
func (_m *MockTProtocol) ReadBool() (bool, error) {
ret := _m.ctrl.Call(_m, "ReadBool")
ret0, _ := ret[0].(bool)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadBool() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadBool")
}
func (_m *MockTProtocol) ReadByte() (int8, error) {
ret := _m.ctrl.Call(_m, "ReadByte")
ret0, _ := ret[0].(int8)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadByte() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadByte")
}
func (_m *MockTProtocol) ReadDouble() (float64, error) {
ret := _m.ctrl.Call(_m, "ReadDouble")
ret0, _ := ret[0].(float64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadDouble() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadDouble")
}
func (_m *MockTProtocol) ReadFieldBegin() (string, thrift.TType, int16, error) {
ret := _m.ctrl.Call(_m, "ReadFieldBegin")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(thrift.TType)
ret2, _ := ret[2].(int16)
ret3, _ := ret[3].(error)
return ret0, ret1, ret2, ret3
}
func (_mr *_MockTProtocolRecorder) ReadFieldBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldBegin")
}
func (_m *MockTProtocol) ReadFieldEnd() error {
ret := _m.ctrl.Call(_m, "ReadFieldEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadFieldEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadFieldEnd")
}
func (_m *MockTProtocol) ReadI16() (int16, error) {
ret := _m.ctrl.Call(_m, "ReadI16")
ret0, _ := ret[0].(int16)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadI16() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI16")
}
func (_m *MockTProtocol) ReadI32() (int32, error) {
ret := _m.ctrl.Call(_m, "ReadI32")
ret0, _ := ret[0].(int32)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadI32() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI32")
}
func (_m *MockTProtocol) ReadI64() (int64, error) {
ret := _m.ctrl.Call(_m, "ReadI64")
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadI64() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadI64")
}
func (_m *MockTProtocol) ReadListBegin() (thrift.TType, int, error) {
ret := _m.ctrl.Call(_m, "ReadListBegin")
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(int)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
func (_mr *_MockTProtocolRecorder) ReadListBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListBegin")
}
func (_m *MockTProtocol) ReadListEnd() error {
ret := _m.ctrl.Call(_m, "ReadListEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadListEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadListEnd")
}
func (_m *MockTProtocol) ReadMapBegin() (thrift.TType, thrift.TType, int, error) {
ret := _m.ctrl.Call(_m, "ReadMapBegin")
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(thrift.TType)
ret2, _ := ret[2].(int)
ret3, _ := ret[3].(error)
return ret0, ret1, ret2, ret3
}
func (_mr *_MockTProtocolRecorder) ReadMapBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapBegin")
}
func (_m *MockTProtocol) ReadMapEnd() error {
ret := _m.ctrl.Call(_m, "ReadMapEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadMapEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMapEnd")
}
func (_m *MockTProtocol) ReadMessageBegin() (string, thrift.TMessageType, int32, error) {
ret := _m.ctrl.Call(_m, "ReadMessageBegin")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(thrift.TMessageType)
ret2, _ := ret[2].(int32)
ret3, _ := ret[3].(error)
return ret0, ret1, ret2, ret3
}
func (_mr *_MockTProtocolRecorder) ReadMessageBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageBegin")
}
func (_m *MockTProtocol) ReadMessageEnd() error {
ret := _m.ctrl.Call(_m, "ReadMessageEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadMessageEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadMessageEnd")
}
func (_m *MockTProtocol) ReadSetBegin() (thrift.TType, int, error) {
ret := _m.ctrl.Call(_m, "ReadSetBegin")
ret0, _ := ret[0].(thrift.TType)
ret1, _ := ret[1].(int)
ret2, _ := ret[2].(error)
return ret0, ret1, ret2
}
func (_mr *_MockTProtocolRecorder) ReadSetBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetBegin")
}
func (_m *MockTProtocol) ReadSetEnd() error {
ret := _m.ctrl.Call(_m, "ReadSetEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadSetEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadSetEnd")
}
func (_m *MockTProtocol) ReadString() (string, error) {
ret := _m.ctrl.Call(_m, "ReadString")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadString() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadString")
}
func (_m *MockTProtocol) ReadStructBegin() (string, error) {
ret := _m.ctrl.Call(_m, "ReadStructBegin")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockTProtocolRecorder) ReadStructBegin() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructBegin")
}
func (_m *MockTProtocol) ReadStructEnd() error {
ret := _m.ctrl.Call(_m, "ReadStructEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) ReadStructEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ReadStructEnd")
}
func (_m *MockTProtocol) Skip(_param0 thrift.TType) error {
ret := _m.ctrl.Call(_m, "Skip", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) Skip(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Skip", arg0)
}
func (_m *MockTProtocol) Transport() thrift.TTransport {
ret := _m.ctrl.Call(_m, "Transport")
ret0, _ := ret[0].(thrift.TTransport)
return ret0
}
func (_mr *_MockTProtocolRecorder) Transport() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Transport")
}
func (_m *MockTProtocol) WriteBinary(_param0 []byte) error {
ret := _m.ctrl.Call(_m, "WriteBinary", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteBinary(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBinary", arg0)
}
func (_m *MockTProtocol) WriteBool(_param0 bool) error {
ret := _m.ctrl.Call(_m, "WriteBool", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteBool(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteBool", arg0)
}
func (_m *MockTProtocol) WriteByte(_param0 int8) error {
ret := _m.ctrl.Call(_m, "WriteByte", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteByte(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteByte", arg0)
}
func (_m *MockTProtocol) WriteDouble(_param0 float64) error {
ret := _m.ctrl.Call(_m, "WriteDouble", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteDouble(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteDouble", arg0)
}
func (_m *MockTProtocol) WriteFieldBegin(_param0 string, _param1 thrift.TType, _param2 int16) error {
ret := _m.ctrl.Call(_m, "WriteFieldBegin", _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteFieldBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldBegin", arg0, arg1, arg2)
}
func (_m *MockTProtocol) WriteFieldEnd() error {
ret := _m.ctrl.Call(_m, "WriteFieldEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteFieldEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldEnd")
}
func (_m *MockTProtocol) WriteFieldStop() error {
ret := _m.ctrl.Call(_m, "WriteFieldStop")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteFieldStop() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteFieldStop")
}
func (_m *MockTProtocol) WriteI16(_param0 int16) error {
ret := _m.ctrl.Call(_m, "WriteI16", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteI16(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI16", arg0)
}
func (_m *MockTProtocol) WriteI32(_param0 int32) error {
ret := _m.ctrl.Call(_m, "WriteI32", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteI32(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI32", arg0)
}
func (_m *MockTProtocol) WriteI64(_param0 int64) error {
ret := _m.ctrl.Call(_m, "WriteI64", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteI64(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteI64", arg0)
}
func (_m *MockTProtocol) WriteListBegin(_param0 thrift.TType, _param1 int) error {
ret := _m.ctrl.Call(_m, "WriteListBegin", _param0, _param1)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteListBegin(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListBegin", arg0, arg1)
}
func (_m *MockTProtocol) WriteListEnd() error {
ret := _m.ctrl.Call(_m, "WriteListEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteListEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteListEnd")
}
func (_m *MockTProtocol) WriteMapBegin(_param0 thrift.TType, _param1 thrift.TType, _param2 int) error {
ret := _m.ctrl.Call(_m, "WriteMapBegin", _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteMapBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapBegin", arg0, arg1, arg2)
}
func (_m *MockTProtocol) WriteMapEnd() error {
ret := _m.ctrl.Call(_m, "WriteMapEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteMapEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMapEnd")
}
func (_m *MockTProtocol) WriteMessageBegin(_param0 string, _param1 thrift.TMessageType, _param2 int32) error {
ret := _m.ctrl.Call(_m, "WriteMessageBegin", _param0, _param1, _param2)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteMessageBegin(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageBegin", arg0, arg1, arg2)
}
func (_m *MockTProtocol) WriteMessageEnd() error {
ret := _m.ctrl.Call(_m, "WriteMessageEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteMessageEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteMessageEnd")
}
func (_m *MockTProtocol) WriteSetBegin(_param0 thrift.TType, _param1 int) error {
ret := _m.ctrl.Call(_m, "WriteSetBegin", _param0, _param1)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteSetBegin(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetBegin", arg0, arg1)
}
func (_m *MockTProtocol) WriteSetEnd() error {
ret := _m.ctrl.Call(_m, "WriteSetEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteSetEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteSetEnd")
}
func (_m *MockTProtocol) WriteString(_param0 string) error {
ret := _m.ctrl.Call(_m, "WriteString", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteString(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteString", arg0)
}
func (_m *MockTProtocol) WriteStructBegin(_param0 string) error {
ret := _m.ctrl.Call(_m, "WriteStructBegin", _param0)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteStructBegin(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructBegin", arg0)
}
func (_m *MockTProtocol) WriteStructEnd() error {
ret := _m.ctrl.Call(_m, "WriteStructEnd")
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockTProtocolRecorder) WriteStructEnd() *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "WriteStructEnd")
}
-236
View File
@@ -1,236 +0,0 @@
/*
* 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 tests
import (
"reflect"
"testing"
"thrifttest"
)
type ThriftTestDriver struct {
client thrifttest.ThriftTest
t *testing.T
}
func NewThriftTestDriver(t *testing.T, client thrifttest.ThriftTest) *ThriftTestDriver {
return &ThriftTestDriver{client, t}
}
func (p *ThriftTestDriver) Start() {
client := p.client
t := p.t
if client.TestVoid() != nil {
t.Fatal("TestVoid failed")
}
if r, err := client.TestString("Test"); r != "Test" || err != nil {
t.Fatal("TestString with simple text failed")
}
if r, err := client.TestString(""); r != "" || err != nil {
t.Fatal("TestString with empty text failed")
}
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ú, 粵語"
if r, err := client.TestString(stringTest); r != stringTest || err != nil {
t.Fatal("TestString with all languages failed")
}
specialCharacters := "quote: \" backslash:" +
" 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: ]] \"]] \\\" }}}{ [[[ "
if r, err := client.TestString(specialCharacters); r != specialCharacters || err != nil {
t.Fatal("TestString with specialCharacters failed")
}
if r, err := client.TestByte(1); r != 1 || err != nil {
t.Fatal("TestByte(1) failed")
}
if r, err := client.TestByte(0); r != 0 || err != nil {
t.Fatal("TestByte(0) failed")
}
if r, err := client.TestByte(-1); r != -1 || err != nil {
t.Fatal("TestByte(-1) failed")
}
if r, err := client.TestByte(-127); r != -127 || err != nil {
t.Fatal("TestByte(-127) failed")
}
if r, err := client.TestI32(-1); r != -1 || err != nil {
t.Fatal("TestI32(-1) failed")
}
if r, err := client.TestI32(1); r != 1 || err != nil {
t.Fatal("TestI32(1) failed")
}
if r, err := client.TestI64(-5); r != -5 || err != nil {
t.Fatal("TestI64(-5) failed")
}
if r, err := client.TestI64(5); r != 5 || err != nil {
t.Fatal("TestI64(5) failed")
}
if r, err := client.TestI64(-34359738368); r != -34359738368 || err != nil {
t.Fatal("TestI64(-34359738368) failed")
}
if r, err := client.TestDouble(-5.2098523); r != -5.2098523 || err != nil {
t.Fatal("TestDouble(-5.2098523) failed")
}
if r, err := client.TestDouble(-7.012052175215044); r != -7.012052175215044 || err != nil {
t.Fatal("TestDouble(-7.012052175215044) failed")
}
// TODO: add testBinary() call
out := thrifttest.NewXtruct()
out.StringThing = "Zero"
out.ByteThing = 1
out.I32Thing = -3
out.I64Thing = 1000000
if r, err := client.TestStruct(out); !reflect.DeepEqual(r, out) || err != nil {
t.Fatal("TestStruct failed")
}
out2 := thrifttest.NewXtruct2()
out2.ByteThing = 1
out2.StructThing = out
out2.I32Thing = 5
if r, err := client.TestNest(out2); !reflect.DeepEqual(r, out2) || err != nil {
t.Fatal("TestNest failed")
}
mapout := make(map[int32]int32)
for i := int32(0); i < 5; i++ {
mapout[i] = i - 10
}
if r, err := client.TestMap(mapout); !reflect.DeepEqual(r, mapout) || err != nil {
t.Fatal("TestMap failed")
}
mapTestInput := map[string]string{
"a": "123", "a b": "with spaces ", "same": "same", "0": "numeric key",
"longValue": stringTest, stringTest: "long key",
}
if r, err := client.TestStringMap(mapTestInput); !reflect.DeepEqual(r, mapTestInput) || err != nil {
t.Fatal("TestStringMap failed")
}
setTestInput := map[int32]struct{}{1: {}, 2: {}, 3: {}}
if r, err := client.TestSet(setTestInput); !reflect.DeepEqual(r, setTestInput) || err != nil {
t.Fatal("TestSet failed")
}
listTest := []int32{1, 2, 3}
if r, err := client.TestList(listTest); !reflect.DeepEqual(r, listTest) || err != nil {
t.Fatal("TestList failed")
}
if r, err := client.TestEnum(thrifttest.Numberz_ONE); r != thrifttest.Numberz_ONE || err != nil {
t.Fatal("TestEnum failed")
}
if r, err := client.TestTypedef(69); r != 69 || err != nil {
t.Fatal("TestTypedef failed")
}
mapMapTest := map[int32]map[int32]int32{
4: {1: 1, 2: 2, 3: 3, 4: 4},
-4: {-4: -4, -3: -3, -2: -2, -1: -1},
}
if r, err := client.TestMapMap(1); !reflect.DeepEqual(r, mapMapTest) || err != nil {
t.Fatal("TestMapMap failed")
}
crazyX1 := thrifttest.NewXtruct()
crazyX1.StringThing = "Goodbye4"
crazyX1.ByteThing = 4
crazyX1.I32Thing = 4
crazyX1.I64Thing = 4
crazyX2 := thrifttest.NewXtruct()
crazyX2.StringThing = "Hello2"
crazyX2.ByteThing = 2
crazyX2.I32Thing = 2
crazyX2.I64Thing = 2
crazy := thrifttest.NewInsanity()
crazy.UserMap = map[thrifttest.Numberz]thrifttest.UserId{5: 5, 8: 8}
crazy.Xtructs = []*thrifttest.Xtruct{crazyX1, crazyX2}
crazyEmpty := thrifttest.NewInsanity()
crazyEmpty.UserMap = map[thrifttest.Numberz]thrifttest.UserId{}
crazyEmpty.Xtructs = []*thrifttest.Xtruct{}
insanity := map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity{
1: {thrifttest.Numberz_TWO: crazy, thrifttest.Numberz_THREE: crazy},
2: {thrifttest.Numberz_SIX: crazyEmpty},
}
if r, err := client.TestInsanity(crazy); !reflect.DeepEqual(r, insanity) || err != nil {
t.Fatal("TestInsanity failed")
}
if err := client.TestException("TException"); err == nil {
t.Fatal("TestException TException failed")
}
if err, ok := client.TestException("Xception").(*thrifttest.Xception); ok == false || err == nil {
t.Fatal("TestException Xception failed")
} else if err.ErrorCode != 1001 || err.Message != "Xception" {
t.Fatal("TestException Xception failed")
}
if err := client.TestException("no Exception"); err != nil {
t.Fatal("TestException no Exception failed")
}
if err := client.TestOneway(0); err != nil {
t.Fatal("TestOneway failed")
}
}
-209
View File
@@ -1,209 +0,0 @@
/*
* 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 tests
import (
"errors"
"thrift"
"thrifttest"
"time"
)
type SecondServiceHandler struct {
}
func NewSecondServiceHandler() *SecondServiceHandler {
return &SecondServiceHandler{}
}
func (p *SecondServiceHandler) BlahBlah() (err error) {
return nil
}
func (p *SecondServiceHandler) SecondtestString(thing string) (r string, err error) {
return thing, nil
}
type ThriftTestHandler struct {
}
func NewThriftTestHandler() *ThriftTestHandler {
return &ThriftTestHandler{}
}
func (p *ThriftTestHandler) TestVoid() (err error) {
return nil
}
func (p *ThriftTestHandler) TestString(thing string) (r string, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestBool(thing bool) (r bool, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestByte(thing int8) (r int8, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestI32(thing int32) (r int32, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestI64(thing int64) (r int64, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestDouble(thing float64) (r float64, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestBinary(thing []byte) (r []byte, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestStruct(thing *thrifttest.Xtruct) (r *thrifttest.Xtruct, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestNest(thing *thrifttest.Xtruct2) (r *thrifttest.Xtruct2, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestMap(thing map[int32]int32) (r map[int32]int32, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestStringMap(thing map[string]string) (r map[string]string, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestSet(thing map[int32]struct{}) (r map[int32]struct{}, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestList(thing []int32) (r []int32, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestEnum(thing thrifttest.Numberz) (r thrifttest.Numberz, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestTypedef(thing thrifttest.UserId) (r thrifttest.UserId, err error) {
return thing, nil
}
func (p *ThriftTestHandler) TestMapMap(hello int32) (r map[int32]map[int32]int32, err error) {
r = make(map[int32]map[int32]int32)
pos := make(map[int32]int32)
neg := make(map[int32]int32)
for i := int32(1); i < 5; i++ {
pos[i] = i
neg[-i] = -i
}
r[4] = pos
r[-4] = neg
return r, nil
}
func (p *ThriftTestHandler) TestInsanity(argument *thrifttest.Insanity) (r map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity, err error) {
hello := thrifttest.NewXtruct()
hello.StringThing = "Hello2"
hello.ByteThing = 2
hello.I32Thing = 2
hello.I64Thing = 2
goodbye := thrifttest.NewXtruct()
goodbye.StringThing = "Goodbye4"
goodbye.ByteThing = 4
goodbye.I32Thing = 4
goodbye.I64Thing = 4
crazy := thrifttest.NewInsanity()
crazy.UserMap = make(map[thrifttest.Numberz]thrifttest.UserId)
crazy.UserMap[thrifttest.Numberz_EIGHT] = 8
crazy.UserMap[thrifttest.Numberz_FIVE] = 5
crazy.Xtructs = []*thrifttest.Xtruct{goodbye, hello}
first_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)
second_map := make(map[thrifttest.Numberz]*thrifttest.Insanity)
first_map[thrifttest.Numberz_TWO] = crazy
first_map[thrifttest.Numberz_THREE] = crazy
looney := thrifttest.NewInsanity()
second_map[thrifttest.Numberz_SIX] = looney
var insane = make(map[thrifttest.UserId]map[thrifttest.Numberz]*thrifttest.Insanity)
insane[1] = first_map
insane[2] = second_map
return insane, nil
}
func (p *ThriftTestHandler) TestMulti(arg0 int8, arg1 int32, arg2 int64, arg3 map[int16]string, arg4 thrifttest.Numberz, arg5 thrifttest.UserId) (r *thrifttest.Xtruct, err error) {
r = thrifttest.NewXtruct()
r.StringThing = "Hello2"
r.ByteThing = arg0
r.I32Thing = arg1
r.I64Thing = arg2
return r, nil
}
func (p *ThriftTestHandler) TestException(arg string) (err error) {
if arg == "Xception" {
x := thrifttest.NewXception()
x.ErrorCode = 1001
x.Message = arg
return x
} else if arg == "TException" {
return thrift.TException(errors.New(arg))
} else {
return nil
}
}
func (p *ThriftTestHandler) TestMultiException(arg0 string, arg1 string) (r *thrifttest.Xtruct, err error) {
if arg0 == "Xception" {
x := thrifttest.NewXception()
x.ErrorCode = 1001
x.Message = "This is an Xception"
return nil, x
} else if arg0 == "Xception2" {
x2 := thrifttest.NewXception2()
x2.ErrorCode = 2002
x2.StructThing = thrifttest.NewXtruct()
x2.StructThing.StringThing = "This is an Xception2"
return nil, x2
}
res := thrifttest.NewXtruct()
res.StringThing = arg1
return res, nil
}
func (p *ThriftTestHandler) TestOneway(secondsToSleep int32) (err error) {
time.Sleep(time.Second * time.Duration(secondsToSleep))
return nil
}