Marc Slemko | aeb36f8 | 2006-08-15 00:21:45 +0000 | [diff] [blame] | 1 | namespace thrift.test |
Marc Slemko | 1785985 | 2006-08-15 00:21:31 +0000 | [diff] [blame] | 2 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 3 | enum Numberz |
| 4 | { |
| 5 | ONE = 1, |
| 6 | TWO, |
| 7 | THREE, |
| 8 | FIVE = 5, |
| 9 | SIX, |
| 10 | EIGHT = 8 |
| 11 | } |
| 12 | |
Mark Slee | 6e53644 | 2006-06-30 18:28:50 +0000 | [diff] [blame] | 13 | typedef i64 UserId |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 14 | |
| 15 | struct Xtruct |
| 16 | { |
| 17 | string string_thing = 0, |
| 18 | byte byte_thing = 1, |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 19 | i32 i32_thing = 3, |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 20 | i64 i64_thing = 5 |
| 21 | } |
| 22 | |
| 23 | struct Xtruct2 |
| 24 | { |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 25 | byte byte_thing, |
| 26 | Xtruct struct_thing, |
| 27 | i32 i32_thing |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | struct Insanity |
| 31 | { |
| 32 | map<Numberz, UserId> userMap = 0, |
Marc Slemko | e6889de | 2006-08-12 00:32:53 +0000 | [diff] [blame] | 33 | list<Xtruct> xtructs = 1 |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 34 | } |
| 35 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame^] | 36 | exception Xception { |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 37 | u32 errorCode, |
| 38 | string message |
| 39 | } |
| 40 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame^] | 41 | exception Xception2 { |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 42 | u32 errorCode, |
| 43 | Xtruct struct_thing |
| 44 | } |
| 45 | |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 46 | struct Empty {} |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 47 | struct OneField { |
| 48 | Empty field |
| 49 | } |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 50 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 51 | service ThriftTest |
| 52 | { |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 53 | void testVoid(), |
| 54 | string testString(string thing = 0), |
| 55 | byte testByte(byte thing = 0), |
| 56 | i32 testI32(i32 thing = 0), |
| 57 | i64 testI64(i64 thing = 0), |
| 58 | Xtruct testStruct(Xtruct thing = 0), |
| 59 | Xtruct2 testNest(Xtruct2 thing = 0), |
| 60 | map<i32,i32> testMap(map<i32,i32> thing = 0), |
| 61 | set<i32> testSet(set<i32> thing = 0), |
| 62 | list<i32> testList(list<i32> thing = 0), |
| 63 | Numberz testEnum(Numberz thing = 0), |
| 64 | UserId testTypedef(UserId thing = 0), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 65 | |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 66 | map<i32,map<i32,i32>> testMapMap(i32 hello = 0), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 67 | |
| 68 | /* So you think you've got this all worked, out eh? */ |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 69 | map<UserId, map<Numberz,Insanity>> testInsanity(Insanity argument = 0), |
| 70 | |
| 71 | /* Multiple parameters */ |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 72 | |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 73 | Xtruct testMulti(byte arg0, i32 arg1, u64 arg2, map<i16, string> arg3, Numberz arg4, UserId arg5), |
| 74 | |
| 75 | /* Exception specifier */ |
| 76 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame^] | 77 | void testException(string arg) throws(Xception err1), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 78 | |
| 79 | /* Multiple exceptions specifier */ |
| 80 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame^] | 81 | Xtruct testMultiException(string arg0, string arg1) throws(Xception err1=1, Xception2 err2) |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 82 | } |