From 0973fe0d4de71eace4d46cefe5297d0b8ba12199 Mon Sep 17 00:00:00 2001 From: yuxuanwang <464621663@qq.com> Date: Fri, 6 Oct 2023 22:13:11 +0800 Subject: [PATCH] feat: finish multiple parameters test --- tests/benchmark/deploy.sh | 4 +- .../crosstest/dubbo2kitex/dubbo_java_test.go | 7 + .../dubbo2kitex/multi_params_test.go | 111 ++ .../kitex2dubbo/multi_params_test.go | 199 +++ .../kitex2kitex/multi_params_test.go | 111 ++ tests/dubbo-go/api/api.go | 141 ++ tests/dubbo-java/README.md | 2 +- .../tests/api/EchoMultiBoolResponse.java | 30 + .../tests/api/EchoMultiByteResponse.java | 29 + .../tests/api/EchoMultiDoubleResponse.java | 29 + .../tests/api/EchoMultiInt16Response.java | 29 + .../tests/api/EchoMultiInt32Response.java | 29 + .../tests/api/EchoMultiInt64Response.java | 29 + .../tests/api/EchoMultiStringResponse.java | 29 + .../apache/dubbo/tests/api/UserProvider.java | 14 + .../dubbo/tests/client/Application.java | 154 ++- .../tests/provider/UserProviderImpl.java | 37 +- tests/kitex/api.thrift | 98 +- tests/kitex/handler.go | 63 + tests/kitex/kitex_gen/echo/api.go | 280 ++++ .../kitex_gen/echo/hessian2-register-api.go | 420 ++++++ tests/kitex/kitex_gen/echo/k-api.go | 1141 +++++++++++++++++ .../kitex_gen/echo/testservice/client.go | 42 + .../kitex_gen/echo/testservice/testservice.go | 217 ++++ .../kitex/kitex_gen/echo/testsuite/handler.go | 63 + 25 files changed, 3275 insertions(+), 33 deletions(-) create mode 100644 tests/crosstest/dubbo2kitex/multi_params_test.go create mode 100644 tests/crosstest/kitex2dubbo/multi_params_test.go create mode 100644 tests/crosstest/kitex2kitex/multi_params_test.go create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiBoolResponse.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiByteResponse.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiDoubleResponse.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt16Response.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt32Response.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt64Response.java create mode 100644 tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiStringResponse.java diff --git a/tests/benchmark/deploy.sh b/tests/benchmark/deploy.sh index fb948365..c472c2e0 100644 --- a/tests/benchmark/deploy.sh +++ b/tests/benchmark/deploy.sh @@ -78,7 +78,7 @@ client() { p=$2 go build -o "$p" . chmod +x "$p" - nohup ./"$p" "$3" "$4" "$5" "$6" >../client_log 2>&1 & + nohup ./"$p" "$3" "$4" "$5" "$6" >../../client_log 2>&1 & } server() { @@ -86,7 +86,7 @@ server() { p=$2 go build -o "$p" . chmod +x "$p" - nohup ./"$p" "$3" "$4" >../server_log 2>&1 & + nohup ./"$p" "$3" "$4" >../../server_log 2>&1 & } if test "$1" = "$stress_name"; diff --git a/tests/crosstest/dubbo2kitex/dubbo_java_test.go b/tests/crosstest/dubbo2kitex/dubbo_java_test.go index abb2f60e..9a60b8dd 100644 --- a/tests/crosstest/dubbo2kitex/dubbo_java_test.go +++ b/tests/crosstest/dubbo2kitex/dubbo_java_test.go @@ -141,6 +141,13 @@ func TestDubboJava(t *testing.T) { "EchoBool2DoubleMap": false, "EchoBool2StringMap": false, //"EchoBool2BinaryMap": false, + "EchoMultiBool": false, + //"EchoMultiByte": false, + //"EchoMultiInt16": false, + "EchoMultiInt32": false, + "EchoMultiInt64": false, + "EchoMultiDouble": false, + "EchoMultiString": false, }) for { line, err := reader.ReadString('\n') diff --git a/tests/crosstest/dubbo2kitex/multi_params_test.go b/tests/crosstest/dubbo2kitex/multi_params_test.go new file mode 100644 index 00000000..29b0982a --- /dev/null +++ b/tests/crosstest/dubbo2kitex/multi_params_test.go @@ -0,0 +1,111 @@ +/* + * Copyright 2023 CloudWeGo Authors + * + * 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. + */ + +package dubbo2kitex + +import ( + "context" + "testing" +) + +func TestEchoMultiBool(t *testing.T) { + baseReq := true + listReq := []bool{true, true} + mapReq := map[bool]bool{ + true: true, + } + resp, err := cli.EchoMultiBool(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +// hessian2.Decode does not support map[int8]int8 +//func TestEchoMultiByte(t *testing.T) { +// baseReq := int8(1) +// listReq := []int8{12, 34} +// mapReq := map[int8]int8{ +// 12: 34, +// } +// resp, err := cli.EchoMultiByte(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +// hessian2.Decode does not support map[int16]int16 +//func TestEchoMultiInt16(t *testing.T) { +// baseReq := int16(1) +// listReq := []int16{12, 34} +// mapReq := map[int16]int16{ +// 12: 34, +// } +// resp, err := cli.EchoMultiInt16(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +func TestEchoMultiInt32(t *testing.T) { + baseReq := int32(1) + listReq := []int32{12, 34} + mapReq := map[int32]int32{ + 12: 34, + } + resp, err := cli.EchoMultiInt32(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiInt64(t *testing.T) { + baseReq := int64(1) + listReq := []int64{12, 34} + mapReq := map[int64]int64{ + 12: 34, + } + resp, err := cli.EchoMultiInt64(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiDouble(t *testing.T) { + baseReq := 12.34 + listReq := []float64{12.34, 56.78} + mapReq := map[float64]float64{ + 12.34: 56.78, + } + resp, err := cli.EchoMultiDouble(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiString(t *testing.T) { + baseReq := "1" + listReq := []string{"12", "34"} + mapReq := map[string]string{ + "12": "34", + } + resp, err := cli.EchoMultiString(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} diff --git a/tests/crosstest/kitex2dubbo/multi_params_test.go b/tests/crosstest/kitex2dubbo/multi_params_test.go new file mode 100644 index 00000000..a23b5fb1 --- /dev/null +++ b/tests/crosstest/kitex2dubbo/multi_params_test.go @@ -0,0 +1,199 @@ +/* + * Copyright 2023 CloudWeGo Authors + * + * 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. + */ + +package kitex2dubbo + +// We have supported other map types (refer to /pkg/hessian2/response_test), +// but ReflectResponse in dubbo-go side could not support. As a result dubbo-go could not parse +// map types request correctly. + +// dubbo-go does not support Byte, Int16, ByteList and Int16List + +//func TestEchoMultiBool(t *testing.T) { +// baseReq := true +// listReq := []bool{true, true} +// mapReq := map[bool]bool{ +// true: true, +// } +// resp, err := cli2Go.EchoMultiBool(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiByte(t *testing.T) { +// baseReq := int8(1) +// listReq := []int8{12, 34} +// mapReq := map[int8]int8{ +// 12: 34, +// } +// resp, err := cli2Go.EchoMultiByte(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt16(t *testing.T) { +// baseReq := int16(1) +// listReq := []int16{12, 34} +// mapReq := map[int16]int16{ +// 12: 34, +// } +// resp, err := cli2Go.EchoMultiInt16(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt32(t *testing.T) { +// baseReq := int32(1) +// listReq := []int32{12, 34} +// mapReq := map[int32]int32{ +// 12: 34, +// } +// resp, err := cli2Go.EchoMultiInt32(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt64(t *testing.T) { +// baseReq := int64(1) +// listReq := []int64{12, 34} +// mapReq := map[int64]int64{ +// 12: 34, +// } +// resp, err := cli2Go.EchoMultiInt64(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiDouble(t *testing.T) { +// baseReq := 12.34 +// listReq := []float64{12.34, 56.78} +// mapReq := map[float64]float64{ +// 12.34: 56.78, +// } +// resp, err := cli2Go.EchoMultiDouble(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiString(t *testing.T) { +// baseReq := "1" +// listReq := []string{"12", "34"} +// mapReq := map[string]string{ +// "12": "34", +// } +// resp, err := cli2Go.EchoMultiString(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +// ----------kitex -> dubbo-java---------- + +// dubbo-go-hessian2 Encode can not produce correct types for List and Map. +// todo: improve hessian2 Encode + +//func TestEchoMultiBool_Java(t *testing.T) { +// baseReq := true +// listReq := []bool{true, true} +// mapReq := map[bool]bool{ +// true: true, +// } +// resp, err := cli2Java.EchoMultiBool(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiByte_Java(t *testing.T) { +// baseReq := int8(1) +// listReq := []int8{12, 34} +// mapReq := map[int8]int8{ +// 12: 34, +// } +// resp, err := cli2Java.EchoMultiByte(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt16_Java(t *testing.T) { +// baseReq := int16(1) +// listReq := []int16{12, 34} +// mapReq := map[int16]int16{ +// 12: 34, +// } +// resp, err := cli2Java.EchoMultiInt16(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt32_Java(t *testing.T) { +// baseReq := int32(1) +// listReq := []int32{12, 34} +// mapReq := map[int32]int32{ +// 12: 34, +// } +// resp, err := cli2Java.EchoMultiInt32(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiInt64_Java(t *testing.T) { +// baseReq := int64(1) +// listReq := []int64{12, 34} +// mapReq := map[int64]int64{ +// 12: 34, +// } +// resp, err := cli2Java.EchoMultiInt64(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiDouble_Java(t *testing.T) { +// baseReq := 12.34 +// listReq := []float64{12.34, 56.78} +// mapReq := map[float64]float64{ +// 12.34: 56.78, +// } +// resp, err := cli2Java.EchoMultiDouble(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +//func TestEchoMultiString_Java(t *testing.T) { +// baseReq := "1" +// listReq := []string{"12", "34"} +// mapReq := map[string]string{ +// "12": "34", +// } +// resp, err := cli2Java.EchoMultiString(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} diff --git a/tests/crosstest/kitex2kitex/multi_params_test.go b/tests/crosstest/kitex2kitex/multi_params_test.go new file mode 100644 index 00000000..2029440c --- /dev/null +++ b/tests/crosstest/kitex2kitex/multi_params_test.go @@ -0,0 +1,111 @@ +/* + * Copyright 2023 CloudWeGo Authors + * + * 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. + */ + +package kitex2kitex + +import ( + "context" + "testing" +) + +func TestEchoMultiBool(t *testing.T) { + baseReq := true + listReq := []bool{true, true} + mapReq := map[bool]bool{ + true: true, + } + resp, err := cli.EchoMultiBool(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +// hessian2.Decode does not support map[int8]int8 +//func TestEchoMultiByte(t *testing.T) { +// baseReq := int8(1) +// listReq := []int8{12, 34} +// mapReq := map[int8]int8{ +// 12: 34, +// } +// resp, err := cli.EchoMultiByte(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +// hessian2.Decode does not support map[int8]int8 +//func TestEchoMultiInt16(t *testing.T) { +// baseReq := int16(1) +// listReq := []int16{12, 34} +// mapReq := map[int16]int16{ +// 12: 34, +// } +// resp, err := cli.EchoMultiInt16(context.Background(), baseReq, listReq, mapReq) +// assertEcho(t, err, baseReq, resp.BaseResp) +// assertEcho(t, err, listReq, resp.ListResp) +// assertEcho(t, err, mapReq, resp.MapResp) +//} + +func TestEchoMultiInt32(t *testing.T) { + baseReq := int32(1) + listReq := []int32{12, 34} + mapReq := map[int32]int32{ + 12: 34, + } + resp, err := cli.EchoMultiInt32(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiInt64(t *testing.T) { + baseReq := int64(1) + listReq := []int64{12, 34} + mapReq := map[int64]int64{ + 12: 34, + } + resp, err := cli.EchoMultiInt64(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiDouble(t *testing.T) { + baseReq := 12.34 + listReq := []float64{12.34, 56.78} + mapReq := map[float64]float64{ + 12.34: 56.78, + } + resp, err := cli.EchoMultiDouble(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} + +func TestEchoMultiString(t *testing.T) { + baseReq := "1" + listReq := []string{"12", "34"} + mapReq := map[string]string{ + "12": "34", + } + resp, err := cli.EchoMultiString(context.Background(), baseReq, listReq, mapReq) + assertEcho(t, err, baseReq, resp.BaseResp) + assertEcho(t, err, listReq, resp.ListResp) + assertEcho(t, err, mapReq, resp.MapResp) +} diff --git a/tests/dubbo-go/api/api.go b/tests/dubbo-go/api/api.go index 5366ab79..1a94fdc1 100644 --- a/tests/dubbo-go/api/api.go +++ b/tests/dubbo-go/api/api.go @@ -41,6 +41,76 @@ func (u *User) JavaClassName() string { return "org.apache.dubbo.User" // Should be same as Java class name for java compatibility } +type EchoMultiBoolResponse struct { + BaseResp bool + ListResp []bool + MapResp map[bool]bool +} + +func (resp *EchoMultiBoolResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiBoolResponse" +} + +type EchoMultiByteResponse struct { + BaseResp int8 + ListResp []int8 + MapResp map[int8]int8 +} + +func (resp *EchoMultiByteResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiByteResponse" +} + +type EchoMultiInt16Response struct { + BaseResp int16 + ListResp []int16 + MapResp map[int16]int16 +} + +func (resp *EchoMultiInt16Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt16Response" +} + +type EchoMultiInt32Response struct { + BaseResp int32 + ListResp []int32 + MapResp map[int32]int32 +} + +func (resp *EchoMultiInt32Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt32Response" +} + +type EchoMultiInt64Response struct { + BaseResp int64 + ListResp []int64 + MapResp map[int64]int64 +} + +func (resp *EchoMultiInt64Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt64Response" +} + +type EchoMultiDoubleResponse struct { + BaseResp float64 + ListResp []float64 + MapResp map[float64]float64 +} + +func (resp *EchoMultiDoubleResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiDoubleResponse" +} + +type EchoMultiStringResponse struct { + BaseResp string + ListResp []string + MapResp map[string]string +} + +func (resp *EchoMultiStringResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiStringResponse" +} + var UserProviderClient = &UserProvider{} // client pointer // UserProvider client interface @@ -80,6 +150,14 @@ type UserProvider struct { EchoBool2DoubleMap func(ctx context.Context, req map[bool]float64) (map[bool]float64, error) //`dubbo:"echoBool2DoubleMap"` EchoBool2StringMap func(ctx context.Context, req map[bool]string) (map[bool]string, error) //`dubbo:"echoBool2StringMap"` EchoBool2BinaryMap func(ctx context.Context, req map[bool][]byte) (map[bool][]byte, error) //`dubbo:"echoBool2BinaryMap"` + + EchoMultiBool func(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (*EchoMultiBoolResponse, error) //`dubbo:"echoMultiBool"` + EchoMultiByte func(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (*EchoMultiByteResponse, error) //`dubbo:"echoMultiByte"` + EchoMultiInt16 func(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (*EchoMultiInt16Response, error) //`dubbo:"echoMultiInt16"` + EchoMultiInt32 func(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (*EchoMultiInt32Response, error) //`dubbo:"echoMultiInt32"` + EchoMultiInt64 func(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (*EchoMultiInt64Response, error) //`dubbo:"echoMultiInt64"` + EchoMultiDouble func(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (*EchoMultiDoubleResponse, error) //`dubbo:"echoMultiDouble"` + EchoMultiString func(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (*EchoMultiStringResponse, error) //`dubbo:"echoMultiString"` } type UserProviderImpl struct{} @@ -213,6 +291,62 @@ func (u *UserProviderImpl) EchoBool2BinaryListMap(ctx context.Context, req map[b return req, nil } +func (u *UserProviderImpl) EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (*EchoMultiBoolResponse, error) { + return &EchoMultiBoolResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (*EchoMultiByteResponse, error) { + return &EchoMultiByteResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (*EchoMultiInt16Response, error) { + return &EchoMultiInt16Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (*EchoMultiInt32Response, error) { + return &EchoMultiInt32Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (*EchoMultiInt64Response, error) { + return &EchoMultiInt64Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (*EchoMultiDoubleResponse, error) { + return &EchoMultiDoubleResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +func (u *UserProviderImpl) EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (*EchoMultiStringResponse, error) { + return &EchoMultiStringResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + // GetUser implements the interface func (u *UserProviderImpl) GetUser(ctx context.Context, req int32) (*User, error) { var err error @@ -249,6 +383,13 @@ func (u *UserProviderImpl) EchoByte(ctx context.Context, req int8) (int8, error) func init() { hessian.RegisterPOJO(&User{}) // Register all transmission struct to hessian lib + hessian.RegisterPOJO(&EchoMultiBoolResponse{}) + hessian.RegisterPOJO(&EchoMultiByteResponse{}) + hessian.RegisterPOJO(&EchoMultiInt16Response{}) + hessian.RegisterPOJO(&EchoMultiInt32Response{}) + hessian.RegisterPOJO(&EchoMultiInt64Response{}) + hessian.RegisterPOJO(&EchoMultiDoubleResponse{}) + hessian.RegisterPOJO(&EchoMultiStringResponse{}) // Register client interface to the framework config.SetConsumerService(UserProviderClient) } diff --git a/tests/dubbo-java/README.md b/tests/dubbo-java/README.md index d228f9ee..4b7b3344 100644 --- a/tests/dubbo-java/README.md +++ b/tests/dubbo-java/README.md @@ -1,6 +1,6 @@ # About this directory -This code is used for crosstest between dubbo and kitex. It is under developing. +This code is used for crosstest between dubbo and kitex. ## Start the service consumer diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiBoolResponse.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiBoolResponse.java new file mode 100644 index 00000000..7c6478e0 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiBoolResponse.java @@ -0,0 +1,30 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiBoolResponse implements Serializable { + boolean baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiBoolResponse(boolean baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public boolean getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} + diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiByteResponse.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiByteResponse.java new file mode 100644 index 00000000..01408af4 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiByteResponse.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiByteResponse implements Serializable { + byte baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiByteResponse(byte baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public byte getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiDoubleResponse.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiDoubleResponse.java new file mode 100644 index 00000000..817879d1 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiDoubleResponse.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiDoubleResponse implements Serializable { + double baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiDoubleResponse(double baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public double getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt16Response.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt16Response.java new file mode 100644 index 00000000..7c7d08d2 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt16Response.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiInt16Response implements Serializable { + short baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiInt16Response(short baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public short getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt32Response.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt32Response.java new file mode 100644 index 00000000..cda8f7a8 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt32Response.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiInt32Response implements Serializable { + int baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiInt32Response(int baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public int getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt64Response.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt64Response.java new file mode 100644 index 00000000..c2a677d6 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiInt64Response.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiInt64Response implements Serializable { + long baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiInt64Response(long baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public long getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiStringResponse.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiStringResponse.java new file mode 100644 index 00000000..fb8c4522 --- /dev/null +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/EchoMultiStringResponse.java @@ -0,0 +1,29 @@ +package org.apache.dubbo.tests.api; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + +public class EchoMultiStringResponse implements Serializable { + String baseResp; + ArrayList listResp; + HashMap mapResp; + + public EchoMultiStringResponse(String baseResp, ArrayList listResp, HashMap mapResp) { + this.baseResp = baseResp; + this.listResp = listResp; + this.mapResp = mapResp; + } + + public String getBaseResp() { + return baseResp; + } + + public ArrayList getListResp() { + return listResp; + } + + public HashMap getMapResp() { + return mapResp; + } +} diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/UserProvider.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/UserProvider.java index f336344c..479578f5 100644 --- a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/UserProvider.java +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/api/UserProvider.java @@ -74,4 +74,18 @@ public interface UserProvider { HashMap EchoBool2StringMap(HashMap req) throws Exception; HashMap EchoBool2BinaryMap(HashMap req) throws Exception; + + EchoMultiBoolResponse EchoMultiBool(boolean baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiByteResponse EchoMultiByte(byte baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiInt16Response EchoMultiInt16(short baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiInt32Response EchoMultiInt32(int baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiInt64Response EchoMultiInt64(long baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiDoubleResponse EchoMultiDouble(double baseReq, ArrayList listReq, HashMap mapReq) throws Exception; + + EchoMultiStringResponse EchoMultiString(String baseReq, ArrayList listReq, HashMap mapReq) throws Exception; } \ No newline at end of file diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/client/Application.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/client/Application.java index f9631b25..19877364 100644 --- a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/client/Application.java +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/client/Application.java @@ -26,7 +26,7 @@ import org.apache.dubbo.config.ReferenceConfig; import org.apache.dubbo.config.bootstrap.DubboBootstrap; -import org.apache.dubbo.tests.api.UserProvider; +import org.apache.dubbo.tests.api.*; public class Application { public static void main(String[] args) throws IOException { @@ -43,6 +43,7 @@ public static void main(String[] args) throws IOException { testBaseTypes(service); testContainerListType(service); testContainerMapType(service); + testMultiParams(service); } public static void logEchoFail(String methodName) { @@ -90,6 +91,16 @@ public static void testContainerMapType(UserProvider svc) { testEchoBool2BinaryMap(svc); } + public static void testMultiParams(UserProvider svc) { + testEchoMultiBool(svc); + testEchoMultiByte(svc); + testEchoMultiInt16(svc); + testEchoMultiInt32(svc); + testEchoMultiInt64(svc); + testEchoMultiDouble(svc); + testEchoMultiString(svc); + } + public static void testEchoBool(UserProvider svc) { String methodName = "EchoBool"; try { @@ -221,7 +232,7 @@ public static void testEchoByteList(UserProvider svc) { String methodName = "EchoByteList"; try { ArrayList req = new ArrayList<>(); - req.add((byte)12); + req.add((byte) 12); ArrayList resp = svc.EchoByteList(req); if (!req.equals(resp)) { logEchoFail(methodName); @@ -236,7 +247,7 @@ public static void testEchoInt16List(UserProvider svc) { String methodName = "EchoInt16List"; try { ArrayList req = new ArrayList<>(); - req.add((short)12); + req.add((short) 12); ArrayList resp = svc.EchoInt16List(req); if (!req.equals(resp)) { logEchoFail(methodName); @@ -266,7 +277,7 @@ public static void testEchoInt64List(UserProvider svc) { String methodName = "EchoInt64List"; try { ArrayList req = new ArrayList<>(); - req.add((long)12); + req.add((long) 12); ArrayList resp = svc.EchoInt64List(req); if (!req.equals(resp)) { logEchoFail(methodName); @@ -387,7 +398,7 @@ public static void testEchoBool2Int64Map(UserProvider svc) { String methodName = "EchoBool2Int64Map"; try { HashMap req = new HashMap<>(); - req.put(true, (long)1); + req.put(true, (long) 1); HashMap resp = svc.EchoBool2Int64Map(req); if (!req.equals(resp)) { logEchoFail(methodName); @@ -443,4 +454,137 @@ public static void testEchoBool2BinaryMap(UserProvider svc) { } logEchoEnd(methodName); } + + public static void testEchoMultiBool(UserProvider svc) { + String methodName = "EchoMultiBool"; + try { + boolean baseReq = true; + ArrayList listReq = new ArrayList<>(); + listReq.add(true); + listReq.add(true); + HashMap mapReq = new HashMap<>(); + mapReq.put(true, true); + EchoMultiBoolResponse resp = svc.EchoMultiBool(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiByte(UserProvider svc) { + String methodName = "EchoMultiByte"; + try { + byte baseReq = 1; + ArrayList listReq = new ArrayList<>(); + listReq.add((byte) 12); + listReq.add((byte) 34); + HashMap mapReq = new HashMap<>(); + mapReq.put((byte) 12, (byte) 34); + EchoMultiByteResponse resp = svc.EchoMultiByte(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiInt16(UserProvider svc) { + String methodName = "EchoMultiInt16"; + try { + short baseReq = 1; + ArrayList listReq = new ArrayList<>(); + listReq.add((short) 12); + listReq.add((short) 34); + HashMap mapReq = new HashMap<>(); + mapReq.put((short) 12, (short) 34); + EchoMultiInt16Response resp = svc.EchoMultiInt16(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiInt32(UserProvider svc) { + String methodName = "EchoMultiInt32"; + try { + int baseReq = 1; + ArrayList listReq = new ArrayList<>(); + listReq.add(12); + listReq.add(34); + HashMap mapReq = new HashMap<>(); + mapReq.put(12, 34); + EchoMultiInt32Response resp = svc.EchoMultiInt32(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiInt64(UserProvider svc) { + String methodName = "EchoMultiInt64"; + try { + long baseReq = 1; + ArrayList listReq = new ArrayList<>(); + listReq.add((long) 12); + listReq.add((long) 34); + HashMap mapReq = new HashMap<>(); + mapReq.put((long) 12, (long) 34); + EchoMultiInt64Response resp = svc.EchoMultiInt64(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiDouble(UserProvider svc) { + String methodName = "EchoMultiDouble"; + try { + double baseReq = 12.34; + ArrayList listReq = new ArrayList<>(); + listReq.add(12.34); + listReq.add(56.78); + HashMap mapReq = new HashMap<>(); + mapReq.put(12.34, 56.78); + EchoMultiDoubleResponse resp = svc.EchoMultiDouble(baseReq, listReq, mapReq); + if (baseReq != resp.getBaseResp() || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } + + public static void testEchoMultiString(UserProvider svc) { + String methodName = "EchoMultiString"; + try { + String baseReq = "1"; + ArrayList listReq = new ArrayList<>(); + listReq.add("12"); + listReq.add("34"); + HashMap mapReq = new HashMap<>(); + mapReq.put("12", "34"); + EchoMultiStringResponse resp = svc.EchoMultiString(baseReq, listReq, mapReq); + if (!baseReq.equals(resp.getBaseResp()) || !listReq.equals(resp.getListResp()) || !mapReq.equals(resp.getMapResp())) { + logEchoFail(methodName); + } + } catch (Exception e) { + logEchoException(methodName, e); + } + logEchoEnd(methodName); + } } \ No newline at end of file diff --git a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/provider/UserProviderImpl.java b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/provider/UserProviderImpl.java index 633ca8ab..d829790f 100644 --- a/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/provider/UserProviderImpl.java +++ b/tests/dubbo-java/src/main/java/org/apache/dubbo/tests/provider/UserProviderImpl.java @@ -19,7 +19,7 @@ package org.apache.dubbo.tests.provider; -import org.apache.dubbo.tests.api.UserProvider; +import org.apache.dubbo.tests.api.*; import java.util.HashMap; import java.util.ArrayList; @@ -154,4 +154,39 @@ public HashMap EchoBool2StringMap(HashMap req) public HashMap EchoBool2BinaryMap(HashMap req) throws Exception { return req; } + + @Override + public EchoMultiBoolResponse EchoMultiBool(boolean baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiBoolResponse(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiByteResponse EchoMultiByte(byte baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiByteResponse(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiInt16Response EchoMultiInt16(short baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiInt16Response(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiInt32Response EchoMultiInt32(int baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiInt32Response(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiInt64Response EchoMultiInt64(long baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiInt64Response(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiDoubleResponse EchoMultiDouble(double baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiDoubleResponse(baseReq, listReq, mapReq); + } + + @Override + public EchoMultiStringResponse EchoMultiString(String baseReq, ArrayList listReq, HashMap mapReq) throws Exception { + return new EchoMultiStringResponse(baseReq, listReq, mapReq); + } } \ No newline at end of file diff --git a/tests/kitex/api.thrift b/tests/kitex/api.thrift index 84a02b69..bac71428 100644 --- a/tests/kitex/api.thrift +++ b/tests/kitex/api.thrift @@ -8,6 +8,48 @@ struct EchoResponse { 1: required i32 int32, }(JavaClassName="kitex.echo.EchoResponse") +struct EchoMultiBoolResponse { + 1: required bool baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiBoolResponse") + +struct EchoMultiByteResponse { + 1: required byte baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiByteResponse") + +struct EchoMultiInt16Response { + 1: required i16 baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiInt16Response") + +struct EchoMultiInt32Response { + 1: required i32 baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiInt32Response") + +struct EchoMultiInt64Response { + 1: required i64 baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiInt64Response") + +struct EchoMultiDoubleResponse { + 1: required double baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiDoubleResponse") + +struct EchoMultiStringResponse { + 1: required string baseResp, + 2: required list listResp, + 3: required map mapResp, +}(JavaClassName="org.apache.dubbo.tests.api.EchoMultiStringResponse") + service TestService { i32 EchoInt(1: i32 req) @@ -27,30 +69,38 @@ service TestService { EchoResponse Echo(1: EchoRequest req) // container list - list EchoBoolList(1: listreq) - list EchoByteList(1: listreq) - list EchoInt16List(1: listreq) - list EchoInt32List(1: listreq) - list EchoInt64List(1: listreq) - list EchoDoubleList(1: listreq) - list EchoStringList(1: listreq) - list EchoBinaryList(1: listreq) + list EchoBoolList(1: list req) + list EchoByteList(1: list req) + list EchoInt16List(1: list req) + list EchoInt32List(1: list req) + list EchoInt64List(1: list req) + list EchoDoubleList(1: list req) + list EchoStringList(1: list req) + list EchoBinaryList(1: list req) // container map - map EchoBool2BoolMap(1: mapreq) - map EchoBool2ByteMap(1: mapreq) - map EchoBool2Int16Map(1: mapreq) - map EchoBool2Int32Map(1: mapreq) - map EchoBool2Int64Map(1: mapreq) - map EchoBool2DoubleMap(1: mapreq) - map EchoBool2StringMap(1: mapreq) - map EchoBool2BinaryMap(1: mapreq) - map> EchoBool2BoolListMap(1: map>req) - map> EchoBool2ByteListMap(1: map>req) - map> EchoBool2Int16ListMap(1: map>req) - map> EchoBool2Int32ListMap(1: map>req) - map> EchoBool2Int64ListMap(1: map>req) - map> EchoBool2DoubleListMap(1: map>req) - map> EchoBool2StringListMap(1: map>req) - map> EchoBool2BinaryListMap(1: map>req) + map EchoBool2BoolMap(1: map req) + map EchoBool2ByteMap(1: map req) + map EchoBool2Int16Map(1: map req) + map EchoBool2Int32Map(1: map req) + map EchoBool2Int64Map(1: map req) + map EchoBool2DoubleMap(1: map req) + map EchoBool2StringMap(1: map req) + map EchoBool2BinaryMap(1: map req) + map> EchoBool2BoolListMap(1: map> req) + map> EchoBool2ByteListMap(1: map> req) + map> EchoBool2Int16ListMap(1: map> req) + map> EchoBool2Int32ListMap(1: map> req) + map> EchoBool2Int64ListMap(1: map> req) + map> EchoBool2DoubleListMap(1: map> req) + map> EchoBool2StringListMap(1: map> req) + map> EchoBool2BinaryListMap(1: map> req) + + EchoMultiBoolResponse EchoMultiBool(1: bool baseReq, 2: list listReq, 3: map mapReq) + EchoMultiByteResponse EchoMultiByte(1: byte baseReq, 2: list listReq, 3: map mapReq) + EchoMultiInt16Response EchoMultiInt16(1: i16 baseReq, 2: list listReq, 3: map mapReq) + EchoMultiInt32Response EchoMultiInt32(1: i32 baseReq, 2: list listReq, 3: map mapReq) + EchoMultiInt64Response EchoMultiInt64(1: i64 baseReq, 2: list listReq, 3: map mapReq) + EchoMultiDoubleResponse EchoMultiDouble(1: double baseReq, 2: list listReq, 3: map mapReq) + EchoMultiStringResponse EchoMultiString(1: string baseReq, 2: list listReq, 3: map mapReq) }(JavaClassName="org.apache.dubbo.tests.api.UserProvider") diff --git a/tests/kitex/handler.go b/tests/kitex/handler.go index b777adb2..9593869e 100644 --- a/tests/kitex/handler.go +++ b/tests/kitex/handler.go @@ -184,3 +184,66 @@ func (s *TestServiceImpl) EchoBool2StringListMap(ctx context.Context, req map[bo func (s *TestServiceImpl) EchoBool2BinaryListMap(ctx context.Context, req map[bool][][]byte) (resp map[bool][][]byte, err error) { return req, nil } + +// EchoMultiBool implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (resp *echo.EchoMultiBoolResponse, err error) { + return &echo.EchoMultiBoolResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiByte implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (resp *echo.EchoMultiByteResponse, err error) { + return &echo.EchoMultiByteResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt16 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (resp *echo.EchoMultiInt16Response, err error) { + return &echo.EchoMultiInt16Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt32 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (resp *echo.EchoMultiInt32Response, err error) { + return &echo.EchoMultiInt32Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt64 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (resp *echo.EchoMultiInt64Response, err error) { + return &echo.EchoMultiInt64Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiDouble implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (resp *echo.EchoMultiDoubleResponse, err error) { + return &echo.EchoMultiDoubleResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiString implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (resp *echo.EchoMultiStringResponse, err error) { + return &echo.EchoMultiStringResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} diff --git a/tests/kitex/kitex_gen/echo/api.go b/tests/kitex/kitex_gen/echo/api.go index 96cd9899..68fc3128 100644 --- a/tests/kitex/kitex_gen/echo/api.go +++ b/tests/kitex/kitex_gen/echo/api.go @@ -51,6 +51,272 @@ func (p *EchoResponse) String() string { return fmt.Sprintf("EchoResponse(%+v)", *p) } +type EchoMultiBoolResponse struct { + BaseResp bool `thrift:"baseResp,1,required" frugal:"1,required,bool" json:"baseResp"` + ListResp []bool `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[bool]bool `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiBoolResponse() *EchoMultiBoolResponse { + return &EchoMultiBoolResponse{} +} + +func (p *EchoMultiBoolResponse) GetBaseResp() (v bool) { + return p.BaseResp +} + +func (p *EchoMultiBoolResponse) GetListResp() (v []bool) { + return p.ListResp +} + +func (p *EchoMultiBoolResponse) GetMapResp() (v map[bool]bool) { + return p.MapResp +} +func (p *EchoMultiBoolResponse) SetBaseResp(val bool) { + p.BaseResp = val +} +func (p *EchoMultiBoolResponse) SetListResp(val []bool) { + p.ListResp = val +} +func (p *EchoMultiBoolResponse) SetMapResp(val map[bool]bool) { + p.MapResp = val +} + +func (p *EchoMultiBoolResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiBoolResponse(%+v)", *p) +} + +type EchoMultiByteResponse struct { + BaseResp int8 `thrift:"baseResp,1,required" frugal:"1,required,byte" json:"baseResp"` + ListResp []int8 `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[int8]int8 `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiByteResponse() *EchoMultiByteResponse { + return &EchoMultiByteResponse{} +} + +func (p *EchoMultiByteResponse) GetBaseResp() (v int8) { + return p.BaseResp +} + +func (p *EchoMultiByteResponse) GetListResp() (v []int8) { + return p.ListResp +} + +func (p *EchoMultiByteResponse) GetMapResp() (v map[int8]int8) { + return p.MapResp +} +func (p *EchoMultiByteResponse) SetBaseResp(val int8) { + p.BaseResp = val +} +func (p *EchoMultiByteResponse) SetListResp(val []int8) { + p.ListResp = val +} +func (p *EchoMultiByteResponse) SetMapResp(val map[int8]int8) { + p.MapResp = val +} + +func (p *EchoMultiByteResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiByteResponse(%+v)", *p) +} + +type EchoMultiInt16Response struct { + BaseResp int16 `thrift:"baseResp,1,required" frugal:"1,required,i16" json:"baseResp"` + ListResp []int16 `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[int16]int16 `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiInt16Response() *EchoMultiInt16Response { + return &EchoMultiInt16Response{} +} + +func (p *EchoMultiInt16Response) GetBaseResp() (v int16) { + return p.BaseResp +} + +func (p *EchoMultiInt16Response) GetListResp() (v []int16) { + return p.ListResp +} + +func (p *EchoMultiInt16Response) GetMapResp() (v map[int16]int16) { + return p.MapResp +} +func (p *EchoMultiInt16Response) SetBaseResp(val int16) { + p.BaseResp = val +} +func (p *EchoMultiInt16Response) SetListResp(val []int16) { + p.ListResp = val +} +func (p *EchoMultiInt16Response) SetMapResp(val map[int16]int16) { + p.MapResp = val +} + +func (p *EchoMultiInt16Response) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiInt16Response(%+v)", *p) +} + +type EchoMultiInt32Response struct { + BaseResp int32 `thrift:"baseResp,1,required" frugal:"1,required,i32" json:"baseResp"` + ListResp []int32 `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[int32]int32 `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiInt32Response() *EchoMultiInt32Response { + return &EchoMultiInt32Response{} +} + +func (p *EchoMultiInt32Response) GetBaseResp() (v int32) { + return p.BaseResp +} + +func (p *EchoMultiInt32Response) GetListResp() (v []int32) { + return p.ListResp +} + +func (p *EchoMultiInt32Response) GetMapResp() (v map[int32]int32) { + return p.MapResp +} +func (p *EchoMultiInt32Response) SetBaseResp(val int32) { + p.BaseResp = val +} +func (p *EchoMultiInt32Response) SetListResp(val []int32) { + p.ListResp = val +} +func (p *EchoMultiInt32Response) SetMapResp(val map[int32]int32) { + p.MapResp = val +} + +func (p *EchoMultiInt32Response) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiInt32Response(%+v)", *p) +} + +type EchoMultiInt64Response struct { + BaseResp int64 `thrift:"baseResp,1,required" frugal:"1,required,i64" json:"baseResp"` + ListResp []int64 `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[int64]int64 `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiInt64Response() *EchoMultiInt64Response { + return &EchoMultiInt64Response{} +} + +func (p *EchoMultiInt64Response) GetBaseResp() (v int64) { + return p.BaseResp +} + +func (p *EchoMultiInt64Response) GetListResp() (v []int64) { + return p.ListResp +} + +func (p *EchoMultiInt64Response) GetMapResp() (v map[int64]int64) { + return p.MapResp +} +func (p *EchoMultiInt64Response) SetBaseResp(val int64) { + p.BaseResp = val +} +func (p *EchoMultiInt64Response) SetListResp(val []int64) { + p.ListResp = val +} +func (p *EchoMultiInt64Response) SetMapResp(val map[int64]int64) { + p.MapResp = val +} + +func (p *EchoMultiInt64Response) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiInt64Response(%+v)", *p) +} + +type EchoMultiDoubleResponse struct { + BaseResp float64 `thrift:"baseResp,1,required" frugal:"1,required,double" json:"baseResp"` + ListResp []float64 `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[float64]float64 `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiDoubleResponse() *EchoMultiDoubleResponse { + return &EchoMultiDoubleResponse{} +} + +func (p *EchoMultiDoubleResponse) GetBaseResp() (v float64) { + return p.BaseResp +} + +func (p *EchoMultiDoubleResponse) GetListResp() (v []float64) { + return p.ListResp +} + +func (p *EchoMultiDoubleResponse) GetMapResp() (v map[float64]float64) { + return p.MapResp +} +func (p *EchoMultiDoubleResponse) SetBaseResp(val float64) { + p.BaseResp = val +} +func (p *EchoMultiDoubleResponse) SetListResp(val []float64) { + p.ListResp = val +} +func (p *EchoMultiDoubleResponse) SetMapResp(val map[float64]float64) { + p.MapResp = val +} + +func (p *EchoMultiDoubleResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiDoubleResponse(%+v)", *p) +} + +type EchoMultiStringResponse struct { + BaseResp string `thrift:"baseResp,1,required" frugal:"1,required,string" json:"baseResp"` + ListResp []string `thrift:"listResp,2,required" frugal:"2,required,list" json:"listResp"` + MapResp map[string]string `thrift:"mapResp,3,required" frugal:"3,required,map" json:"mapResp"` +} + +func NewEchoMultiStringResponse() *EchoMultiStringResponse { + return &EchoMultiStringResponse{} +} + +func (p *EchoMultiStringResponse) GetBaseResp() (v string) { + return p.BaseResp +} + +func (p *EchoMultiStringResponse) GetListResp() (v []string) { + return p.ListResp +} + +func (p *EchoMultiStringResponse) GetMapResp() (v map[string]string) { + return p.MapResp +} +func (p *EchoMultiStringResponse) SetBaseResp(val string) { + p.BaseResp = val +} +func (p *EchoMultiStringResponse) SetListResp(val []string) { + p.ListResp = val +} +func (p *EchoMultiStringResponse) SetMapResp(val map[string]string) { + p.MapResp = val +} + +func (p *EchoMultiStringResponse) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("EchoMultiStringResponse(%+v)", *p) +} + type TestService interface { EchoInt(ctx context.Context, req int32) (r int32, err error) @@ -119,4 +385,18 @@ type TestService interface { EchoBool2StringListMap(ctx context.Context, req map[bool][]string) (r map[bool][]string, err error) EchoBool2BinaryListMap(ctx context.Context, req map[bool][][]byte) (r map[bool][][]byte, err error) + + EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (r *EchoMultiBoolResponse, err error) + + EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (r *EchoMultiByteResponse, err error) + + EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (r *EchoMultiInt16Response, err error) + + EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (r *EchoMultiInt32Response, err error) + + EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (r *EchoMultiInt64Response, err error) + + EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (r *EchoMultiDoubleResponse, err error) + + EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (r *EchoMultiStringResponse, err error) } diff --git a/tests/kitex/kitex_gen/echo/hessian2-register-api.go b/tests/kitex/kitex_gen/echo/hessian2-register-api.go index 056e20c7..ae2cd70c 100644 --- a/tests/kitex/kitex_gen/echo/hessian2-register-api.go +++ b/tests/kitex/kitex_gen/echo/hessian2-register-api.go @@ -11,6 +11,13 @@ import ( var objectsApi = []interface{}{ &EchoRequest{}, &EchoResponse{}, + &EchoMultiBoolResponse{}, + &EchoMultiByteResponse{}, + &EchoMultiInt16Response{}, + &EchoMultiInt32Response{}, + &EchoMultiInt64Response{}, + &EchoMultiDoubleResponse{}, + &EchoMultiStringResponse{}, } func init() { @@ -78,3 +85,416 @@ func (p *EchoResponse) Decode(d codec.Decoder) error { func (p *EchoResponse) JavaClassName() string { return "kitex.echo.EchoResponse" } + +func (p *EchoMultiBoolResponse) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiBoolResponse) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiBoolResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiBoolResponse" +} + +func (p *EchoMultiByteResponse) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiByteResponse) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiByteResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiByteResponse" +} + +func (p *EchoMultiInt16Response) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiInt16Response) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiInt16Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt16Response" +} + +func (p *EchoMultiInt32Response) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiInt32Response) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiInt32Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt32Response" +} + +func (p *EchoMultiInt64Response) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiInt64Response) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiInt64Response) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiInt64Response" +} + +func (p *EchoMultiDoubleResponse) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiDoubleResponse) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiDoubleResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiDoubleResponse" +} + +func (p *EchoMultiStringResponse) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseResp) + if err != nil { + return err + } + + err = e.Encode(p.ListResp) + if err != nil { + return err + } + + err = e.Encode(p.MapResp) + if err != nil { + return err + } + + return nil +} + +func (p *EchoMultiStringResponse) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapResp) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +func (p *EchoMultiStringResponse) JavaClassName() string { + return "org.apache.dubbo.tests.api.EchoMultiStringResponse" +} diff --git a/tests/kitex/kitex_gen/echo/k-api.go b/tests/kitex/kitex_gen/echo/k-api.go index 6667ef79..0e0c6065 100644 --- a/tests/kitex/kitex_gen/echo/k-api.go +++ b/tests/kitex/kitex_gen/echo/k-api.go @@ -4078,3 +4078,1144 @@ func (p *TestServiceEchoBool2BinaryListMapResult) Decode(d codec.Decoder) error return nil } + +type TestServiceEchoMultiBoolArgs struct { + BaseReq bool `thrift:"baseReq,1" frugal:"1,default,bool" json:"baseReq"` + ListReq []bool `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[bool]bool `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiBoolArgs() *TestServiceEchoMultiBoolArgs { + return &TestServiceEchoMultiBoolArgs{} +} + +func (p *TestServiceEchoMultiBoolArgs) InitDefault() { + *p = TestServiceEchoMultiBoolArgs{} +} + +func (p *TestServiceEchoMultiBoolArgs) GetBaseReq() (v bool) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiBoolArgs) GetListReq() (v []bool) { + return p.ListReq +} + +func (p *TestServiceEchoMultiBoolArgs) GetMapReq() (v map[bool]bool) { + return p.MapReq +} +func (p *TestServiceEchoMultiBoolArgs) SetBaseReq(val bool) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiBoolArgs) SetListReq(val []bool) { + p.ListReq = val +} +func (p *TestServiceEchoMultiBoolArgs) SetMapReq(val map[bool]bool) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiBoolArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiBoolArgs(%+v)", *p) +} +func (p *TestServiceEchoMultiBoolArgs) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiBoolArgs) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiBoolArgs) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiBoolResult struct { + Success *EchoMultiBoolResponse `thrift:"success,0,optional" frugal:"0,optional,EchoMultiBoolResponse" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiBoolResult() *TestServiceEchoMultiBoolResult { + return &TestServiceEchoMultiBoolResult{} +} + +func (p *TestServiceEchoMultiBoolResult) InitDefault() { + *p = TestServiceEchoMultiBoolResult{} +} + +var TestServiceEchoMultiBoolResult_Success_DEFAULT *EchoMultiBoolResponse + +func (p *TestServiceEchoMultiBoolResult) GetSuccess() (v *EchoMultiBoolResponse) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiBoolResult_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiBoolResult) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiBoolResponse) +} + +func (p *TestServiceEchoMultiBoolResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiBoolResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiBoolResult(%+v)", *p) +} +func (p *TestServiceEchoMultiBoolResult) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiBoolResult) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiBoolResult) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiByteArgs struct { + BaseReq int8 `thrift:"baseReq,1" frugal:"1,default,byte" json:"baseReq"` + ListReq []int8 `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[int8]int8 `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiByteArgs() *TestServiceEchoMultiByteArgs { + return &TestServiceEchoMultiByteArgs{} +} + +func (p *TestServiceEchoMultiByteArgs) InitDefault() { + *p = TestServiceEchoMultiByteArgs{} +} + +func (p *TestServiceEchoMultiByteArgs) GetBaseReq() (v int8) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiByteArgs) GetListReq() (v []int8) { + return p.ListReq +} + +func (p *TestServiceEchoMultiByteArgs) GetMapReq() (v map[int8]int8) { + return p.MapReq +} +func (p *TestServiceEchoMultiByteArgs) SetBaseReq(val int8) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiByteArgs) SetListReq(val []int8) { + p.ListReq = val +} +func (p *TestServiceEchoMultiByteArgs) SetMapReq(val map[int8]int8) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiByteArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiByteArgs(%+v)", *p) +} +func (p *TestServiceEchoMultiByteArgs) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiByteArgs) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiByteArgs) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiByteResult struct { + Success *EchoMultiByteResponse `thrift:"success,0,optional" frugal:"0,optional,EchoMultiByteResponse" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiByteResult() *TestServiceEchoMultiByteResult { + return &TestServiceEchoMultiByteResult{} +} + +func (p *TestServiceEchoMultiByteResult) InitDefault() { + *p = TestServiceEchoMultiByteResult{} +} + +var TestServiceEchoMultiByteResult_Success_DEFAULT *EchoMultiByteResponse + +func (p *TestServiceEchoMultiByteResult) GetSuccess() (v *EchoMultiByteResponse) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiByteResult_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiByteResult) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiByteResponse) +} + +func (p *TestServiceEchoMultiByteResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiByteResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiByteResult(%+v)", *p) +} +func (p *TestServiceEchoMultiByteResult) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiByteResult) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiByteResult) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt16Args struct { + BaseReq int16 `thrift:"baseReq,1" frugal:"1,default,i16" json:"baseReq"` + ListReq []int16 `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[int16]int16 `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiInt16Args() *TestServiceEchoMultiInt16Args { + return &TestServiceEchoMultiInt16Args{} +} + +func (p *TestServiceEchoMultiInt16Args) InitDefault() { + *p = TestServiceEchoMultiInt16Args{} +} + +func (p *TestServiceEchoMultiInt16Args) GetBaseReq() (v int16) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiInt16Args) GetListReq() (v []int16) { + return p.ListReq +} + +func (p *TestServiceEchoMultiInt16Args) GetMapReq() (v map[int16]int16) { + return p.MapReq +} +func (p *TestServiceEchoMultiInt16Args) SetBaseReq(val int16) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiInt16Args) SetListReq(val []int16) { + p.ListReq = val +} +func (p *TestServiceEchoMultiInt16Args) SetMapReq(val map[int16]int16) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiInt16Args) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt16Args(%+v)", *p) +} +func (p *TestServiceEchoMultiInt16Args) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiInt16Args) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt16Args) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt16Result struct { + Success *EchoMultiInt16Response `thrift:"success,0,optional" frugal:"0,optional,EchoMultiInt16Response" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiInt16Result() *TestServiceEchoMultiInt16Result { + return &TestServiceEchoMultiInt16Result{} +} + +func (p *TestServiceEchoMultiInt16Result) InitDefault() { + *p = TestServiceEchoMultiInt16Result{} +} + +var TestServiceEchoMultiInt16Result_Success_DEFAULT *EchoMultiInt16Response + +func (p *TestServiceEchoMultiInt16Result) GetSuccess() (v *EchoMultiInt16Response) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiInt16Result_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiInt16Result) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiInt16Response) +} + +func (p *TestServiceEchoMultiInt16Result) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiInt16Result) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt16Result(%+v)", *p) +} +func (p *TestServiceEchoMultiInt16Result) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiInt16Result) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt16Result) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt32Args struct { + BaseReq int32 `thrift:"baseReq,1" frugal:"1,default,i32" json:"baseReq"` + ListReq []int32 `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[int32]int32 `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiInt32Args() *TestServiceEchoMultiInt32Args { + return &TestServiceEchoMultiInt32Args{} +} + +func (p *TestServiceEchoMultiInt32Args) InitDefault() { + *p = TestServiceEchoMultiInt32Args{} +} + +func (p *TestServiceEchoMultiInt32Args) GetBaseReq() (v int32) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiInt32Args) GetListReq() (v []int32) { + return p.ListReq +} + +func (p *TestServiceEchoMultiInt32Args) GetMapReq() (v map[int32]int32) { + return p.MapReq +} +func (p *TestServiceEchoMultiInt32Args) SetBaseReq(val int32) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiInt32Args) SetListReq(val []int32) { + p.ListReq = val +} +func (p *TestServiceEchoMultiInt32Args) SetMapReq(val map[int32]int32) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiInt32Args) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt32Args(%+v)", *p) +} +func (p *TestServiceEchoMultiInt32Args) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiInt32Args) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt32Args) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt32Result struct { + Success *EchoMultiInt32Response `thrift:"success,0,optional" frugal:"0,optional,EchoMultiInt32Response" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiInt32Result() *TestServiceEchoMultiInt32Result { + return &TestServiceEchoMultiInt32Result{} +} + +func (p *TestServiceEchoMultiInt32Result) InitDefault() { + *p = TestServiceEchoMultiInt32Result{} +} + +var TestServiceEchoMultiInt32Result_Success_DEFAULT *EchoMultiInt32Response + +func (p *TestServiceEchoMultiInt32Result) GetSuccess() (v *EchoMultiInt32Response) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiInt32Result_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiInt32Result) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiInt32Response) +} + +func (p *TestServiceEchoMultiInt32Result) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiInt32Result) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt32Result(%+v)", *p) +} +func (p *TestServiceEchoMultiInt32Result) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiInt32Result) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt32Result) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt64Args struct { + BaseReq int64 `thrift:"baseReq,1" frugal:"1,default,i64" json:"baseReq"` + ListReq []int64 `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[int64]int64 `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiInt64Args() *TestServiceEchoMultiInt64Args { + return &TestServiceEchoMultiInt64Args{} +} + +func (p *TestServiceEchoMultiInt64Args) InitDefault() { + *p = TestServiceEchoMultiInt64Args{} +} + +func (p *TestServiceEchoMultiInt64Args) GetBaseReq() (v int64) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiInt64Args) GetListReq() (v []int64) { + return p.ListReq +} + +func (p *TestServiceEchoMultiInt64Args) GetMapReq() (v map[int64]int64) { + return p.MapReq +} +func (p *TestServiceEchoMultiInt64Args) SetBaseReq(val int64) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiInt64Args) SetListReq(val []int64) { + p.ListReq = val +} +func (p *TestServiceEchoMultiInt64Args) SetMapReq(val map[int64]int64) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiInt64Args) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt64Args(%+v)", *p) +} +func (p *TestServiceEchoMultiInt64Args) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiInt64Args) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt64Args) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiInt64Result struct { + Success *EchoMultiInt64Response `thrift:"success,0,optional" frugal:"0,optional,EchoMultiInt64Response" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiInt64Result() *TestServiceEchoMultiInt64Result { + return &TestServiceEchoMultiInt64Result{} +} + +func (p *TestServiceEchoMultiInt64Result) InitDefault() { + *p = TestServiceEchoMultiInt64Result{} +} + +var TestServiceEchoMultiInt64Result_Success_DEFAULT *EchoMultiInt64Response + +func (p *TestServiceEchoMultiInt64Result) GetSuccess() (v *EchoMultiInt64Response) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiInt64Result_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiInt64Result) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiInt64Response) +} + +func (p *TestServiceEchoMultiInt64Result) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiInt64Result) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiInt64Result(%+v)", *p) +} +func (p *TestServiceEchoMultiInt64Result) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiInt64Result) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiInt64Result) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiDoubleArgs struct { + BaseReq float64 `thrift:"baseReq,1" frugal:"1,default,double" json:"baseReq"` + ListReq []float64 `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[float64]float64 `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiDoubleArgs() *TestServiceEchoMultiDoubleArgs { + return &TestServiceEchoMultiDoubleArgs{} +} + +func (p *TestServiceEchoMultiDoubleArgs) InitDefault() { + *p = TestServiceEchoMultiDoubleArgs{} +} + +func (p *TestServiceEchoMultiDoubleArgs) GetBaseReq() (v float64) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiDoubleArgs) GetListReq() (v []float64) { + return p.ListReq +} + +func (p *TestServiceEchoMultiDoubleArgs) GetMapReq() (v map[float64]float64) { + return p.MapReq +} +func (p *TestServiceEchoMultiDoubleArgs) SetBaseReq(val float64) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiDoubleArgs) SetListReq(val []float64) { + p.ListReq = val +} +func (p *TestServiceEchoMultiDoubleArgs) SetMapReq(val map[float64]float64) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiDoubleArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiDoubleArgs(%+v)", *p) +} +func (p *TestServiceEchoMultiDoubleArgs) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiDoubleArgs) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiDoubleArgs) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiDoubleResult struct { + Success *EchoMultiDoubleResponse `thrift:"success,0,optional" frugal:"0,optional,EchoMultiDoubleResponse" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiDoubleResult() *TestServiceEchoMultiDoubleResult { + return &TestServiceEchoMultiDoubleResult{} +} + +func (p *TestServiceEchoMultiDoubleResult) InitDefault() { + *p = TestServiceEchoMultiDoubleResult{} +} + +var TestServiceEchoMultiDoubleResult_Success_DEFAULT *EchoMultiDoubleResponse + +func (p *TestServiceEchoMultiDoubleResult) GetSuccess() (v *EchoMultiDoubleResponse) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiDoubleResult_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiDoubleResult) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiDoubleResponse) +} + +func (p *TestServiceEchoMultiDoubleResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiDoubleResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiDoubleResult(%+v)", *p) +} +func (p *TestServiceEchoMultiDoubleResult) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiDoubleResult) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiDoubleResult) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiStringArgs struct { + BaseReq string `thrift:"baseReq,1" frugal:"1,default,string" json:"baseReq"` + ListReq []string `thrift:"listReq,2" frugal:"2,default,list" json:"listReq"` + MapReq map[string]string `thrift:"mapReq,3" frugal:"3,default,map" json:"mapReq"` +} + +func NewTestServiceEchoMultiStringArgs() *TestServiceEchoMultiStringArgs { + return &TestServiceEchoMultiStringArgs{} +} + +func (p *TestServiceEchoMultiStringArgs) InitDefault() { + *p = TestServiceEchoMultiStringArgs{} +} + +func (p *TestServiceEchoMultiStringArgs) GetBaseReq() (v string) { + return p.BaseReq +} + +func (p *TestServiceEchoMultiStringArgs) GetListReq() (v []string) { + return p.ListReq +} + +func (p *TestServiceEchoMultiStringArgs) GetMapReq() (v map[string]string) { + return p.MapReq +} +func (p *TestServiceEchoMultiStringArgs) SetBaseReq(val string) { + p.BaseReq = val +} +func (p *TestServiceEchoMultiStringArgs) SetListReq(val []string) { + p.ListReq = val +} +func (p *TestServiceEchoMultiStringArgs) SetMapReq(val map[string]string) { + p.MapReq = val +} + +func (p *TestServiceEchoMultiStringArgs) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiStringArgs(%+v)", *p) +} +func (p *TestServiceEchoMultiStringArgs) GetFirstArgument() interface{} { + return p.BaseReq +} +func (p *TestServiceEchoMultiStringArgs) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.BaseReq) + if err != nil { + return err + } + + err = e.Encode(p.ListReq) + if err != nil { + return err + } + + err = e.Encode(p.MapReq) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiStringArgs) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.BaseReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.ListReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.MapReq) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} + +type TestServiceEchoMultiStringResult struct { + Success *EchoMultiStringResponse `thrift:"success,0,optional" frugal:"0,optional,EchoMultiStringResponse" json:"success,omitempty"` +} + +func NewTestServiceEchoMultiStringResult() *TestServiceEchoMultiStringResult { + return &TestServiceEchoMultiStringResult{} +} + +func (p *TestServiceEchoMultiStringResult) InitDefault() { + *p = TestServiceEchoMultiStringResult{} +} + +var TestServiceEchoMultiStringResult_Success_DEFAULT *EchoMultiStringResponse + +func (p *TestServiceEchoMultiStringResult) GetSuccess() (v *EchoMultiStringResponse) { + if !p.IsSetSuccess() { + return TestServiceEchoMultiStringResult_Success_DEFAULT + } + return p.Success +} +func (p *TestServiceEchoMultiStringResult) SetSuccess(x interface{}) { + p.Success = x.(*EchoMultiStringResponse) +} + +func (p *TestServiceEchoMultiStringResult) IsSetSuccess() bool { + return p.Success != nil +} + +func (p *TestServiceEchoMultiStringResult) String() string { + if p == nil { + return "" + } + return fmt.Sprintf("TestServiceEchoMultiStringResult(%+v)", *p) +} +func (p *TestServiceEchoMultiStringResult) GetResult() interface{} { + return p.Success +} +func (p *TestServiceEchoMultiStringResult) Encode(e codec.Encoder) error { + var err error + err = e.Encode(p.Success) + if err != nil { + return err + } + + return nil +} + +func (p *TestServiceEchoMultiStringResult) Decode(d codec.Decoder) error { + var ( + err error + v interface{} + ) + v, err = d.Decode() + if err != nil { + return err + } + err = hessian2.ReflectResponse(v, &p.Success) + if err != nil { + return errors.Wrap(err, fmt.Sprintf("invalid data type: %T", v)) + } + + return nil +} diff --git a/tests/kitex/kitex_gen/echo/testservice/client.go b/tests/kitex/kitex_gen/echo/testservice/client.go index 4350be62..60d9590d 100644 --- a/tests/kitex/kitex_gen/echo/testservice/client.go +++ b/tests/kitex/kitex_gen/echo/testservice/client.go @@ -45,6 +45,13 @@ type Client interface { EchoBool2DoubleListMap(ctx context.Context, req map[bool][]float64, callOptions ...callopt.Option) (r map[bool][]float64, err error) EchoBool2StringListMap(ctx context.Context, req map[bool][]string, callOptions ...callopt.Option) (r map[bool][]string, err error) EchoBool2BinaryListMap(ctx context.Context, req map[bool][][]byte, callOptions ...callopt.Option) (r map[bool][][]byte, err error) + EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool, callOptions ...callopt.Option) (r *echo.EchoMultiBoolResponse, err error) + EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8, callOptions ...callopt.Option) (r *echo.EchoMultiByteResponse, err error) + EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16, callOptions ...callopt.Option) (r *echo.EchoMultiInt16Response, err error) + EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32, callOptions ...callopt.Option) (r *echo.EchoMultiInt32Response, err error) + EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64, callOptions ...callopt.Option) (r *echo.EchoMultiInt64Response, err error) + EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64, callOptions ...callopt.Option) (r *echo.EchoMultiDoubleResponse, err error) + EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string, callOptions ...callopt.Option) (r *echo.EchoMultiStringResponse, err error) } // NewClient creates a client for the service defined in IDL. @@ -245,3 +252,38 @@ func (p *kTestServiceClient) EchoBool2BinaryListMap(ctx context.Context, req map ctx = client.NewCtxWithCallOptions(ctx, callOptions) return p.kClient.EchoBool2BinaryListMap(ctx, req) } + +func (p *kTestServiceClient) EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool, callOptions ...callopt.Option) (r *echo.EchoMultiBoolResponse, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiBool(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8, callOptions ...callopt.Option) (r *echo.EchoMultiByteResponse, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiByte(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16, callOptions ...callopt.Option) (r *echo.EchoMultiInt16Response, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiInt16(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32, callOptions ...callopt.Option) (r *echo.EchoMultiInt32Response, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiInt32(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64, callOptions ...callopt.Option) (r *echo.EchoMultiInt64Response, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiInt64(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64, callOptions ...callopt.Option) (r *echo.EchoMultiDoubleResponse, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiDouble(ctx, baseReq, listReq, mapReq) +} + +func (p *kTestServiceClient) EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string, callOptions ...callopt.Option) (r *echo.EchoMultiStringResponse, err error) { + ctx = client.NewCtxWithCallOptions(ctx, callOptions) + return p.kClient.EchoMultiString(ctx, baseReq, listReq, mapReq) +} diff --git a/tests/kitex/kitex_gen/echo/testservice/testservice.go b/tests/kitex/kitex_gen/echo/testservice/testservice.go index f0171af8..53c18bbb 100644 --- a/tests/kitex/kitex_gen/echo/testservice/testservice.go +++ b/tests/kitex/kitex_gen/echo/testservice/testservice.go @@ -53,6 +53,13 @@ func NewServiceInfo() *kitex.ServiceInfo { "EchoBool2DoubleListMap": kitex.NewMethodInfo(echoBool2DoubleListMapHandler, newTestServiceEchoBool2DoubleListMapArgs, newTestServiceEchoBool2DoubleListMapResult, false), "EchoBool2StringListMap": kitex.NewMethodInfo(echoBool2StringListMapHandler, newTestServiceEchoBool2StringListMapArgs, newTestServiceEchoBool2StringListMapResult, false), "EchoBool2BinaryListMap": kitex.NewMethodInfo(echoBool2BinaryListMapHandler, newTestServiceEchoBool2BinaryListMapArgs, newTestServiceEchoBool2BinaryListMapResult, false), + "EchoMultiBool": kitex.NewMethodInfo(echoMultiBoolHandler, newTestServiceEchoMultiBoolArgs, newTestServiceEchoMultiBoolResult, false), + "EchoMultiByte": kitex.NewMethodInfo(echoMultiByteHandler, newTestServiceEchoMultiByteArgs, newTestServiceEchoMultiByteResult, false), + "EchoMultiInt16": kitex.NewMethodInfo(echoMultiInt16Handler, newTestServiceEchoMultiInt16Args, newTestServiceEchoMultiInt16Result, false), + "EchoMultiInt32": kitex.NewMethodInfo(echoMultiInt32Handler, newTestServiceEchoMultiInt32Args, newTestServiceEchoMultiInt32Result, false), + "EchoMultiInt64": kitex.NewMethodInfo(echoMultiInt64Handler, newTestServiceEchoMultiInt64Args, newTestServiceEchoMultiInt64Result, false), + "EchoMultiDouble": kitex.NewMethodInfo(echoMultiDoubleHandler, newTestServiceEchoMultiDoubleArgs, newTestServiceEchoMultiDoubleResult, false), + "EchoMultiString": kitex.NewMethodInfo(echoMultiStringHandler, newTestServiceEchoMultiStringArgs, newTestServiceEchoMultiStringResult, false), } extra := map[string]interface{}{ "PackageName": "echo", @@ -684,6 +691,132 @@ func newTestServiceEchoBool2BinaryListMapResult() interface{} { return echo.NewTestServiceEchoBool2BinaryListMapResult() } +func echoMultiBoolHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiBoolArgs) + realResult := result.(*echo.TestServiceEchoMultiBoolResult) + success, err := handler.(echo.TestService).EchoMultiBool(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiBoolArgs() interface{} { + return echo.NewTestServiceEchoMultiBoolArgs() +} + +func newTestServiceEchoMultiBoolResult() interface{} { + return echo.NewTestServiceEchoMultiBoolResult() +} + +func echoMultiByteHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiByteArgs) + realResult := result.(*echo.TestServiceEchoMultiByteResult) + success, err := handler.(echo.TestService).EchoMultiByte(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiByteArgs() interface{} { + return echo.NewTestServiceEchoMultiByteArgs() +} + +func newTestServiceEchoMultiByteResult() interface{} { + return echo.NewTestServiceEchoMultiByteResult() +} + +func echoMultiInt16Handler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiInt16Args) + realResult := result.(*echo.TestServiceEchoMultiInt16Result) + success, err := handler.(echo.TestService).EchoMultiInt16(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiInt16Args() interface{} { + return echo.NewTestServiceEchoMultiInt16Args() +} + +func newTestServiceEchoMultiInt16Result() interface{} { + return echo.NewTestServiceEchoMultiInt16Result() +} + +func echoMultiInt32Handler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiInt32Args) + realResult := result.(*echo.TestServiceEchoMultiInt32Result) + success, err := handler.(echo.TestService).EchoMultiInt32(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiInt32Args() interface{} { + return echo.NewTestServiceEchoMultiInt32Args() +} + +func newTestServiceEchoMultiInt32Result() interface{} { + return echo.NewTestServiceEchoMultiInt32Result() +} + +func echoMultiInt64Handler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiInt64Args) + realResult := result.(*echo.TestServiceEchoMultiInt64Result) + success, err := handler.(echo.TestService).EchoMultiInt64(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiInt64Args() interface{} { + return echo.NewTestServiceEchoMultiInt64Args() +} + +func newTestServiceEchoMultiInt64Result() interface{} { + return echo.NewTestServiceEchoMultiInt64Result() +} + +func echoMultiDoubleHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiDoubleArgs) + realResult := result.(*echo.TestServiceEchoMultiDoubleResult) + success, err := handler.(echo.TestService).EchoMultiDouble(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiDoubleArgs() interface{} { + return echo.NewTestServiceEchoMultiDoubleArgs() +} + +func newTestServiceEchoMultiDoubleResult() interface{} { + return echo.NewTestServiceEchoMultiDoubleResult() +} + +func echoMultiStringHandler(ctx context.Context, handler interface{}, arg, result interface{}) error { + realArg := arg.(*echo.TestServiceEchoMultiStringArgs) + realResult := result.(*echo.TestServiceEchoMultiStringResult) + success, err := handler.(echo.TestService).EchoMultiString(ctx, realArg.BaseReq, realArg.ListReq, realArg.MapReq) + if err != nil { + return err + } + realResult.Success = success + return nil +} +func newTestServiceEchoMultiStringArgs() interface{} { + return echo.NewTestServiceEchoMultiStringArgs() +} + +func newTestServiceEchoMultiStringResult() interface{} { + return echo.NewTestServiceEchoMultiStringResult() +} + type kClient struct { c client.Client } @@ -1033,3 +1166,87 @@ func (p *kClient) EchoBool2BinaryListMap(ctx context.Context, req map[bool][][]b } return _result.GetSuccess(), nil } + +func (p *kClient) EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (r *echo.EchoMultiBoolResponse, err error) { + var _args echo.TestServiceEchoMultiBoolArgs + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiBoolResult + if err = p.c.Call(ctx, "EchoMultiBool", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (r *echo.EchoMultiByteResponse, err error) { + var _args echo.TestServiceEchoMultiByteArgs + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiByteResult + if err = p.c.Call(ctx, "EchoMultiByte", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (r *echo.EchoMultiInt16Response, err error) { + var _args echo.TestServiceEchoMultiInt16Args + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiInt16Result + if err = p.c.Call(ctx, "EchoMultiInt16", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (r *echo.EchoMultiInt32Response, err error) { + var _args echo.TestServiceEchoMultiInt32Args + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiInt32Result + if err = p.c.Call(ctx, "EchoMultiInt32", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (r *echo.EchoMultiInt64Response, err error) { + var _args echo.TestServiceEchoMultiInt64Args + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiInt64Result + if err = p.c.Call(ctx, "EchoMultiInt64", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (r *echo.EchoMultiDoubleResponse, err error) { + var _args echo.TestServiceEchoMultiDoubleArgs + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiDoubleResult + if err = p.c.Call(ctx, "EchoMultiDouble", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} + +func (p *kClient) EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (r *echo.EchoMultiStringResponse, err error) { + var _args echo.TestServiceEchoMultiStringArgs + _args.BaseReq = baseReq + _args.ListReq = listReq + _args.MapReq = mapReq + var _result echo.TestServiceEchoMultiStringResult + if err = p.c.Call(ctx, "EchoMultiString", &_args, &_result); err != nil { + return + } + return _result.GetSuccess(), nil +} diff --git a/tests/kitex/kitex_gen/echo/testsuite/handler.go b/tests/kitex/kitex_gen/echo/testsuite/handler.go index 24480597..3d6b9a5d 100644 --- a/tests/kitex/kitex_gen/echo/testsuite/handler.go +++ b/tests/kitex/kitex_gen/echo/testsuite/handler.go @@ -184,3 +184,66 @@ func (s *TestServiceImpl) EchoBool2StringListMap(ctx context.Context, req map[bo func (s *TestServiceImpl) EchoBool2BinaryListMap(ctx context.Context, req map[bool][][]byte) (resp map[bool][][]byte, err error) { return req, nil } + +// EchoMultiBool implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiBool(ctx context.Context, baseReq bool, listReq []bool, mapReq map[bool]bool) (resp *echo.EchoMultiBoolResponse, err error) { + return &echo.EchoMultiBoolResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiByte implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiByte(ctx context.Context, baseReq int8, listReq []int8, mapReq map[int8]int8) (resp *echo.EchoMultiByteResponse, err error) { + return &echo.EchoMultiByteResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt16 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt16(ctx context.Context, baseReq int16, listReq []int16, mapReq map[int16]int16) (resp *echo.EchoMultiInt16Response, err error) { + return &echo.EchoMultiInt16Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt32 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt32(ctx context.Context, baseReq int32, listReq []int32, mapReq map[int32]int32) (resp *echo.EchoMultiInt32Response, err error) { + return &echo.EchoMultiInt32Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiInt64 implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiInt64(ctx context.Context, baseReq int64, listReq []int64, mapReq map[int64]int64) (resp *echo.EchoMultiInt64Response, err error) { + return &echo.EchoMultiInt64Response{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiDouble implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiDouble(ctx context.Context, baseReq float64, listReq []float64, mapReq map[float64]float64) (resp *echo.EchoMultiDoubleResponse, err error) { + return &echo.EchoMultiDoubleResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +} + +// EchoMultiString implements the TestServiceImpl interface. +func (s *TestServiceImpl) EchoMultiString(ctx context.Context, baseReq string, listReq []string, mapReq map[string]string) (resp *echo.EchoMultiStringResponse, err error) { + return &echo.EchoMultiStringResponse{ + BaseResp: baseReq, + ListResp: listReq, + MapResp: mapReq, + }, nil +}