Skip to content

Commit

Permalink
add triple integration test (apache#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin authored Jun 15, 2021
1 parent f7fa507 commit defcc32
Show file tree
Hide file tree
Showing 16 changed files with 774 additions and 59 deletions.
2 changes: 1 addition & 1 deletion general/dubbo3/hessian2/go-client/cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func main() {

gxlog.CInfo("\n\n\nstart to test dubbo")
user := &pkg.User{}
err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
err := userProvider.GetUser(context.TODO(), &pkg.User{Name: "laurence"} ,user)
if err != nil {
gxlog.CError("error: %v\n", err)
os.Exit(1)
Expand Down
2 changes: 1 addition & 1 deletion general/dubbo3/hessian2/go-client/pkg/hello.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type User struct {
}

type UserProvider struct {
GetUser func(ctx context.Context, req []interface{}, rsp *User) error
GetUser func(ctx context.Context, req *User, rsp *User) error
}

func (u *UserProvider) Reference() string {
Expand Down
2 changes: 1 addition & 1 deletion general/dubbo3/hessian2/go-server/conf/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ references:
registry: "demoZk"
protocol: "tri"
serialization: "hessian2"
interface: "org.apache.dubbo.UserProvider"
interface: "com.apache.dubbo.sample.basic.IGreeter"
6 changes: 3 additions & 3 deletions general/dubbo3/hessian2/go-server/pkg/greeter.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ type User struct {
type UserProvider struct {
}

func (u UserProvider) GetUser(ctx context.Context, req []interface{}) (*User, error) {
gxlog.CInfo("req:%#v", req)
rsp := User{"A001", "Alex Stocks", 18}
func (u *UserProvider) GetUser(ctx context.Context, usr *User) (*User, error) {
gxlog.CInfo("req:%#v", usr)
rsp := User{"12345", "" + usr.Name, 18}
gxlog.CInfo("rsp:%#v", rsp)
return &rsp, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,16 @@ type User struct {
ID string
Name string
Age int32
Time time.Time
}

type UserProvider struct {
GetUser func(ctx context.Context, req []interface{}, rsp *User) error
GetUser func(ctx context.Context, usr *User, rsp *User) error
}

func (u *UserProvider) Reference() string {
return "UserProvider"
}

func (User) JavaClassName() string {
return "org.apache.dubbo.User"
func (u User) JavaClassName() string {
return "com.apache.dubbo.sample.basic.User"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ import (

func TestGetUser(t *testing.T) {
user := &User{}
err := userProvider.GetUser(context.TODO(), []interface{}{"A001"}, user)
err := userProvider.GetUser(context.TODO(), &User{Name: "laurence"}, user)
assert.Nil(t, err)
assert.Equal(t, "A001", user.ID)
assert.Equal(t, "Alex Stocks", user.Name)
assert.Equal(t, "12345", user.ID)
assert.Equal(t, "laurence", user.Name)
assert.Equal(t, int32(18), user.Age)
assert.NotNil(t, user.Time)
}
78 changes: 39 additions & 39 deletions general/dubbo3/pb/dubbogo-grpc/protobuf/grpc/helloworld.proto
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
/*
* 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.
*/
syntax = "proto3";

option go_package = "protobuf/dubbo3";
package protobuf;

// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (User) {}
rpc SayHelloStream (stream HelloRequest) returns (stream User) {}
}

// The request message containing the user's name.
message HelloRequest {
string name = 1;
}

// The response message containing the greetings
message User {
string name = 1;
string id = 2;
int32 age = 3;
}
/*
* 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.
*/
syntax = "proto3";

option go_package = "protobuf/dubbo3";
package protobuf;

// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (User) {}
rpc SayHelloStream (stream HelloRequest) returns (stream User) {}
}

// The request message containing the user's name.
message HelloRequest {
string name = 1;
}

// The response message containing the greetings
message User {
string name = 1;
string id = 2;
int32 age = 3;
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: '3'

services:
zookeeper:
image: zookeeper
ports:
- 2181:2181
restart: on-failure

Loading

0 comments on commit defcc32

Please sign in to comment.