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 | { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 17 | string string_thing = 1, |
| 18 | byte byte_thing = 4, |
| 19 | i32 i32_thing = 9, |
| 20 | i64 i64_thing = 11 |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 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 { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 37 | i32 errorCode, |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 38 | string message |
| 39 | } |
| 40 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 41 | exception Xception2 { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 42 | i32 errorCode, |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 43 | Xtruct struct_thing |
| 44 | } |
| 45 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 46 | struct EmptyStruct {} |
| 47 | |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 48 | struct OneField { |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 49 | EmptyStruct field |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 50 | } |
Marc Slemko | 5b126d6 | 2006-08-11 23:03:42 +0000 | [diff] [blame] | 51 | |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 52 | service ThriftTest |
| 53 | { |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 54 | void testVoid(), |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 55 | string testString(string thing = 1), |
| 56 | byte testByte(byte thing = 1), |
| 57 | i32 testI32(i32 thing = 1), |
| 58 | i64 testI64(i64 thing = 1), |
| 59 | Xtruct testStruct(Xtruct thing = 1), |
| 60 | Xtruct2 testNest(Xtruct2 thing = 1), |
| 61 | map<i32,i32> testMap(map<i32,i32> thing = 1), |
| 62 | set<i32> testSet(set<i32> thing = 1), |
| 63 | list<i32> testList(list<i32> thing = 1), |
| 64 | Numberz testEnum(Numberz thing = 1), |
| 65 | UserId testTypedef(UserId thing = 1), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 66 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 67 | map<i32,map<i32,i32>> testMapMap(i32 hello = 1), |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 68 | |
| 69 | /* So you think you've got this all worked, out eh? */ |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 70 | map<UserId, map<Numberz,Insanity>> testInsanity(Insanity argument = 1), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 71 | |
| 72 | /* Multiple parameters */ |
Marc Slemko | 0b4ffa9 | 2006-08-11 02:49:29 +0000 | [diff] [blame] | 73 | |
Mark Slee | d3d733a | 2006-09-01 22:19:06 +0000 | [diff] [blame] | 74 | 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] | 75 | |
| 76 | /* Exception specifier */ |
| 77 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 78 | void testException(string arg) throws(Xception err1), |
Marc Slemko | d8b1051 | 2006-08-14 23:30:37 +0000 | [diff] [blame] | 79 | |
| 80 | /* Multiple exceptions specifier */ |
| 81 | |
Marc Slemko | bf4fd19 | 2006-08-15 21:29:39 +0000 | [diff] [blame] | 82 | Xtruct testMultiException(string arg0, string arg1) throws(Xception err1=1, Xception2 err2) |
Mark Slee | e854063 | 2006-05-30 09:24:40 +0000 | [diff] [blame] | 83 | } |
Mark Slee | dafa3cf | 2006-09-02 23:56:49 +0000 | [diff] [blame] | 84 | |
| 85 | service SecondService |
| 86 | { |
| 87 | void blahBlah() |
| 88 | } |