David Reiss | 771f8c7 | 2008-02-27 01:55:25 +0000 | [diff] [blame] | 1 | namespace java thrift.test |
David Reiss | 9a08dc6 | 2008-02-27 01:55:17 +0000 | [diff] [blame] | 2 | namespace cpp thrift.test |
David Reiss | 6a4b82c | 2008-03-27 21:42:16 +0000 | [diff] [blame] | 3 | namespace rb Thrift.Test |
David Reiss | 07ef3a9 | 2008-03-27 21:42:39 +0000 | [diff] [blame] | 4 | namespace perl ThriftTest |
David Reiss | 9d65bf0 | 2008-03-27 21:41:37 +0000 | [diff] [blame] | 5 | namespace csharp Thrift.Test |
Marc Slemko | 1785985 | 2006-08-15 00:21:31 +0000 | [diff] [blame] | 6 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 7 | enum Numberz |
| 8 | { |
| 9 | ONE = 1, |
| 10 | TWO, |
| 11 | THREE, |
| 12 | FIVE = 5, |
| 13 | SIX, |
| 14 | EIGHT = 8 |
| 15 | } |
| 16 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 17 | typedef i64 UserId |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 18 | |
Mark Slee | e129a2d | 2007-02-21 05:17:48 +0000 | [diff] [blame] | 19 | struct Bonk |
| 20 | { |
| 21 | 1: string message, |
| 22 | 2: i32 type |
| 23 | } |
| 24 | |
Kevin Clark | 9a863ee | 2009-03-24 16:04:36 +0000 | [diff] [blame] | 25 | struct Bools { |
| 26 | 1: bool im_true, |
| 27 | 2: bool im_false, |
| 28 | } |
| 29 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 30 | struct Xtruct |
| 31 | { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 32 | 1: string string_thing, |
| 33 | 4: byte byte_thing, |
| 34 | 9: i32 i32_thing, |
| 35 | 11: i64 i64_thing |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | struct Xtruct2 |
| 39 | { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 40 | 1: byte byte_thing, |
| 41 | 2: Xtruct struct_thing, |
| 42 | 3: i32 i32_thing |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 43 | } |
| 44 | |
David Reiss | 233ace5 | 2009-03-30 20:46:47 +0000 | [diff] [blame^] | 45 | struct Xtruct3 |
| 46 | { |
| 47 | 1: string string_thing, |
| 48 | 4: i32 changed, |
| 49 | 9: i32 i32_thing, |
| 50 | 11: i64 i64_thing |
| 51 | } |
| 52 | |
| 53 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 54 | struct Insanity |
| 55 | { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 56 | 1: map<Numberz, UserId> userMap, |
| 57 | 2: list<Xtruct> xtructs |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 58 | } |
| 59 | |
Bryan Duxbury | 986d705 | 2009-01-29 01:51:08 +0000 | [diff] [blame] | 60 | struct CrazyNesting { |
| 61 | 1: string string_field, |
| 62 | 2: optional set<Insanity> set_field, |
| 63 | 3: required list< map<set<i32>,map<i32,set<list<map<Insanity,string>>>>>> list_field |
| 64 | } |
| 65 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 66 | exception Xception { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 67 | 1: i32 errorCode, |
| 68 | 2: string message |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 69 | } |
| 70 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 71 | exception Xception2 { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 72 | 1: i32 errorCode, |
| 73 | 2: Xtruct struct_thing |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 74 | } |
Mark Slee | 27ed6ec | 2007-08-16 01:26:31 +0000 | [diff] [blame] | 75 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 76 | struct EmptyStruct {} |
| 77 | |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 78 | struct OneField { |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 79 | 1: EmptyStruct field |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 80 | } |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 81 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 82 | service ThriftTest |
| 83 | { |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 84 | void testVoid(), |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 85 | string testString(1: string thing), |
| 86 | byte testByte(1: byte thing), |
| 87 | i32 testI32(1: i32 thing), |
| 88 | i64 testI64(1: i64 thing), |
| 89 | double testDouble(1: double thing), |
| 90 | Xtruct testStruct(1: Xtruct thing), |
| 91 | Xtruct2 testNest(1: Xtruct2 thing), |
| 92 | map<i32,i32> testMap(1: map<i32,i32> thing), |
| 93 | set<i32> testSet(1: set<i32> thing), |
| 94 | list<i32> testList(1: list<i32> thing), |
| 95 | Numberz testEnum(1: Numberz thing), |
| 96 | UserId testTypedef(1: UserId thing), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 97 | |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 98 | map<i32,map<i32,i32>> testMapMap(1: i32 hello), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 99 | |
| 100 | /* So you think you've got this all worked, out eh? */ |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 101 | map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 102 | |
| 103 | /* Multiple parameters */ |
Mark Slee | 27ed6ec | 2007-08-16 01:26:31 +0000 | [diff] [blame] | 104 | Xtruct testMulti(byte arg0, i32 arg1, i64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 105 | |
| 106 | /* Exception specifier */ |
| 107 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 108 | void testException(string arg) throws(Xception err1), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 109 | |
| 110 | /* Multiple exceptions specifier */ |
| 111 | |
Mark Slee | a330265 | 2006-10-25 19:03:32 +0000 | [diff] [blame] | 112 | Xtruct testMultiException(string arg0, string arg1) throws(Xception err1, Xception2 err2) |
David Reiss | 2ab6fe8 | 2008-02-18 02:11:44 +0000 | [diff] [blame] | 113 | |
David Reiss | c51986f | 2009-03-24 20:01:25 +0000 | [diff] [blame] | 114 | /* Test oneway void */ |
David Reiss | cecbed8 | 2009-03-24 20:02:22 +0000 | [diff] [blame] | 115 | oneway void testOneway(1:i32 secondsToSleep) |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 116 | } |
Mark Slee | dafa3cf | 2006-09-02 23:56:49 +0000 | [diff] [blame] | 117 | |
| 118 | service SecondService |
| 119 | { |
| 120 | void blahBlah() |
| 121 | } |
David Reiss | 9ff3b9d | 2008-02-15 01:10:23 +0000 | [diff] [blame] | 122 | |
| 123 | struct VersioningTestV1 { |
| 124 | 1: i32 begin_in_both, |
David Reiss | a528f54 | 2009-03-24 22:48:40 +0000 | [diff] [blame] | 125 | 3: string old_string, |
David Reiss | 9ff3b9d | 2008-02-15 01:10:23 +0000 | [diff] [blame] | 126 | 12: i32 end_in_both |
| 127 | } |
| 128 | |
| 129 | struct VersioningTestV2 { |
| 130 | 1: i32 begin_in_both, |
| 131 | |
| 132 | 2: i32 newint, |
| 133 | 3: byte newbyte, |
| 134 | 4: i16 newshort, |
| 135 | 5: i64 newlong, |
| 136 | 6: double newdouble |
| 137 | 7: Bonk newstruct, |
| 138 | 8: list<i32> newlist, |
| 139 | 9: set<i32> newset, |
| 140 | 10: map<i32, i32> newmap, |
| 141 | 11: string newstring, |
| 142 | 12: i32 end_in_both |
David Reiss | 9a08dc6 | 2008-02-27 01:55:17 +0000 | [diff] [blame] | 143 | } |
David Reiss | 2a4bfd6 | 2008-04-07 23:45:00 +0000 | [diff] [blame] | 144 | |
| 145 | struct ListTypeVersioningV1 { |
| 146 | 1: list<i32> myints; |
| 147 | 2: string hello; |
| 148 | } |
| 149 | |
| 150 | struct ListTypeVersioningV2 { |
| 151 | 1: list<string> strings; |
| 152 | 2: string hello; |
Bryan Duxbury | 986d705 | 2009-01-29 01:51:08 +0000 | [diff] [blame] | 153 | } |