2009-03-30 21:35:00 +00:00
|
|
|
/*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
* or more contributor license agreements. See the NOTICE file
|
|
|
|
* distributed with this work for additional information
|
|
|
|
* regarding copyright ownership. The ASF licenses this file
|
|
|
|
* to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance
|
|
|
|
* with the License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2009-12-07 00:42:38 +00:00
|
|
|
*
|
|
|
|
* Contains some contributions under the Thrift Software License.
|
|
|
|
* Please see doc/old-thrift-license.txt in the Thrift distribution for
|
|
|
|
* details.
|
2009-03-30 21:35:00 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-27 01:55:25 +00:00
|
|
|
namespace java thrift.test
|
2008-02-27 01:55:17 +00:00
|
|
|
namespace cpp thrift.test
|
2008-03-27 21:42:16 +00:00
|
|
|
namespace rb Thrift.Test
|
2008-03-27 21:42:39 +00:00
|
|
|
namespace perl ThriftTest
|
2008-03-27 21:41:37 +00:00
|
|
|
namespace csharp Thrift.Test
|
2010-02-15 03:24:55 +00:00
|
|
|
namespace js ThriftTest
|
2010-08-30 17:09:58 +00:00
|
|
|
namespace st ThriftTest
|
2006-08-15 00:21:31 +00:00
|
|
|
|
2009-11-19 17:26:38 +00:00
|
|
|
/**
|
|
|
|
* Docstring!
|
|
|
|
*/
|
2006-05-30 09:24:40 +00:00
|
|
|
enum Numberz
|
|
|
|
{
|
|
|
|
ONE = 1,
|
|
|
|
TWO,
|
|
|
|
THREE,
|
|
|
|
FIVE = 5,
|
|
|
|
SIX,
|
|
|
|
EIGHT = 8
|
|
|
|
}
|
|
|
|
|
2006-06-30 18:28:50 +00:00
|
|
|
typedef i64 UserId
|
2006-05-30 09:24:40 +00:00
|
|
|
|
2007-02-21 05:17:48 +00:00
|
|
|
struct Bonk
|
|
|
|
{
|
|
|
|
1: string message,
|
|
|
|
2: i32 type
|
|
|
|
}
|
|
|
|
|
2009-03-24 16:04:36 +00:00
|
|
|
struct Bools {
|
|
|
|
1: bool im_true,
|
|
|
|
2: bool im_false,
|
|
|
|
}
|
|
|
|
|
2006-05-30 09:24:40 +00:00
|
|
|
struct Xtruct
|
|
|
|
{
|
2006-10-25 19:03:32 +00:00
|
|
|
1: string string_thing,
|
|
|
|
4: byte byte_thing,
|
|
|
|
9: i32 i32_thing,
|
|
|
|
11: i64 i64_thing
|
2006-05-30 09:24:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
struct Xtruct2
|
|
|
|
{
|
2006-10-25 19:03:32 +00:00
|
|
|
1: byte byte_thing,
|
|
|
|
2: Xtruct struct_thing,
|
|
|
|
3: i32 i32_thing
|
2006-05-30 09:24:40 +00:00
|
|
|
}
|
|
|
|
|
2009-03-30 20:46:47 +00:00
|
|
|
struct Xtruct3
|
|
|
|
{
|
|
|
|
1: string string_thing,
|
|
|
|
4: i32 changed,
|
|
|
|
9: i32 i32_thing,
|
|
|
|
11: i64 i64_thing
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-05-30 09:24:40 +00:00
|
|
|
struct Insanity
|
|
|
|
{
|
2006-10-25 19:03:32 +00:00
|
|
|
1: map<Numberz, UserId> userMap,
|
|
|
|
2: list<Xtruct> xtructs
|
2006-05-30 09:24:40 +00:00
|
|
|
}
|
|
|
|
|
2009-01-29 01:51:08 +00:00
|
|
|
struct CrazyNesting {
|
|
|
|
1: string string_field,
|
|
|
|
2: optional set<Insanity> set_field,
|
|
|
|
3: required list< map<set<i32>,map<i32,set<list<map<Insanity,string>>>>>> list_field
|
|
|
|
}
|
|
|
|
|
2006-08-15 21:29:39 +00:00
|
|
|
exception Xception {
|
2006-10-25 19:03:32 +00:00
|
|
|
1: i32 errorCode,
|
|
|
|
2: string message
|
2006-08-14 23:30:37 +00:00
|
|
|
}
|
|
|
|
|
2006-08-15 21:29:39 +00:00
|
|
|
exception Xception2 {
|
2006-10-25 19:03:32 +00:00
|
|
|
1: i32 errorCode,
|
|
|
|
2: Xtruct struct_thing
|
2006-08-14 23:30:37 +00:00
|
|
|
}
|
2007-08-16 01:26:31 +00:00
|
|
|
|
2006-09-01 22:19:06 +00:00
|
|
|
struct EmptyStruct {}
|
|
|
|
|
2006-08-14 23:30:37 +00:00
|
|
|
struct OneField {
|
2006-10-25 19:03:32 +00:00
|
|
|
1: EmptyStruct field
|
2006-08-14 23:30:37 +00:00
|
|
|
}
|
2006-08-11 23:03:42 +00:00
|
|
|
|
2006-05-30 09:24:40 +00:00
|
|
|
service ThriftTest
|
|
|
|
{
|
2006-08-14 23:30:37 +00:00
|
|
|
void testVoid(),
|
2006-10-25 19:03:32 +00:00
|
|
|
string testString(1: string thing),
|
|
|
|
byte testByte(1: byte thing),
|
|
|
|
i32 testI32(1: i32 thing),
|
|
|
|
i64 testI64(1: i64 thing),
|
|
|
|
double testDouble(1: double thing),
|
|
|
|
Xtruct testStruct(1: Xtruct thing),
|
|
|
|
Xtruct2 testNest(1: Xtruct2 thing),
|
|
|
|
map<i32,i32> testMap(1: map<i32,i32> thing),
|
|
|
|
set<i32> testSet(1: set<i32> thing),
|
|
|
|
list<i32> testList(1: list<i32> thing),
|
|
|
|
Numberz testEnum(1: Numberz thing),
|
|
|
|
UserId testTypedef(1: UserId thing),
|
|
|
|
|
|
|
|
map<i32,map<i32,i32>> testMapMap(1: i32 hello),
|
2006-05-30 09:24:40 +00:00
|
|
|
|
|
|
|
/* So you think you've got this all worked, out eh? */
|
2006-10-25 19:03:32 +00:00
|
|
|
map<UserId, map<Numberz,Insanity>> testInsanity(1: Insanity argument),
|
2006-08-14 23:30:37 +00:00
|
|
|
|
|
|
|
/* Multiple parameters */
|
2009-04-02 19:24:02 +00:00
|
|
|
Xtruct testMulti(1: byte arg0, 2: i32 arg1, 3: i64 arg2, 4: map<i16, string> arg3, 5: Numberz arg4, 6: UserId arg5),
|
2006-08-14 23:30:37 +00:00
|
|
|
|
|
|
|
/* Exception specifier */
|
|
|
|
|
2009-04-02 19:24:02 +00:00
|
|
|
void testException(1: string arg) throws(1: Xception err1),
|
2006-08-14 23:30:37 +00:00
|
|
|
|
|
|
|
/* Multiple exceptions specifier */
|
|
|
|
|
2009-04-02 19:24:02 +00:00
|
|
|
Xtruct testMultiException(1: string arg0, 2: string arg1) throws(1: Xception err1, 2: Xception2 err2)
|
2008-02-18 02:11:44 +00:00
|
|
|
|
2009-03-24 20:01:25 +00:00
|
|
|
/* Test oneway void */
|
2009-03-24 20:02:22 +00:00
|
|
|
oneway void testOneway(1:i32 secondsToSleep)
|
2006-05-30 09:24:40 +00:00
|
|
|
}
|
2006-09-02 23:56:49 +00:00
|
|
|
|
|
|
|
service SecondService
|
|
|
|
{
|
|
|
|
void blahBlah()
|
|
|
|
}
|
2008-02-15 01:10:23 +00:00
|
|
|
|
|
|
|
struct VersioningTestV1 {
|
|
|
|
1: i32 begin_in_both,
|
2009-03-24 22:48:40 +00:00
|
|
|
3: string old_string,
|
2008-02-15 01:10:23 +00:00
|
|
|
12: i32 end_in_both
|
|
|
|
}
|
|
|
|
|
|
|
|
struct VersioningTestV2 {
|
|
|
|
1: i32 begin_in_both,
|
|
|
|
|
|
|
|
2: i32 newint,
|
|
|
|
3: byte newbyte,
|
|
|
|
4: i16 newshort,
|
|
|
|
5: i64 newlong,
|
|
|
|
6: double newdouble
|
|
|
|
7: Bonk newstruct,
|
|
|
|
8: list<i32> newlist,
|
|
|
|
9: set<i32> newset,
|
|
|
|
10: map<i32, i32> newmap,
|
|
|
|
11: string newstring,
|
|
|
|
12: i32 end_in_both
|
2008-02-27 01:55:17 +00:00
|
|
|
}
|
2008-04-07 23:45:00 +00:00
|
|
|
|
|
|
|
struct ListTypeVersioningV1 {
|
|
|
|
1: list<i32> myints;
|
|
|
|
2: string hello;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct ListTypeVersioningV2 {
|
|
|
|
1: list<string> strings;
|
|
|
|
2: string hello;
|
2009-01-29 01:51:08 +00:00
|
|
|
}
|