Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
fangyincheng committed Dec 8, 2020
1 parent c7fd69a commit c593464
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions common/rpc_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ func TestServiceMapRegister(t *testing.T) {

// repeat
_, err = ServiceMap.Register(testInterfaceName, "testporotocol", "", "v1", s)
assert.EqualError(t, err, "service already defined: com.test.Path")
assert.EqualError(t, err, "service already defined: testService:v1")

// no method
s1 := &TestService1{}
_, err = ServiceMap.Register(testInterfaceName, "testporotocol", "", "v2", s1)
assert.EqualError(t, err, "type com.test.Path1 has no exported methods of suitable type")
assert.EqualError(t, err, "type testService:v2 has no exported methods of suitable type")

ServiceMap = &serviceMap{
serviceMap: make(map[string]map[string]*Service),
Expand Down
2 changes: 1 addition & 1 deletion filter/filter_impl/generic_service_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func TestGenericServiceFilterInvoke(t *testing.T) {
hessian.Object("222")},
}
s := &TestService{}
_, _ = common.ServiceMap.Register("TestService", "testprotocol", "", "", s)
_, _ = common.ServiceMap.Register("com.test.Path", "testprotocol", "", "", s)
rpcInvocation := invocation.NewRPCInvocation(methodName, aurguments, nil)
filter := GetGenericServiceFilter()
url, _ := common.NewURL("testprotocol://127.0.0.1:20000/com.test.Path")
Expand Down
2 changes: 1 addition & 1 deletion metadata/service/exporter/configurable/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestConfigurableExporter(t *testing.T) {
assert.Equal(t, false, exported.IsExported())
assert.NoError(t, exported.Export(registryURL))
assert.Equal(t, true, exported.IsExported())
assert.Regexp(t, "dubbo://:20003/MetadataService*", exported.GetExportedURLs()[0].String())
assert.Regexp(t, "dubbo://:20003/org.apache.dubbo.metadata.MetadataService*", exported.GetExportedURLs()[0].String())
exported.Unexport()
assert.Equal(t, false, exported.IsExported())
})
Expand Down
2 changes: 1 addition & 1 deletion protocol/dubbo/dubbo_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func InitTest(t *testing.T) (protocol.Protocol, *common.URL) {

hessian.RegisterPOJO(&User{})

methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", "", "0.0.1", &UserProvider{})
methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", "", "", &UserProvider{})
assert.NoError(t, err)
assert.Equal(t, "GetBigPkg,GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4,GetUser5,GetUser6", methods)

Expand Down
4 changes: 2 additions & 2 deletions protocol/jsonrpc/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ type (
)

const (
mockJsonCommonUrl = "jsonrpc://127.0.0.1:20001/UserProvider?anyhost=true&" +
mockJsonCommonUrl = "jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&" +
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" +
"environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" +
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" +
Expand All @@ -58,7 +58,7 @@ const (

func TestHTTPClientCall(t *testing.T) {

methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", "", "0.0.1", &UserProvider{})
methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", "", "", &UserProvider{})
assert.NoError(t, err)
assert.Equal(t, "GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4", methods)

Expand Down
4 changes: 2 additions & 2 deletions protocol/jsonrpc/jsonrpc_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ import (

func TestJsonrpcInvokerInvoke(t *testing.T) {

methods, err := common.ServiceMap.Register("UserProvider", "jsonrpc", "", "0.0.1", &UserProvider{})
methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "jsonrpc", "", "", &UserProvider{})
assert.NoError(t, err)
assert.Equal(t, "GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4", methods)

// Export
proto := GetProtocol()
url, err := common.NewURL("jsonrpc://127.0.0.1:20001/UserProvider?anyhost=true&" +
url, err := common.NewURL("jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&" +
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" +
"environment=dev&interface=com.ikurento.user.UserProvider&ip=192.168.56.1&methods=GetUser%2C&" +
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" +
Expand Down
2 changes: 0 additions & 2 deletions protocol/rest/rest_protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ func TestRestProtocolExport(t *testing.T) {
proto.Destroy()
_, ok = proto.(*RestProtocol).serverMap[url.Location]
assert.False(t, ok)
err = common.ServiceMap.UnRegister(url.Service(), url.Protocol, url.ServiceKey())
assert.NoError(t, err)
}

type UserProvider struct {
Expand Down
8 changes: 5 additions & 3 deletions remoting/getty/getty_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ func testGetUser3(t *testing.T, c *Client) {
request := remoting.NewRequest("2.0.2")
invocation := createInvocation("GetUser3", nil, nil, []interface{}{},
[]reflect.Value{})
attachment := map[string]string{INTERFACE_KEY: "com.ikurento.user.UserProvider"}
attachment := map[string]string{
INTERFACE_KEY: "com.ikurento.user.UserProvider",
}
setAttachment(invocation, attachment)
request.Data = invocation
request.Event = false
Expand Down Expand Up @@ -341,7 +343,7 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
hessian.RegisterPOJO(&User{})
remoting.RegistryCodec("dubbo", &DubboTestCodec{})

methods, err := common.ServiceMap.Register("", "dubbo", "", "0.0.1", &UserProvider{})
methods, err := common.ServiceMap.Register("com.ikurento.user.UserProvider", "dubbo", "", "", &UserProvider{})
assert.NoError(t, err)
assert.Equal(t, "GetBigPkg,GetUser,GetUser0,GetUser1,GetUser2,GetUser3,GetUser4,GetUser5,GetUser6", methods)

Expand Down Expand Up @@ -387,7 +389,7 @@ func InitTest(t *testing.T) (*Server, *common.URL) {
}})
assert.NoError(t, srvConf.CheckValidity())

url, err := common.NewURL("dubbo://127.0.0.1:20060/UserProvider?anyhost=true&" +
url, err := common.NewURL("dubbo://127.0.0.1:20060/com.ikurento.user.UserProvider?anyhost=true&" +
"application=BDTService&category=providers&default.timeout=10000&dubbo=dubbo-provider-golang-1.0.0&" +
"environment=dev&interface=com.ikurento.user.UserProvider&ip=127.0.0.1&methods=GetUser%2C&" +
"module=dubbogo+user-info+server&org=ikurento.com&owner=ZX&pid=1447&revision=0.0.1&" +
Expand Down

0 comments on commit c593464

Please sign in to comment.