Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
ac477530
Commit
ac477530
authored
5 years ago
by
xujianhai666
Browse files
Options
Downloads
Patches
Plain Diff
add new client test
parent
c7d140d6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
protocol/grpc/client_test.go
+14
-1
14 additions, 1 deletion
protocol/grpc/client_test.go
protocol/grpc/common_test.go
+2
-2
2 additions, 2 deletions
protocol/grpc/common_test.go
protocol/grpc/grpc_protocol.go
+0
-1
0 additions, 1 deletion
protocol/grpc/grpc_protocol.go
with
16 additions
and
4 deletions
protocol/grpc/client_test.go
+
14
−
1
View file @
ac477530
...
@@ -18,16 +18,18 @@ limitations under the License.
...
@@ -18,16 +18,18 @@ limitations under the License.
package
grpc
package
grpc
import
(
import
(
"context"
"reflect"
"reflect"
"testing"
"testing"
)
)
import
(
import
(
"github.com/
bmizeran
y/assert"
"github.com/
stretchr/testif
y/assert"
"google.golang.org/grpc"
"google.golang.org/grpc"
)
)
import
(
import
(
"github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/protocol/grpc/internal"
"github.com/apache/dubbo-go/protocol/grpc/internal"
)
)
...
@@ -40,3 +42,14 @@ func TestGetInvoker(t *testing.T) {
...
@@ -40,3 +42,14 @@ func TestGetInvoker(t *testing.T) {
expected
:=
reflect
.
TypeOf
(
internal
.
NewGreeterClient
(
nil
))
expected
:=
reflect
.
TypeOf
(
internal
.
NewGreeterClient
(
nil
))
assert
.
Equal
(
t
,
i
,
expected
)
assert
.
Equal
(
t
,
i
,
expected
)
}
}
func
TestNewClient
(
t
*
testing
.
T
)
{
go
internal
.
InitGrpcServer
()
defer
internal
.
ShutdownGrpcServer
()
var
impl
*
internal
.
GrpcGreeterImpl
url
,
err
:=
common
.
NewURL
(
context
.
Background
(),
"grpc://127.0.0.1:20000/GrpcGreeterImpl?accesslog=&anyhost=true&app.version=0.0.1&application=BDTService&async=false&bean.name=GrpcGreeterImpl&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&execute.limit=&execute.limit.rejected.handler=&generic=false&group=&interface=io.grpc.examples.helloworld.GreeterGrpc%24IGreeter&ip=192.168.1.106&loadbalance=random&methods.SayHello.loadbalance=random&methods.SayHello.retries=1&methods.SayHello.tps.limit.interval=&methods.SayHello.tps.limit.rate=&methods.SayHello.tps.limit.strategy=&methods.SayHello.weight=0&module=dubbogo+say-hello+client&name=BDTService&organization=ikurento.com&owner=ZX&pid=49427&reference.filter=cshutdown®istry.role=3&remote.timestamp=1576923717&retries=&service.filter=echo%2Ctoken%2Caccesslog%2Ctps%2Cexecute%2Cpshutdown&side=provider×tamp=1576923740&tps.limit.interval=&tps.limit.rate=&tps.limit.rejected.handler=&tps.limit.strategy=&tps.limiter=&version=&warmup=100!"
)
assert
.
Nil
(
t
,
err
)
cli
:=
NewClient
(
impl
,
url
)
assert
.
NotNil
(
t
,
cli
)
}
This diff is collapsed.
Click to expand it.
protocol/grpc/common_test.go
+
2
−
2
View file @
ac477530
...
@@ -35,14 +35,14 @@ import (
...
@@ -35,14 +35,14 @@ import (
// userd grpc-dubbo biz service
// userd grpc-dubbo biz service
func
addService
()
{
func
addService
()
{
config
.
SetProviderService
(
N
ewGreeterProvider
())
config
.
SetProviderService
(
n
ewGreeterProvider
())
}
}
type
greeterProvider
struct
{
type
greeterProvider
struct
{
*
greeterProviderBase
*
greeterProviderBase
}
}
func
N
ewGreeterProvider
()
*
greeterProvider
{
func
n
ewGreeterProvider
()
*
greeterProvider
{
return
&
greeterProvider
{
return
&
greeterProvider
{
greeterProviderBase
:
&
greeterProviderBase
{},
greeterProviderBase
:
&
greeterProviderBase
{},
}
}
...
...
This diff is collapsed.
Click to expand it.
protocol/grpc/grpc_protocol.go
+
0
−
1
View file @
ac477530
...
@@ -49,7 +49,6 @@ func NewGRPCProtocol() *GrpcProtocol {
...
@@ -49,7 +49,6 @@ func NewGRPCProtocol() *GrpcProtocol {
}
}
}
}
// 缺少一个 type 信息, 无法进行binding
func
(
gp
*
GrpcProtocol
)
Export
(
invoker
protocol
.
Invoker
)
protocol
.
Exporter
{
func
(
gp
*
GrpcProtocol
)
Export
(
invoker
protocol
.
Invoker
)
protocol
.
Exporter
{
url
:=
invoker
.
GetUrl
()
url
:=
invoker
.
GetUrl
()
serviceKey
:=
url
.
ServiceKey
()
serviceKey
:=
url
.
ServiceKey
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment