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//break23 - required struct field added to struct4
21
22namespace cpp test
23
24//Constants
25const i32 const1 = 123;
26const double const2 = 23.3;
27const map<string,string> const3 = {"hello":"world", "thrift":"audit"};
28
29
30//Exception
31exception test_exception1 {
32    1: i32 code;
33    2: string json;
34}
35exception test_exception2 {
36    1: i32 code;
37    2: string json;
38}
39
40//Enums
41
42enum test_enum1 {
43    enum1_value0 = 0,
44    enum1_value1 = 1,
45    enum1_value2 = 2,
46    enum1_value5 = 5,
47    enum1_value7 = 7,
48    enum1_value8 = 8
49}
50
51enum test_enum2 {
52    enum2_value0 = 0,
53    enum2_value1 = 1,
54    enum2_value2 = 2,
55    enum2_value3 = 3
56}
57
58enum test_enum3 {
59    enum3_value1 = 0,
60    enum3_value2 = 1
61}
62
63struct test_struct1 {
64    1: i16 struct1_member1,
65    2: i32 struct1_member2,
66    3: i64 struct1_member3,
67    4: double struct1_member4 = 2.5,
68    5: string struct1_member5 = "Audit test",
69    6: bool struct1_member6,
70    7: byte struct1_member7,
71    8: binary struct1_member8,
72    9: test_enum1 struct1_member9
73}
74
75struct test_struct2 {
76    1: list<i16> struct2_member1,
77    2: list<i32> struct2_member2,
78    3: list<i64> struct2_member3 = [23, 32 ],
79    4: list<double> struct2_member4,
80    5: list<string> struct2_member5,
81    6: list<bool> struct2_member6,
82    7: list<byte> struct2_member7,
83    8: list<binary> struct2_member8,
84    9: list<test_enum1> struct2_member9
85}
86
87struct test_struct3 {
88    1: map<i16, i32> struct3_member1 = {1:2, 3:4},
89    2: map<i64, double> struct3_member2 = {10:1.1, 20:2.1},
90    3: map<string, bool> struct3_member3,
91    4: map<byte, test_enum1> struct3_member4,
92    5: map<test_enum2, test_enum3 > struct3_member5,
93    7: map<double, string> struct3_member7
94}
95
96struct test_struct4 {
97    1: i32 struct4_member1,
98    2: optional i32 struct4_member2,
99    3: required i64 struct4_member3
100}
101
102struct test_struct5{
103    1: double struct5_member1,
104    2: string struct5_member2 = "Thrift Audit Test"
105}
106struct test_struct6 {
107    1: i32 struct6_member1,
108    2: required i32 struct6_member2
109}
110
111service base {
112    oneway void base_oneway(
113        1: i32 arg1),
114
115    void base_function1(
116        1: i16 function1_arg1,
117        2: i32 function1_arg2,
118        3: i64 function1_arg3,
119        4: double function1_arg4,
120        5: string function1_arg5,
121        6: bool function1_arg6,
122        7: test_enum1 function1_arg7,
123        8: test_struct1 function1_arg8),
124
125    void base_function2(
126        1: list<i16> function2_arg1,
127        2: list<i32> function2_arg2,
128        3: list<i64> function2_arg3,
129        4: list<double> function2_arg4,
130        5: list<string> function2_arg5,
131        6: list<bool> function2_arg6,
132        7: list<byte> function2_arg7,
133        8: list<test_enum1> function2_arg8,
134        9: list<test_struct1> function2_arg9) throws (1:test_exception2 e),
135
136    void base_function3(),
137
138}
139
140service derived1 extends base {
141
142    test_enum1 derived1_function1(
143        1: i64 function1_arg1,
144        2: double function1_arg2,
145        3: test_enum1 function1_arg3) throws (1:test_exception2 e),
146
147    i64 derived1_function2(
148        1: list<i64> function2_arg1,
149        2: list<double> function2_arg2,
150        3: list<string> function2_arg3,
151        4: list<byte> function2_arg4,
152        5: list<test_enum1> function2_arg5) throws (1:test_exception2 e),
153
154    double derived1_function3(
155        1: string function3_arg1,
156        2: bool function3_arg2) throws (1:test_exception2 e),
157
158    string derived1_function4(
159        1: string function4_arg1,
160        2: bool function4_arg2) throws (1:test_exception2 e),
161
162
163    bool derived1_function5(
164        1: map<i64, double> function5_arg1,
165        2: map<string, bool> function5_arg2,
166        3: map<test_enum1, test_enum2> function5_arg3) throws (1:test_exception2 e),
167
168    test_struct1 derived1_function6(
169        1: double function6_arg1) throws (1:test_exception2 e),
170}
171
172service derived2 extends base {
173
174    list<i32> derived2_function1(
175        1: i32 function1_arg1) throws (1:test_exception2 e),
176
177    list<test_enum1> derived2_function2(
178        1:i64 function2_arg2) throws (1:test_exception2 e),
179
180    list<test_struct1> derived2_function3(
181        1:double function3_arg1) throws(1:test_exception2 e),
182
183    map<double, string> derived2_function4(
184        1:string function4_arg1) throws(1:test_exception2 e),
185
186    map<test_enum1, test_enum2> derived2_function5(
187        1:bool function5_arg1) throws(1:test_exception2 e),
188
189    map<test_struct1, test_struct2> derived2_function6(
190        1:bool function6_arg1) throws(1:test_exception2 e),
191
192}
193