blob: 3517640a61328a5469ed172bd4b220d2dfa5c750 [file] [log] [blame]
Gavin McDonald0b75e1a2010-10-28 02:12:01 +00001/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20namespace java thrift.test
21namespace cpp thrift.test
22namespace rb Thrift.Test
23namespace perl ThriftTest
24namespace csharp Thrift.Test
25
26enum Numberz
27{
28 ONE = 1,
29 TWO,
30 THREE,
31 FIVE = 5,
32 SIX,
33 EIGHT = 8
34}
35
36typedef i64 UserId
37
38struct Bonk
39{
40 1: string message,
41 2: i32 type
42}
43
44struct Bools {
45 1: bool im_true,
46 2: bool im_false,
47}
48
49struct Xtruct
50{
51 1: string string_thing,
52 4: byte byte_thing,
53 9: i32 i32_thing,
54 11: i64 i64_thing
55}
56
57struct Xtruct2
58{
59 1: byte byte_thing,
60 2: Xtruct struct_thing,
61 3: i32 i32_thing
62}
63
64struct Xtruct3
65{
66 1: string string_thing,
67 4: i32 changed,
68 9: i32 i32_thing,
69 11: i64 i64_thing
70}
71
72
73struct Insanity
74{
75 1: map<Numberz, UserId> userMap,
76 2: list<Xtruct> xtructs
77}
78
79struct CrazyNesting {
80 1: string string_field,
81 2: optional set<Insanity> set_field,
82 3: required list< map<set<i32>,map<i32,set<list<map<Insanity,string>>>>>> list_field
83}
84
85exception Xception {
86 1: i32 errorCode,
87 2: string message
88}
89
90exception Xception2 {
91 1: i32 errorCode,
92 2: Xtruct struct_thing
93}
94
95struct EmptyStruct {}
96
97struct OneField {
98 1: EmptyStruct field
99}
100
101service ThriftTest
102{
103 void testVoid(),
104 string testString(1: string thing),
105 byte testByte(1: byte thing),
106 i32 testI32(1: i32 thing),
107 i64 testI64(1: i64 thing),
108 double testDouble(1: double thing),
109 Xtruct testStruct(1: Xtruct thing),
110 Xtruct2 testNest(1: Xtruct2 thing),
111 map<i32,i32> testMap(1: map<i32,i32> thing),
112 set<i32> testSet(1: set<i32> thing),
113 list<i32> testList(1: list<i32> thing),
114 Numberz testEnum(1: Numberz thing),
115 UserId testTypedef(1: UserId thing),
116
117 map<i32,map<i32,i32>> testMapMap(1: i32 hello),
118
119 /* So you think you've got this all worked, out eh? */
120 map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
121
122 /* Multiple parameters */
123 Xtruct testMulti(1: byte arg0, 2: i32 arg1, 3: i64 arg2, 4: map<i16, string> arg3, 5: Numberz arg4, 6: UserId arg5),
124
125 /* Exception specifier */
126
127 void testException(1: string arg) throws(1: Xception err1),
128
129 /* Multiple exceptions specifier */
130
131 Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2)
132
133 /* Test oneway void */
134 oneway void testOneway(1:i32 secondsToSleep)
135}
136
137service SecondService
138{
139 void blahBlah()
140}
141
142struct VersioningTestV1 {
143 1: i32 begin_in_both,
144 3: string old_string,
145 12: i32 end_in_both
146}
147
148struct VersioningTestV2 {
149 1: i32 begin_in_both,
150
151 2: i32 newint,
152 3: byte newbyte,
153 4: i16 newshort,
154 5: i64 newlong,
155 6: double newdouble
156 7: Bonk newstruct,
157 8: list<i32> newlist,
158 9: set<i32> newset,
159 10: map<i32, i32> newmap,
160 11: string newstring,
161 12: i32 end_in_both
162}
163
164struct ListTypeVersioningV1 {
165 1: list<i32> myints;
166 2: string hello;
167}
168
169struct ListTypeVersioningV2 {
170 1: list<string> strings;
171 2: string hello;
172}