Skip to content

Commit

Permalink
update registry sample
Browse files Browse the repository at this point in the history
  • Loading branch information
chickenlj committed Nov 2, 2023
1 parent 61a49b7 commit 4d94e9d
Show file tree
Hide file tree
Showing 79 changed files with 969 additions and 5,429 deletions.
11 changes: 0 additions & 11 deletions .run/registry/registry-zookeeper-go-client.run.xml

This file was deleted.

11 changes: 0 additions & 11 deletions .run/registry/registry-zookeeper-go-server.run.xml

This file was deleted.

3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ require (
github.com/apache/dubbo-go-hessian2 v1.12.2
github.com/dubbogo/gost v1.14.0
github.com/dubbogo/grpc-go v1.42.10
github.com/dubbogo/tools v1.0.9 // indirect
github.com/dubbogo/triple v1.2.2-rc3
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.3
Expand All @@ -25,4 +24,6 @@ require (
google.golang.org/protobuf v1.31.0
)

replace dubbo.apache.org/dubbo-go/v3 => /Users/ken/aliware/dubbo3/golang/dubbo-go

go 1.15
148 changes: 4 additions & 144 deletions go.sum

Large diffs are not rendered by default.

51 changes: 6 additions & 45 deletions integrate_test/helloworld/tests/integration/helloworld_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,62 +19,23 @@ package integration

import (
"context"
"fmt"
greet "github.com/apache/dubbo-go-samples/helloworld/proto"
"testing"
)

import (
tripleConstant "github.com/dubbogo/triple/pkg/common/constant"

"github.com/stretchr/testify/assert"
)

import (
dubbo3pb "github.com/apache/dubbo-go-samples/api"
)

func TestStreamSayHello(t *testing.T) {
ctx := context.Background()
ctx = context.WithValue(ctx, tripleConstant.TripleCtxKey(tripleConstant.TripleRequestID), "triple-request-id-demo")
req := dubbo3pb.HelloRequest{
Name: "laurence",
}

r, err := greeterProvider.SayHelloStream(ctx)
assert.Nil(t, err)

for i := 0; i < 2; i++ {
err := r.Send(&req)
assert.Nil(t, err)
}

rspUser := &dubbo3pb.User{}
err = r.RecvMsg(rspUser)
assert.Nil(t, err)
assert.Equal(t, "hello laurence", rspUser.Name)
assert.Equal(t, "123456789", rspUser.Id)
assert.Equal(t, int32(18), rspUser.Age)

err = r.Send(&req)
assert.Nil(t, err)

err = r.RecvMsg(rspUser)
assert.Nil(t, err)
assert.Equal(t, "hello laurence", rspUser.Name)
assert.Equal(t, "123456789", rspUser.Id)
assert.Equal(t, int32(19), rspUser.Age)
}

func TestSayHello(t *testing.T) {
req := &dubbo3pb.HelloRequest{
Name: "laurence",
}
req := &greet.GreetRequest{Name: "hello world"}

ctx := context.Background()

reply, err := greeterProvider.SayHello(ctx, req)
reply, err := greeterProvider.Greet(ctx, req)

assert.Nil(t, err)
assert.Equal(t, "Hello laurence", reply.Name)
assert.Equal(t, "12345", reply.Id)
assert.Equal(t, int32(21), reply.Age)
assert.Equal(t, "hello world", reply.Greeting)
fmt.Sprint(reply.Greeting)
}
17 changes: 9 additions & 8 deletions integrate_test/helloworld/tests/integration/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,27 @@
package integration

import (
"dubbo.apache.org/dubbo-go/v3/client"
"github.com/apache/dubbo-go-samples/helloworld/proto/greettriple"
"os"
"testing"
)

import (
"dubbo.apache.org/dubbo-go/v3/config"
_ "dubbo.apache.org/dubbo-go/v3/imports"
)

import (
dubbo3pb "github.com/apache/dubbo-go-samples/api"
)

var greeterProvider = new(dubbo3pb.GreeterClientImpl)
var greeterProvider greettriple.GreetService

func TestMain(m *testing.M) {
config.SetConsumerService(greeterProvider)
if err := config.Load(); err != nil {
cli, err := client.NewClient(
client.WithURL("tri://127.0.0.1:20000"),
)
if err != nil {
panic(err)
}

greeterProvider, err = greettriple.NewGreetService(cli)

os.Exit(m.Run())
}

This file was deleted.

40 changes: 0 additions & 40 deletions integrate_test/registry/all/nacos/tests/integration/main_test.go

This file was deleted.

This file was deleted.

This file was deleted.

50 changes: 0 additions & 50 deletions integrate_test/registry/etcd/tests/integration/main_test.go

This file was deleted.

Loading

0 comments on commit 4d94e9d

Please sign in to comment.