]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | /* |
2 | * Licensed to the Apache Software Foundation (ASF) under one | |
3 | * or more contributor license agreements. See the NOTICE file | |
4 | * distributed with this work for additional information | |
5 | * regarding copyright ownership. The ASF licenses this file | |
6 | * to you under the Apache License, Version 2.0 (the | |
7 | * "License"); you may not use this file except in compliance | |
8 | * with the License. You may obtain a copy of the License at | |
9 | * | |
10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
11 | * | |
12 | * Unless required by applicable law or agreed to in writing, | |
13 | * software distributed under the License is distributed on an | |
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
15 | * KIND, either express or implied. See the License for the | |
16 | * specific language governing permissions and limitations | |
17 | * under the License. | |
18 | */ | |
19 | ||
20 | namespace cpp test | |
21 | ||
22 | //Constants | |
23 | const i32 const1 = 123; | |
24 | const double const2 = 23.3; | |
25 | const map<string,string> const3 = {"hello":"world", "thrift":"audit"}; | |
26 | ||
27 | ||
28 | //Exception | |
29 | exception test_exception1 { | |
30 | 1: i32 code; | |
31 | 2: string json; | |
32 | } | |
33 | exception test_exception2 { | |
34 | 1: i32 code; | |
35 | 2: string json; | |
36 | } | |
37 | ||
38 | //Enums | |
39 | ||
40 | enum test_enum1 { | |
41 | enum1_value0 = 0, | |
42 | enum1_value1 = 1, | |
43 | enum1_value2 = 2, | |
44 | enum1_value5 = 5, | |
45 | enum1_value7 = 7, | |
46 | enum1_value8 = 8 | |
47 | } | |
48 | ||
49 | enum test_enum2 { | |
50 | enum2_value0 = 0, | |
51 | enum2_value1 = 1, | |
52 | enum2_value2 = 2, | |
53 | enum2_value3 = 3 | |
54 | } | |
55 | ||
56 | enum test_enum3 { | |
57 | enum3_value1 = 0, | |
58 | enum3_value2 = 1 | |
59 | } | |
60 | ||
61 | struct test_struct1 { | |
62 | 1: i16 struct1_member1, | |
63 | 2: i32 struct1_member2, | |
64 | 3: i64 struct1_member3, | |
65 | 4: double struct1_member4 = 2.5, | |
66 | 5: string struct1_member5 = "Audit test", | |
67 | 6: bool struct1_member6, | |
68 | 7: byte struct1_member7, | |
69 | 8: binary struct1_member8, | |
70 | 9: test_enum1 struct1_member9 | |
71 | } | |
72 | ||
73 | struct test_struct2 { | |
74 | 1: list<i16> struct2_member1, | |
75 | 2: list<i32> struct2_member2, | |
76 | 3: list<i64> struct2_member3 = [23, 32 ], | |
77 | 4: list<double> struct2_member4, | |
78 | 5: list<string> struct2_member5, | |
79 | 6: list<bool> struct2_member6, | |
80 | 7: list<byte> struct2_member7, | |
81 | 8: list<binary> struct2_member8, | |
82 | 9: list<test_enum1> struct2_member9 | |
83 | } | |
84 | ||
85 | struct test_struct3 { | |
86 | 1: map<i16, i32> struct3_member1 = {1:2, 3:4}, | |
87 | 2: map<i64, double> struct3_member2 = {10:1.1, 20:2.1}, | |
88 | 3: map<string, bool> struct3_member3, | |
89 | 4: map<byte, test_enum1> struct3_member4, | |
90 | 5: map<test_enum2, test_enum3 > struct3_member5, | |
91 | 7: map<double, string> struct3_member7 | |
92 | } | |
93 | ||
94 | struct test_struct4 { | |
95 | 1: i32 struct4_member1, | |
96 | 2: optional i32 struct4_member2 | |
97 | } | |
98 | ||
99 | struct test_struct5{ | |
100 | 1: double struct5_member1, | |
101 | 2: string struct5_member2 = "Thrift Audit Test" | |
102 | } | |
103 | struct test_struct6 { | |
104 | 1: i32 struct6_member1, | |
105 | 2: required i32 struct6_member2 | |
106 | } | |
107 | ||
108 | service base { | |
109 | oneway void base_oneway( | |
110 | 1: i32 arg1), | |
111 | ||
112 | void base_function1( | |
113 | 1: i16 function1_arg1, | |
114 | 2: i32 function1_arg2, | |
115 | 3: i64 function1_arg3, | |
116 | 4: double function1_arg4, | |
117 | 5: string function1_arg5, | |
118 | 6: bool function1_arg6, | |
119 | 7: test_enum1 function1_arg7, | |
120 | 8: test_struct1 function1_arg8), | |
121 | ||
122 | void base_function2( | |
123 | 1: list<i16> function2_arg1, | |
124 | 2: list<i32> function2_arg2, | |
125 | 3: list<i64> function2_arg3, | |
126 | 4: list<double> function2_arg4, | |
127 | 5: list<string> function2_arg5, | |
128 | 6: list<bool> function2_arg6, | |
129 | 7: list<byte> function2_arg7, | |
130 | 8: list<test_enum1> function2_arg8, | |
131 | 9: list<test_struct1> function2_arg9) throws (1:test_exception2 e), | |
132 | ||
133 | void base_function3(), | |
134 | ||
135 | } | |
136 | ||
137 | service derived1 extends base { | |
138 | ||
139 | test_enum1 derived1_function1( | |
140 | 1: i64 function1_arg1, | |
141 | 2: double function1_arg2, | |
142 | 3: test_enum1 function1_arg3) throws (1:test_exception2 e), | |
143 | ||
144 | i64 derived1_function2( | |
145 | 1: list<i64> function2_arg1, | |
146 | 2: list<double> function2_arg2, | |
147 | 3: list<string> function2_arg3, | |
148 | 4: list<byte> function2_arg4, | |
149 | 5: list<test_enum1> function2_arg5) throws (1:test_exception2 e), | |
150 | ||
151 | double derived1_function3( | |
152 | 1: string function3_arg1, | |
153 | 2: bool function3_arg2) throws (1:test_exception2 e), | |
154 | ||
155 | string derived1_function4( | |
156 | 1: string function4_arg1, | |
157 | 2: bool function4_arg2) throws (1:test_exception2 e), | |
158 | ||
159 | ||
160 | bool derived1_function5( | |
161 | 1: map<i64, double> function5_arg1, | |
162 | 2: map<string, bool> function5_arg2, | |
163 | 3: map<test_enum1, test_enum2> function5_arg3) throws (1:test_exception2 e), | |
164 | ||
165 | test_struct1 derived1_function6( | |
166 | 1: double function6_arg1) throws (1:test_exception2 e), | |
167 | } | |
168 | ||
169 | service derived2 extends base { | |
170 | ||
171 | list<i32> derived2_function1( | |
172 | 1: i32 function1_arg1) throws (1:test_exception2 e), | |
173 | ||
174 | list<test_enum1> derived2_function2( | |
175 | 1:i64 function2_arg2) throws (1:test_exception2 e), | |
176 | ||
177 | list<test_struct1> derived2_function3( | |
178 | 1:double function3_arg1) throws(1:test_exception2 e), | |
179 | ||
180 | map<double, string> derived2_function4( | |
181 | 1:string function4_arg1) throws(1:test_exception2 e), | |
182 | ||
183 | map<test_enum1, test_enum2> derived2_function5( | |
184 | 1:bool function5_arg1) throws(1:test_exception2 e), | |
185 | ||
186 | map<test_struct1, test_struct2> derived2_function6( | |
187 | 1:bool function6_arg1) throws(1:test_exception2 e), | |
188 | ||
189 | } |