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//break8 - requiredness addedd in struct5 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} 100 101struct test_struct5{ 102 1: double struct5_member1, 103 2: required string struct5_member2 = "Thrift Audit Test" 104} 105struct test_struct6 { 106 1: i32 struct6_member1, 107 2: required i32 struct6_member2 108} 109 110service base { 111 oneway void base_oneway( 112 1: i32 arg1), 113 114 void base_function1( 115 1: i16 function1_arg1, 116 2: i32 function1_arg2, 117 3: i64 function1_arg3, 118 4: double function1_arg4, 119 5: string function1_arg5, 120 6: bool function1_arg6, 121 7: test_enum1 function1_arg7, 122 8: test_struct1 function1_arg8), 123 124 void base_function2( 125 1: list<i16> function2_arg1, 126 2: list<i32> function2_arg2, 127 3: list<i64> function2_arg3, 128 4: list<double> function2_arg4, 129 5: list<string> function2_arg5, 130 6: list<bool> function2_arg6, 131 7: list<byte> function2_arg7, 132 8: list<test_enum1> function2_arg8, 133 9: list<test_struct1> function2_arg9) throws (1:test_exception2 e), 134 135 void base_function3(), 136 137} 138 139service derived1 extends base { 140 141 test_enum1 derived1_function1( 142 1: i64 function1_arg1, 143 2: double function1_arg2, 144 3: test_enum1 function1_arg3) throws (1:test_exception2 e), 145 146 i64 derived1_function2( 147 1: list<i64> function2_arg1, 148 2: list<double> function2_arg2, 149 3: list<string> function2_arg3, 150 4: list<byte> function2_arg4, 151 5: list<test_enum1> function2_arg5) throws (1:test_exception2 e), 152 153 double derived1_function3( 154 1: string function3_arg1, 155 2: bool function3_arg2) throws (1:test_exception2 e), 156 157 string derived1_function4( 158 1: string function4_arg1, 159 2: bool function4_arg2) throws (1:test_exception2 e), 160 161 162 bool derived1_function5( 163 1: map<i64, double> function5_arg1, 164 2: map<string, bool> function5_arg2, 165 3: map<test_enum1, test_enum2> function5_arg3) throws (1:test_exception2 e), 166 167 test_struct1 derived1_function6( 168 1: double function6_arg1) throws (1:test_exception2 e), 169} 170 171service derived2 extends base { 172 173 list<i32> derived2_function1( 174 1: i32 function1_arg1) throws (1:test_exception2 e), 175 176 list<test_enum1> derived2_function2( 177 1:i64 function2_arg2) throws (1:test_exception2 e), 178 179 list<test_struct1> derived2_function3( 180 1:double function3_arg1) throws(1:test_exception2 e), 181 182 map<double, string> derived2_function4( 183 1:string function4_arg1) throws(1:test_exception2 e), 184 185 map<test_enum1, test_enum2> derived2_function5( 186 1:bool function5_arg1) throws(1:test_exception2 e), 187 188 map<test_struct1, test_struct2> derived2_function6( 189 1:bool function6_arg1) throws(1:test_exception2 e), 190 191} 192