blob: a042d7efd63cc5570dd47c84f86718952847297b [file] [log] [blame]
David Reiss771f8c72008-02-27 01:55:25 +00001namespace java thrift.test
David Reiss9a08dc62008-02-27 01:55:17 +00002namespace cpp thrift.test
David Reiss6a4b82c2008-03-27 21:42:16 +00003namespace rb Thrift.Test
David Reiss07ef3a92008-03-27 21:42:39 +00004namespace perl ThriftTest
David Reiss9d65bf02008-03-27 21:41:37 +00005namespace csharp Thrift.Test
Marc Slemko17859852006-08-15 00:21:31 +00006
Mark Sleee8540632006-05-30 09:24:40 +00007enum Numberz
8{
9 ONE = 1,
10 TWO,
11 THREE,
12 FIVE = 5,
13 SIX,
14 EIGHT = 8
15}
16
Mark Slee6e536442006-06-30 18:28:50 +000017typedef i64 UserId
Mark Sleee8540632006-05-30 09:24:40 +000018
Mark Sleee129a2d2007-02-21 05:17:48 +000019struct Bonk
20{
21 1: string message,
22 2: i32 type
23}
24
Mark Sleee8540632006-05-30 09:24:40 +000025struct Xtruct
26{
Mark Sleea3302652006-10-25 19:03:32 +000027 1: string string_thing,
28 4: byte byte_thing,
29 9: i32 i32_thing,
30 11: i64 i64_thing
Mark Sleee8540632006-05-30 09:24:40 +000031}
32
33struct Xtruct2
34{
Mark Sleea3302652006-10-25 19:03:32 +000035 1: byte byte_thing,
36 2: Xtruct struct_thing,
37 3: i32 i32_thing
Mark Sleee8540632006-05-30 09:24:40 +000038}
39
40struct Insanity
41{
Mark Sleea3302652006-10-25 19:03:32 +000042 1: map<Numberz, UserId> userMap,
43 2: list<Xtruct> xtructs
Mark Sleee8540632006-05-30 09:24:40 +000044}
45
Bryan Duxbury986d7052009-01-29 01:51:08 +000046struct CrazyNesting {
47 1: string string_field,
48 2: optional set<Insanity> set_field,
49 3: required list< map<set<i32>,map<i32,set<list<map<Insanity,string>>>>>> list_field
50}
51
Marc Slemkobf4fd192006-08-15 21:29:39 +000052exception Xception {
Mark Sleea3302652006-10-25 19:03:32 +000053 1: i32 errorCode,
54 2: string message
Marc Slemkod8b10512006-08-14 23:30:37 +000055}
56
Marc Slemkobf4fd192006-08-15 21:29:39 +000057exception Xception2 {
Mark Sleea3302652006-10-25 19:03:32 +000058 1: i32 errorCode,
59 2: Xtruct struct_thing
Marc Slemkod8b10512006-08-14 23:30:37 +000060}
Mark Slee27ed6ec2007-08-16 01:26:31 +000061
Mark Sleed3d733a2006-09-01 22:19:06 +000062struct EmptyStruct {}
63
Marc Slemkod8b10512006-08-14 23:30:37 +000064struct OneField {
Mark Sleea3302652006-10-25 19:03:32 +000065 1: EmptyStruct field
Marc Slemkod8b10512006-08-14 23:30:37 +000066}
Marc Slemko5b126d62006-08-11 23:03:42 +000067
Mark Sleee8540632006-05-30 09:24:40 +000068service ThriftTest
69{
Marc Slemkod8b10512006-08-14 23:30:37 +000070 void testVoid(),
Mark Sleea3302652006-10-25 19:03:32 +000071 string testString(1: string thing),
72 byte testByte(1: byte thing),
73 i32 testI32(1: i32 thing),
74 i64 testI64(1: i64 thing),
75 double testDouble(1: double thing),
76 Xtruct testStruct(1: Xtruct thing),
77 Xtruct2 testNest(1: Xtruct2 thing),
78 map<i32,i32> testMap(1: map<i32,i32> thing),
79 set<i32> testSet(1: set<i32> thing),
80 list<i32> testList(1: list<i32> thing),
81 Numberz testEnum(1: Numberz thing),
82 UserId testTypedef(1: UserId thing),
Mark Sleee8540632006-05-30 09:24:40 +000083
Mark Sleea3302652006-10-25 19:03:32 +000084 map<i32,map<i32,i32>> testMapMap(1: i32 hello),
Mark Sleee8540632006-05-30 09:24:40 +000085
86 /* So you think you've got this all worked, out eh? */
Mark Sleea3302652006-10-25 19:03:32 +000087 map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
Marc Slemkod8b10512006-08-14 23:30:37 +000088
89 /* Multiple parameters */
Mark Slee27ed6ec2007-08-16 01:26:31 +000090 Xtruct testMulti(byte arg0, i32 arg1, i64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5),
Marc Slemkod8b10512006-08-14 23:30:37 +000091
92 /* Exception specifier */
93
Marc Slemkobf4fd192006-08-15 21:29:39 +000094 void testException(string arg) throws(Xception err1),
Marc Slemkod8b10512006-08-14 23:30:37 +000095
96 /* Multiple exceptions specifier */
97
Mark Sleea3302652006-10-25 19:03:32 +000098 Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2)
David Reiss2ab6fe82008-02-18 02:11:44 +000099
100 /* Test async void */
101 async void testAsync(1:i32 secondsToSleep)
Mark Sleee8540632006-05-30 09:24:40 +0000102}
Mark Sleedafa3cf2006-09-02 23:56:49 +0000103
104service SecondService
105{
106 void blahBlah()
107}
David Reiss9ff3b9d2008-02-15 01:10:23 +0000108
109struct VersioningTestV1 {
110 1: i32 begin_in_both,
111 12: i32 end_in_both
112}
113
114struct VersioningTestV2 {
115 1: i32 begin_in_both,
116
117 2: i32 newint,
118 3: byte newbyte,
119 4: i16 newshort,
120 5: i64 newlong,
121 6: double newdouble
122 7: Bonk newstruct,
123 8: list<i32> newlist,
124 9: set<i32> newset,
125 10: map<i32, i32> newmap,
126 11: string newstring,
127 12: i32 end_in_both
David Reiss9a08dc62008-02-27 01:55:17 +0000128}
David Reiss2a4bfd62008-04-07 23:45:00 +0000129
130struct ListTypeVersioningV1 {
131 1: list<i32> myints;
132 2: string hello;
133}
134
135struct ListTypeVersioningV2 {
136 1: list<string> strings;
137 2: string hello;
Bryan Duxbury986d7052009-01-29 01:51:08 +0000138}