This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/1.5 by this push:
new 86151f3 Fix/get url (#1202)
86151f3 is described below
commit 86151f324f9c4ab2cc82ec4fce85deb3c6923407
Author: Xin.Zh <[email protected]>
AuthorDate: Sat May 15 18:11:04 2021 +0800
Fix/get url (#1202)
* Imp: GetUrl -> GetURL
* fix cluster/cluster_impl ut
* fix registry/nacos ut
Co-authored-by: gaoxinge <[email protected]>
---
.../cluster_impl/available_cluster_invoker_test.go | 2 +-
cluster/cluster_impl/base_cluster_invoker.go | 18 +++++++++---------
.../cluster_impl/broadcast_cluster_invoker_test.go | 2 +-
cluster/cluster_impl/failback_cluster_invoker.go | 12 ++++++------
cluster/cluster_impl/failback_cluster_test.go | 12 ++++++------
cluster/cluster_impl/failfast_cluster_test.go | 6 +++---
cluster/cluster_impl/failover_cluster_invoker.go | 8 ++++----
cluster/cluster_impl/failover_cluster_test.go | 4 ++--
cluster/cluster_impl/failsafe_cluster_invoker.go | 2 +-
cluster/cluster_impl/failsafe_cluster_test.go | 6 +++---
cluster/cluster_impl/forking_cluster_invoker.go | 4 ++--
cluster/cluster_impl/forking_cluster_test.go | 2 +-
cluster/cluster_impl/mock_cluster.go | 2 +-
cluster/cluster_impl/zone_aware_cluster_invoker.go | 4 ++--
.../zone_aware_cluster_invoker_test.go | 8 ++++----
cluster/directory/base_directory.go | 14 +++++++-------
cluster/directory/base_directory_test.go | 2 +-
cluster/directory/static_directory.go | 6 +++---
cluster/loadbalance/consistent_hash.go | 6 +++---
cluster/loadbalance/consistent_hash_test.go | 6 +++---
cluster/loadbalance/least_active.go | 2 +-
cluster/loadbalance/least_active_test.go | 8 ++++----
cluster/loadbalance/random_test.go | 6 +++---
cluster/loadbalance/round_robin.go | 4 ++--
cluster/loadbalance/round_robin_test.go | 4 ++--
cluster/loadbalance/util.go | 2 +-
cluster/router/chain/chain.go | 4 ++--
cluster/router/condition/factory_test.go | 4 ++--
cluster/router/condition/router.go | 2 +-
cluster/router/conncheck/conn_check_route_test.go | 4 ++--
cluster/router/conncheck/factory_test.go | 2 +-
cluster/router/healthcheck/default_health_check.go | 4 ++--
cluster/router/healthcheck/factory_test.go | 2 +-
cluster/router/local/factory_test.go | 2 +-
cluster/router/local/self_priority_route.go | 2 +-
cluster/router/tag/tag_router.go | 6 +++---
cluster/router/tag/tag_router_test.go | 6 +++---
common/node.go | 2 +-
common/proxy/proxy_factory/default.go | 2 +-
config/config_center_config.go | 8 ++++----
config/config_loader_test.go | 2 +-
config/reference_config.go | 8 ++++----
config/reference_config_test.go | 22 +++++++++++-----------
config/registry_config.go | 4 ++--
config/service_config.go | 2 +-
config_center/apollo/impl_test.go | 2 +-
config_center/configurator.go | 4 ++--
config_center/configurator/mock.go | 6 +++---
config_center/configurator/override.go | 2 +-
config_center/configurator/override_test.go | 6 +++---
config_center/nacos/client.go | 2 +-
config_center/nacos/impl.go | 4 ++--
config_center/zookeeper/impl.go | 2 +-
config_center/zookeeper/impl_test.go | 2 +-
config_center/zookeeper/listener_test.go | 2 +-
filter/filter_impl/access_log_filter.go | 2 +-
filter/filter_impl/active_filter.go | 4 ++--
filter/filter_impl/active_filter_test.go | 4 ++--
filter/filter_impl/auth/consumer_sign.go | 2 +-
filter/filter_impl/auth/consumer_sign_test.go | 2 +-
filter/filter_impl/auth/provider_auth.go | 2 +-
filter/filter_impl/auth/provider_auth_test.go | 2 +-
filter/filter_impl/execute_limit_filter.go | 2 +-
filter/filter_impl/generic_service_filter.go | 2 +-
filter/filter_impl/graceful_shutdown_filter.go | 2 +-
filter/filter_impl/hystrix_filter.go | 4 ++--
filter/filter_impl/sentinel_filter.go | 4 ++--
filter/filter_impl/token_filter.go | 2 +-
filter/filter_impl/tps_limit_filter.go | 4 ++--
filter/filter_impl/tracing_filter.go | 2 +-
.../metadata_service_proxy_factory_test.go | 2 +-
metrics/prometheus/reporter.go | 2 +-
protocol/dubbo/dubbo_exporter.go | 4 ++--
protocol/dubbo/dubbo_invoker.go | 10 +++++-----
protocol/dubbo/dubbo_protocol.go | 2 +-
protocol/dubbo/dubbo_protocol_test.go | 6 +++---
protocol/grpc/grpc_exporter.go | 4 ++--
protocol/grpc/grpc_protocol.go | 2 +-
protocol/grpc/grpc_protocol_test.go | 4 ++--
protocol/invoker.go | 6 +++---
protocol/invoker_test.go | 2 +-
protocol/jsonrpc/jsonrpc_exporter.go | 4 ++--
protocol/jsonrpc/jsonrpc_invoker.go | 2 +-
protocol/jsonrpc/jsonrpc_protocol.go | 2 +-
protocol/jsonrpc/jsonrpc_protocol_test.go | 4 ++--
protocol/mock/mock_invoker.go | 12 ++++++------
.../protocolwrapper/protocol_filter_wrapper.go | 8 ++++----
protocol/rest/config/rest_config.go | 4 ++--
protocol/rest/rest_exporter.go | 4 ++--
protocol/rest/rest_invoker.go | 2 +-
protocol/rest/rest_protocol.go | 2 +-
protocol/rest/rest_protocol_test.go | 4 ++--
protocol/rest/server/rest_server.go | 2 +-
protocol/rpc_status.go | 10 +++++-----
registry/base_registry.go | 4 ++--
registry/consul/registry.go | 4 ++--
registry/directory/directory.go | 8 ++++----
registry/directory/directory_test.go | 6 +++---
registry/mock_registry.go | 2 +-
registry/nacos/registry.go | 4 ++--
registry/nacos/service_discovery_test.go | 20 ++++++++++----------
registry/protocol/protocol.go | 8 ++++----
registry/protocol/protocol_test.go | 4 ++--
.../servicediscovery/service_discovery_registry.go | 2 +-
registry/zookeeper/service_discovery.go | 2 +-
remoting/etcdv3/facade.go | 2 +-
remoting/exchange_server.go | 4 ++--
remoting/kubernetes/client.go | 2 +-
remoting/kubernetes/facade_test.go | 2 +-
remoting/zookeeper/client.go | 2 +-
remoting/zookeeper/facade.go | 2 +-
remoting/zookeeper/facade_test.go | 2 +-
112 files changed, 248 insertions(+), 248 deletions(-)
diff --git a/cluster/cluster_impl/available_cluster_invoker_test.go
b/cluster/cluster_impl/available_cluster_invoker_test.go
index 0631000..d55cac4 100644
--- a/cluster/cluster_impl/available_cluster_invoker_test.go
+++ b/cluster/cluster_impl/available_cluster_invoker_test.go
@@ -51,7 +51,7 @@ func registerAvailable(invoker *mock.MockInvoker)
protocol.Invoker {
invokers := []protocol.Invoker{}
invokers = append(invokers, invoker)
- invoker.EXPECT().GetUrl().Return(availableUrl)
+ invoker.EXPECT().GetURL().Return(availableUrl)
staticDir := directory.NewStaticDirectory(invokers)
clusterInvoker := availableCluster.Join(staticDir)
diff --git a/cluster/cluster_impl/base_cluster_invoker.go
b/cluster/cluster_impl/base_cluster_invoker.go
index 0d39bff..96b59a5 100644
--- a/cluster/cluster_impl/base_cluster_invoker.go
+++ b/cluster/cluster_impl/base_cluster_invoker.go
@@ -51,8 +51,8 @@ func newBaseClusterInvoker(directory cluster.Directory)
baseClusterInvoker {
}
}
-func (invoker *baseClusterInvoker) GetUrl() *common.URL {
- return invoker.directory.GetUrl()
+func (invoker *baseClusterInvoker) GetURL() *common.URL {
+ return invoker.directory.GetURL()
}
func (invoker *baseClusterInvoker) Destroy() {
@@ -75,7 +75,7 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers
[]protocol.Invoker, in
ip := common.GetLocalIp()
return perrors.Errorf("Failed to invoke the method %v. No
provider available for the service %v from "+
"registry %v on the consumer %v using the dubbo version
%v .Please check if the providers have been started and registered.",
- invocation.MethodName(),
invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(),
ip, constant.Version)
+ invocation.MethodName(),
invoker.directory.GetURL().SubURL.Key(), invoker.directory.GetURL().String(),
ip, constant.Version)
}
return nil
@@ -86,7 +86,7 @@ func (invoker *baseClusterInvoker) checkWhetherDestroyed()
error {
if invoker.destroyed.Load() {
ip := common.GetLocalIp()
return perrors.Errorf("Rpc cluster invoker for %v on consumer
%v use dubbo version %v is now destroyed! can not invoke any more. ",
- invoker.directory.GetUrl().Service(), ip,
constant.Version)
+ invoker.directory.GetURL().Service(), ip,
constant.Version)
}
return nil
}
@@ -97,7 +97,7 @@ func (invoker *baseClusterInvoker) doSelect(lb
cluster.LoadBalance, invocation p
return selectedInvoker
}
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
sticky := url.GetParamBool(constant.STICKY_KEY, false)
//Get the service method sticky config if have
sticky = url.GetMethodParamBool(invocation.MethodName(),
constant.STICKY_KEY, sticky)
@@ -129,7 +129,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb
cluster.LoadBalance, invoc
return invokers[0]
}
protocol.SetInvokerUnhealthyStatus(invokers[0])
- logger.Errorf("the invokers of %s is nil. ",
invokers[0].GetUrl().ServiceKey())
+ logger.Errorf("the invokers of %s is nil. ",
invokers[0].GetURL().ServiceKey())
return nil
}
@@ -152,7 +152,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb
cluster.LoadBalance, invoc
}
if !reselectedInvoker.IsAvailable() {
logger.Infof("the invoker of %s is not
available, maybe some network error happened or the server is shutdown.",
- invoker.GetUrl().Ip)
+ invoker.GetURL().Ip)
protocol.SetInvokerUnhealthyStatus(reselectedInvoker)
otherInvokers = getOtherInvokers(otherInvokers,
reselectedInvoker)
continue
@@ -162,7 +162,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb
cluster.LoadBalance, invoc
} else {
return selectedInvoker
}
- logger.Errorf("all %d invokers is unavailable for %s.", len(invokers),
selectedInvoker.GetUrl().String())
+ logger.Errorf("all %d invokers is unavailable for %s.", len(invokers),
selectedInvoker.GetURL().String())
return nil
}
@@ -190,7 +190,7 @@ func isInvoked(selectedInvoker protocol.Invoker, invoked
[]protocol.Invoker) boo
}
func getLoadBalance(invoker protocol.Invoker, invocation protocol.Invocation)
cluster.LoadBalance {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
methodName := invocation.MethodName()
//Get the service loadbalance config
diff --git a/cluster/cluster_impl/broadcast_cluster_invoker_test.go
b/cluster/cluster_impl/broadcast_cluster_invoker_test.go
index 08d0002..a93deb2 100644
--- a/cluster/cluster_impl/broadcast_cluster_invoker_test.go
+++ b/cluster/cluster_impl/broadcast_cluster_invoker_test.go
@@ -52,7 +52,7 @@ func registerBroadcast(mockInvokers ...*mock.MockInvoker)
protocol.Invoker {
for i, ivk := range mockInvokers {
invokers = append(invokers, ivk)
if i == 0 {
- ivk.EXPECT().GetUrl().Return(broadcastUrl)
+ ivk.EXPECT().GetURL().Return(broadcastUrl)
}
}
staticDir := directory.NewStaticDirectory(invokers)
diff --git a/cluster/cluster_impl/failback_cluster_invoker.go
b/cluster/cluster_impl/failback_cluster_invoker.go
index ea409ae..6cf231d 100644
--- a/cluster/cluster_impl/failback_cluster_invoker.go
+++ b/cluster/cluster_impl/failback_cluster_invoker.go
@@ -56,14 +56,14 @@ func newFailbackClusterInvoker(directory cluster.Directory)
protocol.Invoker {
invoker := &failbackClusterInvoker{
baseClusterInvoker: newBaseClusterInvoker(directory),
}
- retriesConfig := invoker.GetUrl().GetParam(constant.RETRIES_KEY,
constant.DEFAULT_FAILBACK_TIMES)
+ retriesConfig := invoker.GetURL().GetParam(constant.RETRIES_KEY,
constant.DEFAULT_FAILBACK_TIMES)
retries, err := strconv.Atoi(retriesConfig)
if err != nil || retries < 0 {
logger.Error("Your retries config is invalid,pls do a check.
And will use the default fail back times configuration instead.")
retries = constant.DEFAULT_FAILBACK_TIMES_INT
}
- failbackTasksConfig :=
invoker.GetUrl().GetParamInt(constant.FAIL_BACK_TASKS_KEY,
constant.DEFAULT_FAILBACK_TASKS)
+ failbackTasksConfig :=
invoker.GetURL().GetParamInt(constant.FAIL_BACK_TASKS_KEY,
constant.DEFAULT_FAILBACK_TASKS)
if failbackTasksConfig <= 0 {
failbackTasksConfig = constant.DEFAULT_FAILBACK_TASKS
}
@@ -114,7 +114,7 @@ func (invoker *failbackClusterInvoker) process(ctx
context.Context) {
func (invoker *failbackClusterInvoker) checkRetry(retryTask *retryTimerTask,
err error) {
logger.Errorf("Failed retry to invoke the method %v in the service %v,
wait again. The exception: %v.\n",
- retryTask.invocation.MethodName(), invoker.GetUrl().Service(),
err.Error())
+ retryTask.invocation.MethodName(), invoker.GetURL().Service(),
err.Error())
retryTask.retries++
retryTask.lastT = time.Now()
if retryTask.retries > invoker.maxRetries {
@@ -133,12 +133,12 @@ func (invoker *failbackClusterInvoker) Invoke(ctx
context.Context, invocation pr
invokers := invoker.directory.List(invocation)
if err := invoker.checkInvokers(invokers, invocation); err != nil {
logger.Errorf("Failed to invoke the method %v in the service
%v, wait for retry in background. Ignored exception: %v.\n",
- invocation.MethodName(), invoker.GetUrl().Service(),
err)
+ invocation.MethodName(), invoker.GetURL().Service(),
err)
return &protocol.RPCResult{}
}
//Get the service loadbalance config
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
lb := url.GetParam(constant.LOADBALANCE_KEY,
constant.DEFAULT_LOADBALANCE)
//Get the service method loadbalance config if have
methodName := invocation.MethodName()
@@ -169,7 +169,7 @@ func (invoker *failbackClusterInvoker) Invoke(ctx
context.Context, invocation pr
logger.Errorf("Failback to invoke the method %v in the service
%v, wait for retry in background. Ignored exception: %v.\n",
methodName, url.Service(), result.Error().Error())
// ignore
- return &protocol.RPCResult{Err: result.Error()}
+ return &protocol.RPCResult{}
}
return result
}
diff --git a/cluster/cluster_impl/failback_cluster_test.go
b/cluster/cluster_impl/failback_cluster_test.go
index d36e16e..2dcff5b 100644
--- a/cluster/cluster_impl/failback_cluster_test.go
+++ b/cluster/cluster_impl/failback_cluster_test.go
@@ -55,7 +55,7 @@ func registerFailback(invoker *mock.MockInvoker)
protocol.Invoker {
invokers := []protocol.Invoker{}
invokers = append(invokers, invoker)
- invoker.EXPECT().GetUrl().Return(failbackUrl)
+ invoker.EXPECT().GetURL().Return(failbackUrl)
staticDir := directory.NewStaticDirectory(invokers)
clusterInvoker := failbackCluster.Join(staticDir)
@@ -70,7 +70,7 @@ func TestFailbackSuceess(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
- invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
invoker.EXPECT().IsAvailable().Return(true)
@@ -89,7 +89,7 @@ func TestFailbackRetryOneSuccess(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
- invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
invoker.EXPECT().IsAvailable().Return(true)
// failed at first
@@ -134,7 +134,7 @@ func TestFailbackRetryFailed(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
- invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
@@ -183,7 +183,7 @@ func TestFailbackRetryFailed10Times(t *testing.T) {
clusterInvoker.maxRetries = 10
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
// 10 task should failed firstly.
mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
@@ -225,7 +225,7 @@ func TestFailbackOutOfLimit(t *testing.T) {
clusterInvoker := registerFailback(invoker).(*failbackClusterInvoker)
clusterInvoker.failbackTasks = 1
- invoker.EXPECT().GetUrl().Return(failbackUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failbackUrl).AnyTimes()
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
mockFailedResult := &protocol.RPCResult{Err: perrors.New("error")}
diff --git a/cluster/cluster_impl/failfast_cluster_test.go
b/cluster/cluster_impl/failfast_cluster_test.go
index 9ac06b8..a62903f 100644
--- a/cluster/cluster_impl/failfast_cluster_test.go
+++ b/cluster/cluster_impl/failfast_cluster_test.go
@@ -54,7 +54,7 @@ func registerFailfast(invoker *mock.MockInvoker)
protocol.Invoker {
invokers = append(invokers, invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failfastUrl)
+ invoker.EXPECT().GetURL().Return(failfastUrl)
staticDir := directory.NewStaticDirectory(invokers)
clusterInvoker := failfastCluster.Join(staticDir)
@@ -69,7 +69,7 @@ func TestFailfastInvokeSuccess(t *testing.T) {
clusterInvoker := registerFailfast(invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failfastUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failfastUrl).AnyTimes()
mockResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}}
@@ -90,7 +90,7 @@ func TestFailfastInvokeFail(t *testing.T) {
clusterInvoker := registerFailfast(invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failfastUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failfastUrl).AnyTimes()
mockResult := &protocol.RPCResult{Err: perrors.New("error")}
diff --git a/cluster/cluster_impl/failover_cluster_invoker.go
b/cluster/cluster_impl/failover_cluster_invoker.go
index ca490e7..1740bce 100644
--- a/cluster/cluster_impl/failover_cluster_invoker.go
+++ b/cluster/cluster_impl/failover_cluster_invoker.go
@@ -84,14 +84,14 @@ func (invoker *failoverClusterInvoker) Invoke(ctx
context.Context, invocation pr
//DO INVOKE
result = ivk.Invoke(ctx, invocation)
if result.Error() != nil {
- providers = append(providers, ivk.GetUrl().Key())
+ providers = append(providers, ivk.GetURL().Key())
continue
}
return result
}
ip := common.GetLocalIp()
- invokerSvc := invoker.GetUrl().Service()
- invokerUrl := invoker.directory.GetUrl()
+ invokerSvc := invoker.GetURL().Service()
+ invokerUrl := invoker.directory.GetURL()
if ivk == nil {
logger.Errorf("Failed to invoke the method %s of the service %s
.No provider is available.", methodName, invokerSvc)
return &protocol.RPCResult{
@@ -113,7 +113,7 @@ func getRetries(invokers []protocol.Invoker, methodName
string) int {
return constant.DEFAULT_RETRIES_INT
}
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
//get reties
retriesConfig := url.GetParam(constant.RETRIES_KEY,
constant.DEFAULT_RETRIES)
//Get the service method loadbalance config if have
diff --git a/cluster/cluster_impl/failover_cluster_test.go
b/cluster/cluster_impl/failover_cluster_test.go
index 3ea6232..fc437bb 100644
--- a/cluster/cluster_impl/failover_cluster_test.go
+++ b/cluster/cluster_impl/failover_cluster_test.go
@@ -63,7 +63,7 @@ func NewMockInvoker(url *common.URL, successCount int)
*MockInvoker {
}
// nolint
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
@@ -102,7 +102,7 @@ func (bi *MockInvoker) Invoke(c context.Context, invocation
protocol.Invocation)
// nolint
func (bi *MockInvoker) Destroy() {
- logger.Infof("Destroy invoker: %v", bi.GetUrl().String())
+ logger.Infof("Destroy invoker: %v", bi.GetURL().String())
bi.destroyed = true
bi.available = false
}
diff --git a/cluster/cluster_impl/failsafe_cluster_invoker.go
b/cluster/cluster_impl/failsafe_cluster_invoker.go
index 27c59ff..761c90c 100644
--- a/cluster/cluster_impl/failsafe_cluster_invoker.go
+++ b/cluster/cluster_impl/failsafe_cluster_invoker.go
@@ -54,7 +54,7 @@ func (invoker *failsafeClusterInvoker) Invoke(ctx
context.Context, invocation pr
return &protocol.RPCResult{}
}
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
methodName := invocation.MethodName()
//Get the service loadbalance config
lb := url.GetParam(constant.LOADBALANCE_KEY,
constant.DEFAULT_LOADBALANCE)
diff --git a/cluster/cluster_impl/failsafe_cluster_test.go
b/cluster/cluster_impl/failsafe_cluster_test.go
index 5e208bd..f539f36 100644
--- a/cluster/cluster_impl/failsafe_cluster_test.go
+++ b/cluster/cluster_impl/failsafe_cluster_test.go
@@ -54,7 +54,7 @@ func registerFailsafe(invoker *mock.MockInvoker)
protocol.Invoker {
invokers = append(invokers, invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failbackUrl)
+ invoker.EXPECT().GetURL().Return(failbackUrl)
staticDir := directory.NewStaticDirectory(invokers)
clusterInvoker := failsafeCluster.Join(staticDir)
@@ -70,7 +70,7 @@ func TestFailSafeInvokeSuccess(t *testing.T) {
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failsafeUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failsafeUrl).AnyTimes()
mockResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}}
@@ -90,7 +90,7 @@ func TestFailSafeInvokeFail(t *testing.T) {
clusterInvoker := registerFailsafe(invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(failsafeUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(failsafeUrl).AnyTimes()
mockResult := &protocol.RPCResult{Err: perrors.New("error")}
diff --git a/cluster/cluster_impl/forking_cluster_invoker.go
b/cluster/cluster_impl/forking_cluster_invoker.go
index 3ffda58..6be6b36 100644
--- a/cluster/cluster_impl/forking_cluster_invoker.go
+++ b/cluster/cluster_impl/forking_cluster_invoker.go
@@ -56,8 +56,8 @@ func (invoker *forkingClusterInvoker) Invoke(ctx
context.Context, invocation pro
}
var selected []protocol.Invoker
- forks := invoker.GetUrl().GetParamByIntValue(constant.FORKS_KEY,
constant.DEFAULT_FORKS)
- timeouts := invoker.GetUrl().GetParamInt(constant.TIMEOUT_KEY,
constant.DEFAULT_TIMEOUT)
+ forks := invoker.GetURL().GetParamByIntValue(constant.FORKS_KEY,
constant.DEFAULT_FORKS)
+ timeouts := invoker.GetURL().GetParamInt(constant.TIMEOUT_KEY,
constant.DEFAULT_TIMEOUT)
if forks < 0 || forks > len(invokers) {
selected = invokers
} else {
diff --git a/cluster/cluster_impl/forking_cluster_test.go
b/cluster/cluster_impl/forking_cluster_test.go
index a2fa136..315eaf2 100644
--- a/cluster/cluster_impl/forking_cluster_test.go
+++ b/cluster/cluster_impl/forking_cluster_test.go
@@ -54,7 +54,7 @@ func registerForking(mockInvokers ...*mock.MockInvoker)
protocol.Invoker {
for i, ivk := range mockInvokers {
invokers = append(invokers, ivk)
if i == 0 {
- ivk.EXPECT().GetUrl().Return(forkingUrl)
+ ivk.EXPECT().GetURL().Return(forkingUrl)
}
}
staticDir := directory.NewStaticDirectory(invokers)
diff --git a/cluster/cluster_impl/mock_cluster.go
b/cluster/cluster_impl/mock_cluster.go
index a7fa5d4..a643417 100644
--- a/cluster/cluster_impl/mock_cluster.go
+++ b/cluster/cluster_impl/mock_cluster.go
@@ -35,5 +35,5 @@ func NewMockCluster() cluster.Cluster {
// nolint
func (cluster *mockCluster) Join(directory cluster.Directory) protocol.Invoker
{
- return protocol.NewBaseInvoker(directory.GetUrl())
+ return protocol.NewBaseInvoker(directory.GetURL())
}
diff --git a/cluster/cluster_impl/zone_aware_cluster_invoker.go
b/cluster/cluster_impl/zone_aware_cluster_invoker.go
index 050f831..4891b9d 100644
--- a/cluster/cluster_impl/zone_aware_cluster_invoker.go
+++ b/cluster/cluster_impl/zone_aware_cluster_invoker.go
@@ -80,7 +80,7 @@ func (invoker *zoneAwareClusterInvoker) DoInvoke(ctx
context.Context, invocation
return &protocol.RPCResult{
Err: fmt.Errorf("no registry instance in zone
or "+
"no available providers in the
registry, zone: %v, "+
- " registries: %v", zone,
invoker.GetUrl()),
+ " registries: %v", zone,
invoker.GetURL()),
}
}
}
@@ -129,5 +129,5 @@ func (invoker *zoneAwareClusterInvoker) AfterInvoker(ctx
context.Context, invoca
}
func matchParam(target, key, def string, invoker protocol.Invoker) bool {
- return target == invoker.GetUrl().GetParam(key, def)
+ return target == invoker.GetURL().GetParam(key, def)
}
diff --git a/cluster/cluster_impl/zone_aware_cluster_invoker_test.go
b/cluster/cluster_impl/zone_aware_cluster_invoker_test.go
index 7f77f33..9ef6f6c 100644
--- a/cluster/cluster_impl/zone_aware_cluster_invoker_test.go
+++ b/cluster/cluster_impl/zone_aware_cluster_invoker_test.go
@@ -52,7 +52,7 @@ func TestZoneWareInvokerWithPreferredSuccess(t *testing.T) {
url, _ :=
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/com.ikurento.user.UserProvider",
i))
invoker := mock.NewMockInvoker(ctrl)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+ invoker.EXPECT().GetURL().Return(url).AnyTimes()
if 0 == i {
url.SetParam(constant.REGISTRY_KEY+"."+constant.PREFERRED_KEY, "true")
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
@@ -92,7 +92,7 @@ func TestZoneWareInvokerWithWeightSuccess(t *testing.T) {
url, _ :=
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/com.ikurento.user.UserProvider",
i))
invoker := mock.NewMockInvoker(ctrl)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+ invoker.EXPECT().GetURL().Return(url).AnyTimes()
url.SetParam(constant.REGISTRY_KEY+"."+constant.REGISTRY_LABEL_KEY, "true")
if 1 == i {
url.SetParam(constant.REGISTRY_KEY+"."+constant.WEIGHT_KEY, w1)
@@ -150,7 +150,7 @@ func TestZoneWareInvokerWithZoneSuccess(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+ invoker.EXPECT().GetURL().Return(url).AnyTimes()
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
func(invocation protocol.Invocation) protocol.Result {
return &protocol.RPCResult{
@@ -186,7 +186,7 @@ func TestZoneWareInvokerWithZoneForceFail(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
- invoker.EXPECT().GetUrl().Return(url).AnyTimes()
+ invoker.EXPECT().GetURL().Return(url).AnyTimes()
invokers = append(invokers, invoker)
}
diff --git a/cluster/directory/base_directory.go
b/cluster/directory/base_directory.go
index 309cd44..f969e7a 100644
--- a/cluster/directory/base_directory.go
+++ b/cluster/directory/base_directory.go
@@ -64,8 +64,8 @@ func (dir *BaseDirectory) SetRouterChain(routerChain
router.Chain) {
dir.routerChain = routerChain
}
-// GetUrl Get URL
-func (dir *BaseDirectory) GetUrl() *common.URL {
+// GetURL Get URL
+func (dir *BaseDirectory) GetURL() *common.URL {
return dir.url
}
@@ -112,13 +112,13 @@ func (dir *BaseDirectory) SetRouters(urls []*common.URL) {
func (dir *BaseDirectory) isProperRouter(url *common.URL) bool {
app := url.GetParam(constant.APPLICATION_KEY, "")
- dirApp := dir.GetUrl().GetParam(constant.APPLICATION_KEY, "")
- if len(dirApp) == 0 && dir.GetUrl().SubURL != nil {
- dirApp = dir.GetUrl().SubURL.GetParam(constant.APPLICATION_KEY,
"")
+ dirApp := dir.GetURL().GetParam(constant.APPLICATION_KEY, "")
+ if len(dirApp) == 0 && dir.GetURL().SubURL != nil {
+ dirApp = dir.GetURL().SubURL.GetParam(constant.APPLICATION_KEY,
"")
}
- serviceKey := dir.GetUrl().ServiceKey()
+ serviceKey := dir.GetURL().ServiceKey()
if len(serviceKey) == 0 {
- serviceKey = dir.GetUrl().SubURL.ServiceKey()
+ serviceKey = dir.GetURL().SubURL.ServiceKey()
}
if len(app) > 0 && app == dirApp {
return true
diff --git a/cluster/directory/base_directory_test.go
b/cluster/directory/base_directory_test.go
index 443f07d..7130c3e 100644
--- a/cluster/directory/base_directory_test.go
+++ b/cluster/directory/base_directory_test.go
@@ -42,7 +42,7 @@ var (
func TestNewBaseDirectory(t *testing.T) {
dir := NewBaseDirectory(url)
- assert.Equal(t, url, dir.GetUrl())
+ assert.Equal(t, url, dir.GetURL())
assert.Equal(t, url, dir.GetDirectoryUrl())
}
diff --git a/cluster/directory/static_directory.go
b/cluster/directory/static_directory.go
index d9695d4..aa87732 100644
--- a/cluster/directory/static_directory.go
+++ b/cluster/directory/static_directory.go
@@ -37,7 +37,7 @@ func NewStaticDirectory(invokers []protocol.Invoker)
*staticDirectory {
var url *common.URL
if len(invokers) > 0 {
- url = invokers[0].GetUrl()
+ url = invokers[0].GetURL()
}
dir := &staticDirectory{
BaseDirectory: NewBaseDirectory(url),
@@ -71,7 +71,7 @@ func (dir *staticDirectory) List(invocation
protocol.Invocation) []protocol.Invo
if routerChain == nil {
return invokers
}
- dirUrl := dir.GetUrl()
+ dirUrl := dir.GetURL()
return routerChain.Route(dirUrl, invocation)
}
@@ -90,7 +90,7 @@ func (dir *staticDirectory) BuildRouterChain(invokers
[]protocol.Invoker) error
if len(invokers) == 0 {
return perrors.Errorf("invokers == null")
}
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
routerChain, e := chain.NewRouterChain(url)
if e != nil {
return e
diff --git a/cluster/loadbalance/consistent_hash.go
b/cluster/loadbalance/consistent_hash.go
index 3d036b4..47d4add 100644
--- a/cluster/loadbalance/consistent_hash.go
+++ b/cluster/loadbalance/consistent_hash.go
@@ -69,7 +69,7 @@ func NewConsistentHashLoadBalance() cluster.LoadBalance {
// Select gets invoker based on load balancing strategy
func (lb *ConsistentHashLoadBalance) Select(invokers []protocol.Invoker,
invocation protocol.Invocation) protocol.Invoker {
methodName := invocation.MethodName()
- key := invokers[0].GetUrl().ServiceKey() + "." + methodName
+ key := invokers[0].GetURL().ServiceKey() + "." + methodName
// hash the invokers
bs := make([]byte, 0)
@@ -104,7 +104,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker,
methodName string,
selector := &ConsistentHashSelector{}
selector.virtualInvokers = make(map[uint32]protocol.Invoker)
selector.hashCode = hashCode
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
selector.replicaNum = url.GetMethodParamIntValue(methodName, HashNodes,
160)
indices := re.Split(url.GetMethodParam(methodName, HashArguments, "0"),
-1)
for _, index := range indices {
@@ -115,7 +115,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker,
methodName string,
selector.argumentIndex = append(selector.argumentIndex, i)
}
for _, invoker := range invokers {
- u := invoker.GetUrl()
+ u := invoker.GetURL()
address := u.Ip + ":" + u.Port
for i := 0; i < selector.replicaNum/4; i++ {
digest := md5.Sum([]byte(address + strconv.Itoa(i)))
diff --git a/cluster/loadbalance/consistent_hash_test.go
b/cluster/loadbalance/consistent_hash_test.go
index 0fbb740..b6ff69e 100644
--- a/cluster/loadbalance/consistent_hash_test.go
+++ b/cluster/loadbalance/consistent_hash_test.go
@@ -75,7 +75,7 @@ func (s *consistentHashSelectorSuite) TestSelectForKey() {
s.selector.virtualInvokers[9999945] = protocol.NewBaseInvoker(url2)
s.selector.keys = []uint32{99874, 9999945}
result := s.selector.selectForKey(9999944)
- s.Equal(result.GetUrl().String(), url8081Short+"?")
+ s.Equal(result.GetURL().String(), url8081Short+"?")
}
func TestConsistentHashLoadBalanceSuite(t *testing.T) {
@@ -114,9 +114,9 @@ func (s *consistentHashLoadBalanceSuite) SetupTest() {
func (s *consistentHashLoadBalanceSuite) TestSelect() {
args := []interface{}{"name", "password", "age"}
invoker := s.lb.Select(s.invokers, invocation.NewRPCInvocation("echo",
args, nil))
- s.Equal(invoker.GetUrl().Location, fmt.Sprintf("%s:%d", ip, port8080))
+ s.Equal(invoker.GetURL().Location, fmt.Sprintf("%s:%d", ip, port8080))
args = []interface{}{"ok", "abc"}
invoker = s.lb.Select(s.invokers, invocation.NewRPCInvocation("echo",
args, nil))
- s.Equal(invoker.GetUrl().Location, fmt.Sprintf("%s:%d", ip, port8082))
+ s.Equal(invoker.GetURL().Location, fmt.Sprintf("%s:%d", ip, port8082))
}
diff --git a/cluster/loadbalance/least_active.go
b/cluster/loadbalance/least_active.go
index 8776735..3ece24f 100644
--- a/cluster/loadbalance/least_active.go
+++ b/cluster/loadbalance/least_active.go
@@ -68,7 +68,7 @@ func (lb *leastActiveLoadBalance) Select(invokers
[]protocol.Invoker, invocation
for i := 0; i < count; i++ {
invoker := invokers[i]
// Active number
- active := protocol.GetMethodStatus(invoker.GetUrl(),
invocation.MethodName()).GetActive()
+ active := protocol.GetMethodStatus(invoker.GetURL(),
invocation.MethodName()).GetActive()
// current weight (maybe in warmUp)
weight := GetWeight(invoker, invocation)
// There are smaller active services
diff --git a/cluster/loadbalance/least_active_test.go
b/cluster/loadbalance/least_active_test.go
index 34be17a..56e32fd 100644
--- a/cluster/loadbalance/least_active_test.go
+++ b/cluster/loadbalance/least_active_test.go
@@ -41,7 +41,7 @@ func TestLeastActiveSelect(t *testing.T) {
url, _ :=
common.NewURL(fmt.Sprintf("dubbo://%s:%d/org.apache.demo.HelloService",
constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
invokers = append(invokers, protocol.NewBaseInvoker(url))
i := loadBalance.Select(invokers, &invocation.RPCInvocation{})
- assert.True(t, i.GetUrl().URLEqual(url))
+ assert.True(t, i.GetURL().URLEqual(url))
for i := 1; i < 10; i++ {
url, _ :=
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/org.apache.demo.HelloService",
i))
@@ -61,7 +61,7 @@ func TestLeastActiveByWeight(t *testing.T) {
}
inv :=
invocation.NewRPCInvocationWithOptions(invocation.WithMethodName("test"))
- protocol.BeginCount(invokers[2].GetUrl(), inv.MethodName())
+ protocol.BeginCount(invokers[2].GetURL(), inv.MethodName())
loop = 10000
@@ -72,9 +72,9 @@ func TestLeastActiveByWeight(t *testing.T) {
for i := 1; i <= loop; i++ {
invoker := loadBalance.Select(invokers, inv)
- if invoker.GetUrl().Protocol == "test1" {
+ if invoker.GetURL().Protocol == "test1" {
firstCount++
- } else if invoker.GetUrl().Protocol == "test2" {
+ } else if invoker.GetURL().Protocol == "test2" {
secondCount++
}
}
diff --git a/cluster/loadbalance/random_test.go
b/cluster/loadbalance/random_test.go
index c24fdf0..5c2b758 100644
--- a/cluster/loadbalance/random_test.go
+++ b/cluster/loadbalance/random_test.go
@@ -50,7 +50,7 @@ func TestRandomlbSelect(t *testing.T) {
url, _ := common.NewURL(fmt.Sprintf(tmpUrlFormat, 0))
invokers = append(invokers, protocol.NewBaseInvoker(url))
i := randomlb.Select(invokers, &invocation.RPCInvocation{})
- assert.True(t, i.GetUrl().URLEqual(url))
+ assert.True(t, i.GetURL().URLEqual(url))
for i := 1; i < 10; i++ {
url, _ := common.NewURL(fmt.Sprintf(tmpUrlFormat, i))
@@ -78,7 +78,7 @@ func TestRandomlbSelectWeight(t *testing.T) {
var selected float64
for i := 0; i < 10000; i++ {
s := randomlb.Select(invokers, ivc)
- if s.GetUrl().Ip == tmpIp {
+ if s.GetURL().Ip == tmpIp {
selected++
}
selectedInvoker = append(selectedInvoker, s)
@@ -110,7 +110,7 @@ func TestRandomlbSelectWarmup(t *testing.T) {
var selected float64
for i := 0; i < 10000; i++ {
s := randomlb.Select(invokers, ivc)
- if s.GetUrl().Ip == tmpIp {
+ if s.GetURL().Ip == tmpIp {
selected++
}
selectedInvoker = append(selectedInvoker, s)
diff --git a/cluster/loadbalance/round_robin.go
b/cluster/loadbalance/round_robin.go
index 51a76da..28aa920 100644
--- a/cluster/loadbalance/round_robin.go
+++ b/cluster/loadbalance/round_robin.go
@@ -69,7 +69,7 @@ func (lb *roundRobinLoadBalance) Select(invokers
[]protocol.Invoker, invocation
return invokers[0]
}
- key := invokers[0].GetUrl().Path + "." + invocation.MethodName()
+ key := invokers[0].GetURL().Path + "." + invocation.MethodName()
cache, _ := methodWeightMap.LoadOrStore(key, &cachedInvokers{})
cachedInvokers := cache.(*cachedInvokers)
@@ -88,7 +88,7 @@ func (lb *roundRobinLoadBalance) Select(invokers
[]protocol.Invoker, invocation
weight = 0
}
- identifier := invoker.GetUrl().Key()
+ identifier := invoker.GetURL().Key()
loaded, found := cachedInvokers.LoadOrStore(identifier,
&weightedRoundRobin{weight: weight})
weightRobin := loaded.(*weightedRoundRobin)
if !found {
diff --git a/cluster/loadbalance/round_robin_test.go
b/cluster/loadbalance/round_robin_test.go
index 5354bae..921259d 100644
--- a/cluster/loadbalance/round_robin_test.go
+++ b/cluster/loadbalance/round_robin_test.go
@@ -43,7 +43,7 @@ func TestRoundRobinSelect(t *testing.T) {
constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
invokers = append(invokers, protocol.NewBaseInvoker(url))
i := loadBalance.Select(invokers, &invocation.RPCInvocation{})
- assert.True(t, i.GetUrl().URLEqual(url))
+ assert.True(t, i.GetURL().URLEqual(url))
for i := 1; i < 10; i++ {
url, _ :=
common.NewURL(fmt.Sprintf("dubbo://192.168.1.%v:20000/org.apache.demo.HelloService",
i))
@@ -71,7 +71,7 @@ func TestRoundRobinByWeight(t *testing.T) {
}
for _, i := range invokers {
- w, _ := strconv.Atoi(i.GetUrl().GetParam("weight", "-1"))
+ w, _ := strconv.Atoi(i.GetURL().GetParam("weight", "-1"))
assert.True(t, selected[i] == w)
}
}
diff --git a/cluster/loadbalance/util.go b/cluster/loadbalance/util.go
index 684ffe1..ca5d335 100644
--- a/cluster/loadbalance/util.go
+++ b/cluster/loadbalance/util.go
@@ -29,7 +29,7 @@ import (
// GetWeight gets weight for load balance strategy
func GetWeight(invoker protocol.Invoker, invocation protocol.Invocation) int64
{
var weight int64
- url := invoker.GetUrl()
+ url := invoker.GetURL()
// Multiple registry scenario, load balance among multiple registries.
isRegIvk :=
url.GetParamBool(constant.REGISTRY_KEY+"."+constant.REGISTRY_LABEL_KEY, false)
if isRegIvk {
diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go
index a44ef10..f573c68 100644
--- a/cluster/router/chain/chain.go
+++ b/cluster/router/chain/chain.go
@@ -354,9 +354,9 @@ func isInvokersChanged(left []protocol.Invoker, right
[]protocol.Invoker) bool {
for _, r := range right {
found := false
- rurl := r.GetUrl()
+ rurl := r.GetURL()
for _, l := range left {
- lurl := l.GetUrl()
+ lurl := l.GetURL()
if common.GetCompareURLEqualFunc()(lurl, rurl,
constant.TIMESTAMP_KEY, constant.REMOTE_TIMESTAMP_KEY) {
found = true
break
diff --git a/cluster/router/condition/factory_test.go
b/cluster/router/condition/factory_test.go
index e08016d..632403a 100644
--- a/cluster/router/condition/factory_test.go
+++ b/cluster/router/condition/factory_test.go
@@ -67,7 +67,7 @@ func NewMockInvoker(url *common.URL, successCount int)
*MockInvoker {
}
}
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
@@ -124,7 +124,7 @@ func (bi *MockInvoker) Invoke(_ context.Context, _
protocol.Invocation) protocol
}
func (bi *MockInvoker) Destroy() {
- logger.Infof("Destroy invoker: %v", bi.GetUrl().String())
+ logger.Infof("Destroy invoker: %v", bi.GetURL().String())
bi.destroyed = true
bi.available = false
}
diff --git a/cluster/router/condition/router.go
b/cluster/router/condition/router.go
index d543ca3..a2c9687 100644
--- a/cluster/router/condition/router.go
+++ b/cluster/router/condition/router.go
@@ -181,7 +181,7 @@ func (c *ConditionRouter) Route(invokers *roaring.Bitmap,
cache router.Cache, ur
for iter := invokers.Iterator(); iter.HasNext(); {
index := iter.Next()
invoker := cache.GetInvokers()[index]
- invokerUrl := invoker.GetUrl()
+ invokerUrl := invoker.GetURL()
isMatchThen := c.MatchThen(invokerUrl, url)
if isMatchThen {
result.Add(index)
diff --git a/cluster/router/conncheck/conn_check_route_test.go
b/cluster/router/conncheck/conn_check_route_test.go
index 5f78722..cb12ef4 100644
--- a/cluster/router/conncheck/conn_check_route_test.go
+++ b/cluster/router/conncheck/conn_check_route_test.go
@@ -90,8 +90,8 @@ func TestRecovery(t *testing.T) {
invoker1 := mock.NewMockInvoker(ctrl)
invoker2 := mock.NewMockInvoker(ctrl)
- invoker1.EXPECT().GetUrl().Return(&common.URL{Path: "path1"}).AnyTimes()
- invoker2.EXPECT().GetUrl().Return(&common.URL{Path: "path2"}).AnyTimes()
+ invoker1.EXPECT().GetURL().Return(&common.URL{Path: "path1"}).AnyTimes()
+ invoker2.EXPECT().GetURL().Return(&common.URL{Path: "path2"}).AnyTimes()
invoker1.EXPECT().IsAvailable().Return(true).AnyTimes()
invoker2.EXPECT().IsAvailable().Return(true).AnyTimes()
diff --git a/cluster/router/conncheck/factory_test.go
b/cluster/router/conncheck/factory_test.go
index 02f8fb4..166aec3 100644
--- a/cluster/router/conncheck/factory_test.go
+++ b/cluster/router/conncheck/factory_test.go
@@ -44,7 +44,7 @@ func NewMockInvoker(url *common.URL) *MockInvoker {
}
// nolint
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
diff --git a/cluster/router/healthcheck/default_health_check.go
b/cluster/router/healthcheck/default_health_check.go
index eb15e6f..d7fafa0 100644
--- a/cluster/router/healthcheck/default_health_check.go
+++ b/cluster/router/healthcheck/default_health_check.go
@@ -48,9 +48,9 @@ type DefaultHealthChecker struct {
// IsHealthy evaluates the healthy state on the given Invoker based on the
number of successive bad request
// and the current active request
func (c *DefaultHealthChecker) IsHealthy(invoker protocol.Invoker) bool {
- urlStatus := protocol.GetURLStatus(invoker.GetUrl())
+ urlStatus := protocol.GetURLStatus(invoker.GetURL())
if c.isCircuitBreakerTripped(urlStatus) || urlStatus.GetActive() >
c.GetOutStandingRequestCountLimit() {
- logger.Debugf("Invoker [%s] is currently in circuitbreaker
tripped state", invoker.GetUrl().Key())
+ logger.Debugf("Invoker [%s] is currently in circuitbreaker
tripped state", invoker.GetURL().Key())
return false
}
return true
diff --git a/cluster/router/healthcheck/factory_test.go
b/cluster/router/healthcheck/factory_test.go
index 1e73683..7802906 100644
--- a/cluster/router/healthcheck/factory_test.go
+++ b/cluster/router/healthcheck/factory_test.go
@@ -44,7 +44,7 @@ func NewMockInvoker(url *common.URL) *MockInvoker {
}
// nolint
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
diff --git a/cluster/router/local/factory_test.go
b/cluster/router/local/factory_test.go
index a5a683b..d5b5699 100644
--- a/cluster/router/local/factory_test.go
+++ b/cluster/router/local/factory_test.go
@@ -44,7 +44,7 @@ func NewMockInvoker(url *common.URL) *MockInvoker {
}
// nolint
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
diff --git a/cluster/router/local/self_priority_route.go
b/cluster/router/local/self_priority_route.go
index 87eaaf7..3e9dd03 100644
--- a/cluster/router/local/self_priority_route.go
+++ b/cluster/router/local/self_priority_route.go
@@ -70,7 +70,7 @@ func (r *LocalPriorityRouter) Pool(invokers
[]protocol.Invoker) (router.AddrPool
rb[localPriority] = roaring.NewBitmap()
localIpFound := false
for i, invoker := range invokers {
- if invoker.GetUrl().Ip == r.localIP {
+ if invoker.GetURL().Ip == r.localIP {
rb[localPriority].Add(uint32(i))
localIpFound = true
}
diff --git a/cluster/router/tag/tag_router.go b/cluster/router/tag/tag_router.go
index 3d0393a..03d5264 100644
--- a/cluster/router/tag/tag_router.go
+++ b/cluster/router/tag/tag_router.go
@@ -234,7 +234,7 @@ func (c *tagRouter) fetchRuleIfNecessary(invokers
[]protocol.Invoker) {
return
}
- url := invokers[0].GetUrl()
+ url := invokers[0].GetURL()
providerApplication := url.GetParam(constant.RemoteApplicationKey, "")
if len(providerApplication) == 0 {
logger.Error("TagRouter must getConfig from or subscribe to a
specific application, but the application " +
@@ -298,7 +298,7 @@ func poolWithDynamicTag(invokers []protocol.Invoker, rule
*RouterRule, pool rout
// poolWithStaticTag pools addresses with tags found from incoming URLs, all
keys have prefix "static-"
func poolWithStaticTag(invokers []protocol.Invoker, pool router.AddrPool) {
for i, invoker := range invokers {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
tag := url.GetParam(constant.Tagkey, "")
if len(tag) > 0 {
if _, ok := pool[staticPrefix+tag]; !ok {
@@ -348,7 +348,7 @@ func addrsToBitmap(addrs []string, invokers
[]protocol.Invoker) *roaring.Bitmap
// findIndexWithIp finds index for one particular IP
func findIndexWithIp(addr string, invokers []protocol.Invoker) int {
for i, invoker := range invokers {
- if gxnet.MatchIP(addr, invoker.GetUrl().Ip,
invoker.GetUrl().Port) {
+ if gxnet.MatchIP(addr, invoker.GetURL().Ip,
invoker.GetURL().Port) {
return i
}
}
diff --git a/cluster/router/tag/tag_router_test.go
b/cluster/router/tag/tag_router_test.go
index 3b53d47..1606240 100644
--- a/cluster/router/tag/tag_router_test.go
+++ b/cluster/router/tag/tag_router_test.go
@@ -93,7 +93,7 @@ func NewMockInvoker(url *common.URL) *MockInvoker {
}
}
-func (bi *MockInvoker) GetUrl() *common.URL {
+func (bi *MockInvoker) GetURL() *common.URL {
return bi.url
}
@@ -157,7 +157,7 @@ func TestTagRouterRouteForce(t *testing.T) {
inv.SetAttachments(tagRouterTestDubboTag, tagRouterTestHangZhou)
invRst1 := tagRouter.Route(utils.ToBitmap(invokers),
setUpAddrCache(tagRouter, invokers), u1, inv)
assert.Equal(t, 1, len(invRst1.ToArray()))
- assert.Equal(t, tagRouterTestHangZhou,
invokers[invRst1.ToArray()[0]].GetUrl().GetParam(tagRouterTestDubboTag, ""))
+ assert.Equal(t, tagRouterTestHangZhou,
invokers[invRst1.ToArray()[0]].GetURL().GetParam(tagRouterTestDubboTag, ""))
inv.SetAttachments(tagRouterTestDubboTag, tagRouterTestGuangZhou)
invRst2 := tagRouter.Route(utils.ToBitmap(invokers),
setUpAddrCache(tagRouter, invokers), u1, inv)
@@ -194,7 +194,7 @@ func TestTagRouterRouteNoForce(t *testing.T) {
inv.SetAttachments(tagRouterTestDubboTag, tagRouterTestHangZhou)
invRst := tagRouter.Route(utils.ToBitmap(invokers),
setUpAddrCache(tagRouter, invokers), u1, inv)
assert.Equal(t, 1, len(invRst.ToArray()))
- assert.Equal(t, tagRouterTestHangZhou,
invokers[invRst.ToArray()[0]].GetUrl().GetParam(tagRouterTestDubboTag, ""))
+ assert.Equal(t, tagRouterTestHangZhou,
invokers[invRst.ToArray()[0]].GetURL().GetParam(tagRouterTestDubboTag, ""))
inv.SetAttachments(tagRouterTestDubboTag, tagRouterTestGuangZhou)
inv.SetAttachments(tagRouterTestDubboForceTag, tagRouterTestTrue)
diff --git a/common/node.go b/common/node.go
index b9c1f39..aa18b61 100644
--- a/common/node.go
+++ b/common/node.go
@@ -19,7 +19,7 @@ package common
// Node use for process dubbo node
type Node interface {
- GetUrl() *URL
+ GetURL() *URL
IsAvailable() bool
Destroy()
}
diff --git a/common/proxy/proxy_factory/default.go
b/common/proxy/proxy_factory/default.go
index ff3d795..dd8ce02 100644
--- a/common/proxy/proxy_factory/default.go
+++ b/common/proxy/proxy_factory/default.go
@@ -89,7 +89,7 @@ func (pi *ProxyInvoker) Invoke(ctx context.Context,
invocation protocol.Invocati
result.SetAttachments(invocation.Attachments())
//get providerUrl. The origin url may be is registry URL.
- url := getProviderURL(pi.GetUrl())
+ url := getProviderURL(pi.GetURL())
methodName := invocation.MethodName()
proto := url.Protocol
diff --git a/config/config_center_config.go b/config/config_center_config.go
index 2489709..59d36fb 100644
--- a/config/config_center_config.go
+++ b/config/config_center_config.go
@@ -70,8 +70,8 @@ func (c *ConfigCenterConfig) UnmarshalYAML(unmarshal
func(interface{}) error) er
return unmarshal((*plain)(c))
}
-// GetUrlMap gets url map from ConfigCenterConfig
-func (c *ConfigCenterConfig) GetUrlMap() url.Values {
+// GetURLMap gets url map from ConfigCenterConfig
+func (c *ConfigCenterConfig) GetURLMap() url.Values {
urlMap := url.Values{}
urlMap.Set(constant.CONFIG_NAMESPACE_KEY, c.Namespace)
urlMap.Set(constant.CONFIG_GROUP_KEY, c.Group)
@@ -89,7 +89,7 @@ type configCenter struct {
func (b *configCenter) toURL(baseConfig BaseConfig) (*common.URL, error) {
if len(baseConfig.ConfigCenterConfig.Address) > 0 {
return common.NewURL(baseConfig.ConfigCenterConfig.Address,
-
common.WithProtocol(baseConfig.ConfigCenterConfig.Protocol),
common.WithParams(baseConfig.ConfigCenterConfig.GetUrlMap()))
+
common.WithProtocol(baseConfig.ConfigCenterConfig.Protocol),
common.WithParams(baseConfig.ConfigCenterConfig.GetURLMap()))
}
remoteRef := baseConfig.ConfigCenterConfig.RemoteRef
@@ -101,7 +101,7 @@ func (b *configCenter) toURL(baseConfig BaseConfig)
(*common.URL, error) {
newURL, err := rc.toURL()
if err == nil {
- newURL.SetParams(baseConfig.ConfigCenterConfig.GetUrlMap())
+ newURL.SetParams(baseConfig.ConfigCenterConfig.GetURLMap())
}
return newURL, err
}
diff --git a/config/config_loader_test.go b/config/config_loader_test.go
index 5cda3b2..9c99efa 100644
--- a/config/config_loader_test.go
+++ b/config/config_loader_test.go
@@ -455,7 +455,7 @@ func (m *mockMetadataService) getAllService(services
*sync.Map) []*common.URL {
type mockServiceDiscoveryRegistry struct {
}
-func (mr *mockServiceDiscoveryRegistry) GetUrl() *common.URL {
+func (mr *mockServiceDiscoveryRegistry) GetURL() *common.URL {
panic("implement me")
}
diff --git a/config/reference_config.go b/config/reference_config.go
index f4ecc0f..36b08d1 100644
--- a/config/reference_config.go
+++ b/config/reference_config.go
@@ -47,7 +47,7 @@ type ReferenceConfig struct {
id string
InterfaceName string `required:"true" yaml:"interface"
json:"interface,omitempty" property:"interface"`
Check *bool `yaml:"check" json:"check,omitempty"
property:"check"`
- Url string `yaml:"url" json:"url,omitempty"
property:"url"`
+ URL string `yaml:"url" json:"url,omitempty"
property:"url"`
Filter string `yaml:"filter" json:"filter,omitempty"
property:"filter"`
Protocol string `default:"dubbo" yaml:"protocol"
json:"protocol,omitempty" property:"protocol"`
Registry string `yaml:"registry"
json:"registry,omitempty" property:"registry"`
@@ -102,9 +102,9 @@ func (c *ReferenceConfig) Refer(_ interface{}) {
cfgURL.AddParam(constant.ForceUseTag, "true")
}
c.postProcessConfig(cfgURL)
- if c.Url != "" {
+ if c.URL != "" {
// 1. user specified URL, could be peer-to-peer address, or
register center's address.
- urlStrings := gxstrings.RegSplit(c.Url, "\\s*[;]+\\s*")
+ urlStrings := gxstrings.RegSplit(c.URL, "\\s*[;]+\\s*")
for _, urlStr := range urlStrings {
serviceUrl, err := common.NewURL(urlStr)
if err != nil {
@@ -184,7 +184,7 @@ func (c *ReferenceConfig) Refer(_ interface{}) {
// not a registry url, must be direct invoke.
hitClu = constant.FAILOVER_CLUSTER_NAME
if len(invokers) > 0 {
- u := invokers[0].GetUrl()
+ u := invokers[0].GetURL()
if nil != &u {
hitClu =
u.GetParam(constant.CLUSTER_KEY, constant.ZONEAWARE_CLUSTER_NAME)
}
diff --git a/config/reference_config_test.go b/config/reference_config_test.go
index 5d23e26..b2d68c4 100644
--- a/config/reference_config_test.go
+++ b/config/reference_config_test.go
@@ -236,7 +236,7 @@ func TestReferP2P(t *testing.T) {
extension.SetProtocol("dubbo", GetProtocol)
mockFilter()
m := consumerConfig.References["MockService"]
- m.Url = "dubbo://127.0.0.1:20000"
+ m.URL = "dubbo://127.0.0.1:20000"
for _, reference := range consumerConfig.References {
reference.Refer(nil)
@@ -251,7 +251,7 @@ func TestReferMultiP2P(t *testing.T) {
extension.SetProtocol("dubbo", GetProtocol)
mockFilter()
m := consumerConfig.References["MockService"]
- m.Url = "dubbo://127.0.0.1:20000;dubbo://127.0.0.2:20000"
+ m.URL = "dubbo://127.0.0.1:20000;dubbo://127.0.0.2:20000"
for _, reference := range consumerConfig.References {
reference.Refer(nil)
@@ -267,7 +267,7 @@ func TestReferMultiP2PWithReg(t *testing.T) {
extension.SetProtocol("registry", GetProtocol)
mockFilter()
m := consumerConfig.References["MockService"]
- m.Url = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
+ m.URL = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
for _, reference := range consumerConfig.References {
reference.Refer(nil)
@@ -296,11 +296,11 @@ func TestForking(t *testing.T) {
extension.SetProtocol("registry", GetProtocol)
mockFilter()
m := consumerConfig.References["MockService"]
- m.Url = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
+ m.URL = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
for _, reference := range consumerConfig.References {
reference.Refer(nil)
- forks :=
int(reference.invoker.GetUrl().GetParamInt(constant.FORKS_KEY,
constant.DEFAULT_FORKS))
+ forks :=
int(reference.invoker.GetURL().GetParamInt(constant.FORKS_KEY,
constant.DEFAULT_FORKS))
assert.Equal(t, 5, forks)
assert.NotNil(t, reference.pxy)
assert.NotNil(t, reference.Cluster)
@@ -314,16 +314,16 @@ func TestSticky(t *testing.T) {
extension.SetProtocol("registry", GetProtocol)
mockFilter()
m := consumerConfig.References["MockService"]
- m.Url = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
+ m.URL = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
reference := consumerConfig.References["MockService"]
reference.Refer(nil)
- referenceSticky :=
reference.invoker.GetUrl().GetParam(constant.STICKY_KEY, "false")
+ referenceSticky :=
reference.invoker.GetURL().GetParam(constant.STICKY_KEY, "false")
assert.Equal(t, "false", referenceSticky)
- method0StickKey :=
reference.invoker.GetUrl().GetMethodParam(reference.Methods[0].Name,
constant.STICKY_KEY, "false")
+ method0StickKey :=
reference.invoker.GetURL().GetMethodParam(reference.Methods[0].Name,
constant.STICKY_KEY, "false")
assert.Equal(t, "false", method0StickKey)
- method1StickKey :=
reference.invoker.GetUrl().GetMethodParam(reference.Methods[1].Name,
constant.STICKY_KEY, "false")
+ method1StickKey :=
reference.invoker.GetURL().GetMethodParam(reference.Methods[1].Name,
constant.STICKY_KEY, "false")
assert.Equal(t, "true", method1StickKey)
}
@@ -352,7 +352,7 @@ func (*mockRegistryProtocol) Export(invoker
protocol.Invoker) protocol.Exporter
if err != nil {
panic(err)
}
- ok, err :=
metaDataService.ExportURL(invoker.GetUrl().SubURL.Clone())
+ ok, err :=
metaDataService.ExportURL(invoker.GetURL().SubURL.Clone())
if err != nil {
panic(err)
}
@@ -368,7 +368,7 @@ func (*mockRegistryProtocol) Destroy() {
}
func getRegistryUrl(invoker protocol.Invoker) *common.URL {
// here add * for return a new url
- url := invoker.GetUrl()
+ url := invoker.GetURL()
// if the protocol == registry ,set protocol the registry value in
url.params
if url.Protocol == constant.REGISTRY_PROTOCOL {
protocol := url.GetParam(constant.REGISTRY_KEY, "")
diff --git a/config/registry_config.go b/config/registry_config.go
index ed81a07..2e2849e 100644
--- a/config/registry_config.go
+++ b/config/registry_config.go
@@ -100,7 +100,7 @@ func loadRegistries(targetRegistries string, registries
map[string]*RegistryConf
address := addresses[0]
address = translateRegistryConf(address, registryConf)
url, err :=
common.NewURL(constant.REGISTRY_PROTOCOL+"://"+address,
-
common.WithParams(registryConf.getUrlMap(roleType)),
+
common.WithParams(registryConf.getURLMap(roleType)),
common.WithParamsValue("simplified",
strconv.FormatBool(registryConf.Simplified)),
common.WithUsername(registryConf.Username),
common.WithPassword(registryConf.Password),
@@ -119,7 +119,7 @@ func loadRegistries(targetRegistries string, registries
map[string]*RegistryConf
return urls
}
-func (c *RegistryConfig) getUrlMap(roleType common.RoleType) url.Values {
+func (c *RegistryConfig) getURLMap(roleType common.RoleType) url.Values {
urlMap := url.Values{}
urlMap.Set(constant.GROUP_KEY, c.Group)
urlMap.Set(constant.ROLE_KEY, strconv.Itoa(int(roleType)))
diff --git a/config/service_config.go b/config/service_config.go
index e8523bd..d73190c 100644
--- a/config/service_config.go
+++ b/config/service_config.go
@@ -341,7 +341,7 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL {
if c.exported.Load() {
var urls []*common.URL
for _, exporter := range c.exporters {
- urls = append(urls, exporter.GetInvoker().GetUrl())
+ urls = append(urls, exporter.GetInvoker().GetURL())
}
return urls
}
diff --git a/config_center/apollo/impl_test.go
b/config_center/apollo/impl_test.go
index 3b2cb16..4118cc4 100644
--- a/config_center/apollo/impl_test.go
+++ b/config_center/apollo/impl_test.go
@@ -195,7 +195,7 @@ func initMockApollo(t *testing.T) *apolloConfiguration {
}}
apollo := initApollo()
apolloUrl := strings.ReplaceAll(apollo.URL, "http", "apollo")
- url, err := common.NewURL(apolloUrl,
common.WithParams(c.ConfigCenterConfig.GetUrlMap()))
+ url, err := common.NewURL(apolloUrl,
common.WithParams(c.ConfigCenterConfig.GetURLMap()))
assert.NoError(t, err)
configuration, err := newApolloConfiguration(url)
assert.NoError(t, err)
diff --git a/config_center/configurator.go b/config_center/configurator.go
index 9db4804..f3558ad 100644
--- a/config_center/configurator.go
+++ b/config_center/configurator.go
@@ -21,8 +21,8 @@ import (
"github.com/apache/dubbo-go/common"
)
-// Configurator supports GetUrl and constructor
+// Configurator supports GetURL and constructor
type Configurator interface {
- GetUrl() *common.URL
+ GetURL() *common.URL
Configure(url *common.URL)
}
diff --git a/config_center/configurator/mock.go
b/config_center/configurator/mock.go
index 7ec7179..86a9d83 100644
--- a/config_center/configurator/mock.go
+++ b/config_center/configurator/mock.go
@@ -32,14 +32,14 @@ type mockConfigurator struct {
configuratorUrl *common.URL
}
-// GetUrl gets a configuratorUrl
-func (c *mockConfigurator) GetUrl() *common.URL {
+// GetURL gets a configuratorUrl
+func (c *mockConfigurator) GetURL() *common.URL {
return c.configuratorUrl
}
// Configure sets up param CLUSTER_KEY and cluster for url
func (c *mockConfigurator) Configure(url *common.URL) {
- if cluster := c.GetUrl().GetParam(constant.CLUSTER_KEY, ""); cluster !=
"" {
+ if cluster := c.GetURL().GetParam(constant.CLUSTER_KEY, ""); cluster !=
"" {
url.SetParam(constant.CLUSTER_KEY, cluster)
}
}
diff --git a/config_center/configurator/override.go
b/config_center/configurator/override.go
index 7f5abb6..2288a94 100644
--- a/config_center/configurator/override.go
+++ b/config_center/configurator/override.go
@@ -44,7 +44,7 @@ type overrideConfigurator struct {
configuratorUrl *common.URL
}
-func (c *overrideConfigurator) GetUrl() *common.URL {
+func (c *overrideConfigurator) GetURL() *common.URL {
return c.configuratorUrl
}
diff --git a/config_center/configurator/override_test.go
b/config_center/configurator/override_test.go
index 4d2552d..903f122 100644
--- a/config_center/configurator/override_test.go
+++ b/config_center/configurator/override_test.go
@@ -41,7 +41,7 @@ func TestConfigureVersion2p6(t *testing.T) {
url, err :=
common.NewURL("override://0.0.0.0:0/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService")
assert.NoError(t, err)
configurator := extension.GetConfigurator(defaults, url)
- assert.Equal(t, override, configurator.GetUrl().Protocol)
+ assert.Equal(t, override, configurator.GetURL().Protocol)
providerUrl, err :=
common.NewURL("jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&app.version=0.0.1&application=BDTService&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&group=&interface=com.ikurento.user.UserProvider&ip=10.32.20.124&loadbalance=random&methods.GetUser.loadbalance=random&methods.GetUser.retries=1&methods.GetUser.weight=0&module=dubbogo+user-info+server&name=BDTService&organization=ikurento.com&owner=ZX&pid=642
[...]
assert.NoError(t, err)
@@ -53,7 +53,7 @@ func TestConfigureVersionOverrideAddr(t *testing.T) {
url, err :=
common.NewURL("override://0.0.0.0:0/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService&providerAddresses=127.0.0.2:20001|127.0.0.3:20001")
assert.NoError(t, err)
configurator := extension.GetConfigurator(defaults, url)
- assert.Equal(t, override, configurator.GetUrl().Protocol)
+ assert.Equal(t, override, configurator.GetURL().Protocol)
providerUrl, err :=
common.NewURL("jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&app.version=0.0.1&application=BDTService&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&group=&interface=com.ikurento.user.UserProvider&ip=10.32.20.124&loadbalance=random&methods.GetUser.loadbalance=random&methods.GetUser.retries=1&methods.GetUser.weight=0&module=dubbogo+user-info+server&name=BDTService&organization=ikurento.com&owner=ZX&pid=642
[...]
assert.NoError(t, err)
@@ -65,7 +65,7 @@ func TestConfigureVersion2p6WithIp(t *testing.T) {
url, err :=
common.NewURL("override://127.0.0.1:20001/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService")
assert.NoError(t, err)
configurator := extension.GetConfigurator(defaults, url)
- assert.Equal(t, override, configurator.GetUrl().Protocol)
+ assert.Equal(t, override, configurator.GetURL().Protocol)
providerUrl, err :=
common.NewURL("jsonrpc://127.0.0.1:20001/com.ikurento.user.UserProvider?anyhost=true&app.version=0.0.1&application=BDTService&category=providers&cluster=failover&dubbo=dubbo-provider-golang-2.6.0&environment=dev&group=&interface=com.ikurento.user.UserProvider&ip=10.32.20.124&loadbalance=random&methods.GetUser.loadbalance=random&methods.GetUser.retries=1&methods.GetUser.weight=0&module=dubbogo+user-info+server&name=BDTService&organization=ikurento.com&owner=ZX&pid=642
[...]
assert.NoError(t, err)
diff --git a/config_center/nacos/client.go b/config_center/nacos/client.go
index 1e96b36..4d94043 100644
--- a/config_center/nacos/client.go
+++ b/config_center/nacos/client.go
@@ -85,7 +85,7 @@ func ValidateNacosClient(container nacosClientFacade, opts
...option) error {
opt(os)
}
- url := container.GetUrl()
+ url := container.GetURL()
timeout, err :=
time.ParseDuration(url.GetParam(constant.REGISTRY_TIMEOUT_KEY,
constant.DEFAULT_REG_TIMEOUT))
if err != nil {
logger.Errorf("invalid timeout config %+v,got err %+v",
diff --git a/config_center/nacos/impl.go b/config_center/nacos/impl.go
index 7c67930..82a903b 100644
--- a/config_center/nacos/impl.go
+++ b/config_center/nacos/impl.go
@@ -185,8 +185,8 @@ func (n *nacosDynamicConfiguration) GetDone() chan struct{}
{
return n.done
}
-// GetUrl Get Url
-func (n *nacosDynamicConfiguration) GetUrl() *common.URL {
+// GetURL Get URL
+func (n *nacosDynamicConfiguration) GetURL() *common.URL {
return n.url
}
diff --git a/config_center/zookeeper/impl.go b/config_center/zookeeper/impl.go
index e24e63f..e0d8bcd 100644
--- a/config_center/zookeeper/impl.go
+++ b/config_center/zookeeper/impl.go
@@ -184,7 +184,7 @@ func (c *zookeeperDynamicConfiguration) Done() chan
struct{} {
return c.done
}
-func (c *zookeeperDynamicConfiguration) GetUrl() *common.URL {
+func (c *zookeeperDynamicConfiguration) GetURL() *common.URL {
return c.url
}
diff --git a/config_center/zookeeper/impl_test.go
b/config_center/zookeeper/impl_test.go
index 7f17153..54007e8 100644
--- a/config_center/zookeeper/impl_test.go
+++ b/config_center/zookeeper/impl_test.go
@@ -55,7 +55,7 @@ func initZkData(group string, t *testing.T) (*zk.TestCluster,
*zookeeperDynamicC
assert.True(t, ok)
assert.NoError(t, err)
assert.True(t, zreg.IsAvailable())
- assert.Equal(t, zreg.GetUrl(), regurl)
+ assert.Equal(t, zreg.GetURL(), regurl)
assert.True(t, zreg.RestartCallBack())
zreg.SetParser(&parser.DefaultConfigurationParser{})
diff --git a/config_center/zookeeper/listener_test.go
b/config_center/zookeeper/listener_test.go
index a8c0754..07c7179 100644
--- a/config_center/zookeeper/listener_test.go
+++ b/config_center/zookeeper/listener_test.go
@@ -47,7 +47,7 @@ func initZkDynamicConfiguration(t *testing.T)
(*zk.TestCluster, *zookeeperDynami
assert.True(t, ok)
assert.NoError(t, err)
assert.True(t, zreg.IsAvailable())
- assert.Equal(t, zreg.GetUrl(), regurl)
+ assert.Equal(t, zreg.GetURL(), regurl)
assert.True(t, zreg.RestartCallBack())
zreg.SetParser(&parser.DefaultConfigurationParser{})
diff --git a/filter/filter_impl/access_log_filter.go
b/filter/filter_impl/access_log_filter.go
index 167b5ed..938f41f 100644
--- a/filter/filter_impl/access_log_filter.go
+++ b/filter/filter_impl/access_log_filter.go
@@ -80,7 +80,7 @@ type AccessLogFilter struct {
// Invoke will check whether user wants to use this filter.
// If we find the value of key constant.ACCESS_LOG_KEY, we will log the
invocation info
func (ef *AccessLogFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation) protocol.Result {
- accessLog := invoker.GetUrl().GetParam(constant.ACCESS_LOG_KEY, "")
+ accessLog := invoker.GetURL().GetParam(constant.ACCESS_LOG_KEY, "")
// the user do not
if len(accessLog) > 0 {
diff --git a/filter/filter_impl/active_filter.go
b/filter/filter_impl/active_filter.go
index 795de96..71a116b 100644
--- a/filter/filter_impl/active_filter.go
+++ b/filter/filter_impl/active_filter.go
@@ -47,7 +47,7 @@ type ActiveFilter struct {
func (ef *ActiveFilter) Invoke(ctx context.Context, invoker protocol.Invoker,
invocation protocol.Invocation) protocol.Result {
logger.Infof("invoking active filter. %v,%v", invocation.MethodName(),
len(invocation.Arguments()))
invocation.(*invocation2.RPCInvocation).SetAttachments(dubboInvokeStartTime,
strconv.FormatInt(protocol.CurrentTimeMillis(), 10))
- protocol.BeginCount(invoker.GetUrl(), invocation.MethodName())
+ protocol.BeginCount(invoker.GetURL(), invocation.MethodName())
return invoker.Invoke(ctx, invocation)
}
@@ -60,7 +60,7 @@ func (ef *ActiveFilter) OnResponse(ctx context.Context,
result protocol.Result,
return result
}
elapsed := protocol.CurrentTimeMillis() - startTime
- protocol.EndCount(invoker.GetUrl(), invocation.MethodName(), elapsed,
result.Error() == nil)
+ protocol.EndCount(invoker.GetURL(), invocation.MethodName(), elapsed,
result.Error() == nil)
return result
}
diff --git a/filter/filter_impl/active_filter_test.go
b/filter/filter_impl/active_filter_test.go
index 2397503..c616c6f 100644
--- a/filter/filter_impl/active_filter_test.go
+++ b/filter/filter_impl/active_filter_test.go
@@ -44,7 +44,7 @@ func TestActiveFilterInvoke(t *testing.T) {
defer ctrl.Finish()
invoker := mock.NewMockInvoker(ctrl)
invoker.EXPECT().Invoke(gomock.Any()).Return(nil)
- invoker.EXPECT().GetUrl().Return(url).Times(1)
+ invoker.EXPECT().GetURL().Return(url).Times(1)
filter.Invoke(context.Background(), invoker, invoc)
assert.True(t, invoc.AttachmentsByKey(dubboInvokeStartTime, "") != "")
@@ -61,7 +61,7 @@ func TestActiveFilterOnResponse(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
invoker := mock.NewMockInvoker(ctrl)
- invoker.EXPECT().GetUrl().Return(url).Times(1)
+ invoker.EXPECT().GetURL().Return(url).Times(1)
result := &protocol.RPCResult{
Err: errors.New("test"),
}
diff --git a/filter/filter_impl/auth/consumer_sign.go
b/filter/filter_impl/auth/consumer_sign.go
index 823db82..8f3f6df 100644
--- a/filter/filter_impl/auth/consumer_sign.go
+++ b/filter/filter_impl/auth/consumer_sign.go
@@ -40,7 +40,7 @@ func init() {
// Invoke retrieves the configured Authenticator to add signature to invocation
func (csf *ConsumerSignFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation) protocol.Result {
logger.Infof("invoking ConsumerSign filter.")
- url := invoker.GetUrl()
+ url := invoker.GetURL()
err := doAuthWork(url, func(authenticator filter.Authenticator) error {
return authenticator.Sign(invocation, url)
diff --git a/filter/filter_impl/auth/consumer_sign_test.go
b/filter/filter_impl/auth/consumer_sign_test.go
index b02380e..edd1b23 100644
--- a/filter/filter_impl/auth/consumer_sign_test.go
+++ b/filter/filter_impl/auth/consumer_sign_test.go
@@ -46,7 +46,7 @@ func TestConsumerSignFilter_Invoke(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
result := &protocol.RPCResult{}
invoker.EXPECT().Invoke(inv).Return(result).Times(2)
- invoker.EXPECT().GetUrl().Return(url).Times(2)
+ invoker.EXPECT().GetURL().Return(url).Times(2)
assert.Equal(t, result, filter.Invoke(context.Background(), invoker,
inv))
url.SetParam(constant.SERVICE_AUTH_KEY, "true")
diff --git a/filter/filter_impl/auth/provider_auth.go
b/filter/filter_impl/auth/provider_auth.go
index 774fdb2..f27e182 100644
--- a/filter/filter_impl/auth/provider_auth.go
+++ b/filter/filter_impl/auth/provider_auth.go
@@ -40,7 +40,7 @@ func init() {
// Invoke retrieves the configured Authenticator to verify the signature in an
invocation
func (paf *ProviderAuthFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation) protocol.Result {
logger.Infof("invoking providerAuth filter.")
- url := invoker.GetUrl()
+ url := invoker.GetURL()
err := doAuthWork(url, func(authenticator filter.Authenticator) error {
return authenticator.Authenticate(invocation, url)
diff --git a/filter/filter_impl/auth/provider_auth_test.go
b/filter/filter_impl/auth/provider_auth_test.go
index dc130b5..91a7479 100644
--- a/filter/filter_impl/auth/provider_auth_test.go
+++ b/filter/filter_impl/auth/provider_auth_test.go
@@ -66,7 +66,7 @@ func TestProviderAuthFilter_Invoke(t *testing.T) {
invoker := mock.NewMockInvoker(ctrl)
result := &protocol.RPCResult{}
invoker.EXPECT().Invoke(inv).Return(result).Times(2)
- invoker.EXPECT().GetUrl().Return(url).Times(2)
+ invoker.EXPECT().GetURL().Return(url).Times(2)
assert.Equal(t, result, filter.Invoke(context.Background(), invoker,
inv))
url.SetParam(constant.SERVICE_AUTH_KEY, "true")
assert.Equal(t, result, filter.Invoke(context.Background(), invoker,
inv))
diff --git a/filter/filter_impl/execute_limit_filter.go
b/filter/filter_impl/execute_limit_filter.go
index 3561161..598018f 100644
--- a/filter/filter_impl/execute_limit_filter.go
+++ b/filter/filter_impl/execute_limit_filter.go
@@ -82,7 +82,7 @@ type ExecuteState struct {
// Invoke judges whether the current processing requests over the threshold
func (ef *ExecuteLimitFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation) protocol.Result {
methodConfigPrefix := "methods." + invocation.MethodName() + "."
- ivkURL := invoker.GetUrl()
+ ivkURL := invoker.GetURL()
limitTarget := ivkURL.ServiceKey()
var limitRateConfig string
diff --git a/filter/filter_impl/generic_service_filter.go
b/filter/filter_impl/generic_service_filter.go
index 89b009b..e843f2e 100644
--- a/filter/filter_impl/generic_service_filter.go
+++ b/filter/filter_impl/generic_service_filter.go
@@ -71,7 +71,7 @@ func (ef *GenericServiceFilter) Invoke(ctx context.Context,
invoker protocol.Inv
oldParams []hessian.Object
)
- url := invoker.GetUrl()
+ url := invoker.GetURL()
methodName = invocation.Arguments()[0].(string)
// get service
svc := common.ServiceMap.GetServiceByServiceKey(url.Protocol,
url.ServiceKey())
diff --git a/filter/filter_impl/graceful_shutdown_filter.go
b/filter/filter_impl/graceful_shutdown_filter.go
index 4a4e8ce..27ca1e9 100644
--- a/filter/filter_impl/graceful_shutdown_filter.go
+++ b/filter/filter_impl/graceful_shutdown_filter.go
@@ -57,7 +57,7 @@ type gracefulShutdownFilter struct {
func (gf *gracefulShutdownFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation) protocol.Result {
if gf.rejectNewRequest() {
logger.Info("The application is closing, new request will be
rejected.")
- return
gf.getRejectHandler().RejectedExecution(invoker.GetUrl(), invocation)
+ return
gf.getRejectHandler().RejectedExecution(invoker.GetURL(), invocation)
}
atomic.AddInt32(&gf.activeCount, 1)
return invoker.Invoke(ctx, invocation)
diff --git a/filter/filter_impl/hystrix_filter.go
b/filter/filter_impl/hystrix_filter.go
index d13e02c..6a3180f 100644
--- a/filter/filter_impl/hystrix_filter.go
+++ b/filter/filter_impl/hystrix_filter.go
@@ -130,12 +130,12 @@ type HystrixFilter struct {
// Invoke is an implementation of filter, provides Hystrix pattern latency and
fault tolerance
func (hf *HystrixFilter) Invoke(ctx context.Context, invoker protocol.Invoker,
invocation protocol.Invocation) protocol.Result {
- cmdName := fmt.Sprintf("%s&method=%s", invoker.GetUrl().Key(),
invocation.MethodName())
+ cmdName := fmt.Sprintf("%s&method=%s", invoker.GetURL().Key(),
invocation.MethodName())
// Do the configuration if the circuit breaker is created for the first
time
if _, load := hf.ifNewMap.LoadOrStore(cmdName, true); !load {
configLoadMutex.Lock()
- filterConf := getConfig(invoker.GetUrl().Service(),
invocation.MethodName(), hf.COrP)
+ filterConf := getConfig(invoker.GetURL().Service(),
invocation.MethodName(), hf.COrP)
for _, ptn := range filterConf.Error {
reg, err := regexp.Compile(ptn)
if err != nil {
diff --git a/filter/filter_impl/sentinel_filter.go
b/filter/filter_impl/sentinel_filter.go
index 1de27ad..11accbd 100644
--- a/filter/filter_impl/sentinel_filter.go
+++ b/filter/filter_impl/sentinel_filter.go
@@ -214,9 +214,9 @@ func getResourceName(invoker protocol.Invoker, invocation
protocol.Invocation, p
sb.WriteString(prefix)
if getInterfaceGroupAndVersionEnabled() {
- interfaceResourceName = getColonSeparatedKey(invoker.GetUrl())
+ interfaceResourceName = getColonSeparatedKey(invoker.GetURL())
} else {
- interfaceResourceName = invoker.GetUrl().Service()
+ interfaceResourceName = invoker.GetURL().Service()
}
sb.WriteString(interfaceResourceName)
sb.WriteString(":")
diff --git a/filter/filter_impl/token_filter.go
b/filter/filter_impl/token_filter.go
index b5e0560..cc026b7 100644
--- a/filter/filter_impl/token_filter.go
+++ b/filter/filter_impl/token_filter.go
@@ -47,7 +47,7 @@ type TokenFilter struct{}
// Invoke verifies the incoming token with the service configured token
func (tf *TokenFilter) Invoke(ctx context.Context, invoker protocol.Invoker,
invocation protocol.Invocation) protocol.Result {
- invokerTkn := invoker.GetUrl().GetParam(constant.TOKEN_KEY, "")
+ invokerTkn := invoker.GetURL().GetParam(constant.TOKEN_KEY, "")
if len(invokerTkn) > 0 {
attachs := invocation.Attachments()
remoteTkn, exist := attachs[constant.TOKEN_KEY]
diff --git a/filter/filter_impl/tps_limit_filter.go
b/filter/filter_impl/tps_limit_filter.go
index ea1e3bc..57e563d 100644
--- a/filter/filter_impl/tps_limit_filter.go
+++ b/filter/filter_impl/tps_limit_filter.go
@@ -58,11 +58,11 @@ type TpsLimitFilter struct {
// Invoke gets the configured limter to impose TPS limiting
func (t TpsLimitFilter) Invoke(ctx context.Context, invoker protocol.Invoker,
invocation protocol.Invocation) protocol.Result {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
tpsLimiter := url.GetParam(constant.TPS_LIMITER_KEY, "")
rejectedExeHandler :=
url.GetParam(constant.TPS_REJECTED_EXECUTION_HANDLER_KEY, constant.DEFAULT_KEY)
if len(tpsLimiter) > 0 {
- allow :=
extension.GetTpsLimiter(tpsLimiter).IsAllowable(invoker.GetUrl(), invocation)
+ allow :=
extension.GetTpsLimiter(tpsLimiter).IsAllowable(invoker.GetURL(), invocation)
if allow {
return invoker.Invoke(ctx, invocation)
}
diff --git a/filter/filter_impl/tracing_filter.go
b/filter/filter_impl/tracing_filter.go
index dcdbe5b..89c89d1 100644
--- a/filter/filter_impl/tracing_filter.go
+++ b/filter/filter_impl/tracing_filter.go
@@ -58,7 +58,7 @@ func (tf *tracingFilter) Invoke(ctx context.Context, invoker
protocol.Invoker, i
spanCtx context.Context
span opentracing.Span
)
- operationName := invoker.GetUrl().ServiceKey() + "#" +
invocation.MethodName()
+ operationName := invoker.GetURL().ServiceKey() + "#" +
invocation.MethodName()
wiredCtx := ctx.Value(constant.TRACING_REMOTE_SPAN_CTX)
preSpan := opentracing.SpanFromContext(ctx)
diff --git a/metadata/service/inmemory/metadata_service_proxy_factory_test.go
b/metadata/service/inmemory/metadata_service_proxy_factory_test.go
index f5e519c..8dbb86f 100644
--- a/metadata/service/inmemory/metadata_service_proxy_factory_test.go
+++ b/metadata/service/inmemory/metadata_service_proxy_factory_test.go
@@ -81,7 +81,7 @@ func (m mockProtocol) Destroy() {
type mockInvoker struct {
}
-func (m *mockInvoker) GetUrl() *common.URL {
+func (m *mockInvoker) GetURL() *common.URL {
panic("implement me")
}
diff --git a/metrics/prometheus/reporter.go b/metrics/prometheus/reporter.go
index 266c820..c50589e 100644
--- a/metrics/prometheus/reporter.go
+++ b/metrics/prometheus/reporter.go
@@ -86,7 +86,7 @@ type PrometheusReporter struct {
// the role in url must be consumer or provider
// or it will be ignored
func (reporter *PrometheusReporter) Report(ctx context.Context, invoker
protocol.Invoker, invocation protocol.Invocation, cost time.Duration, res
protocol.Result) {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
var sumVec *prometheus.SummaryVec
var hisVec *prometheus.HistogramVec
if isProvider(url) {
diff --git a/protocol/dubbo/dubbo_exporter.go b/protocol/dubbo/dubbo_exporter.go
index 1873a63..34dc07d 100644
--- a/protocol/dubbo/dubbo_exporter.go
+++ b/protocol/dubbo/dubbo_exporter.go
@@ -42,9 +42,9 @@ func NewDubboExporter(key string, invoker protocol.Invoker,
exporterMap *sync.Ma
// Unexport unexport dubbo service exporter.
func (de *DubboExporter) Unexport() {
- interfaceName :=
de.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "")
+ interfaceName :=
de.GetInvoker().GetURL().GetParam(constant.INTERFACE_KEY, "")
de.BaseExporter.Unexport()
- err := common.ServiceMap.UnRegister(interfaceName, DUBBO,
de.GetInvoker().GetUrl().ServiceKey())
+ err := common.ServiceMap.UnRegister(interfaceName, DUBBO,
de.GetInvoker().GetURL().ServiceKey())
if err != nil {
logger.Errorf("[DubboExporter.Unexport] error: %v", err)
}
diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go
index bc85d73..5dbdcce 100644
--- a/protocol/dubbo/dubbo_invoker.go
+++ b/protocol/dubbo/dubbo_invoker.go
@@ -120,9 +120,9 @@ func (di *DubboInvoker) Invoke(ctx context.Context,
invocation protocol.Invocati
inv := invocation.(*invocation_impl.RPCInvocation)
// init param
- inv.SetAttachments(constant.PATH_KEY,
di.GetUrl().GetParam(constant.INTERFACE_KEY, ""))
+ inv.SetAttachments(constant.PATH_KEY,
di.GetURL().GetParam(constant.INTERFACE_KEY, ""))
for _, k := range attachmentKey {
- if v := di.GetUrl().GetParam(k, ""); len(v) > 0 {
+ if v := di.GetURL().GetParam(k, ""); len(v) > 0 {
inv.SetAttachments(k, v)
}
}
@@ -130,7 +130,7 @@ func (di *DubboInvoker) Invoke(ctx context.Context,
invocation protocol.Invocati
// put the ctx into attachment
di.appendCtx(ctx, inv)
- url := di.GetUrl()
+ url := di.GetURL()
// default hessian2 serialization, compatible
if url.GetParam(constant.SERIALIZATION_KEY, "") == "" {
url.SetParam(constant.SERIALIZATION_KEY,
constant.HESSIAN2_SERIALIZATION)
@@ -168,7 +168,7 @@ func (di *DubboInvoker) Invoke(ctx context.Context,
invocation protocol.Invocati
// get timeout including methodConfig
func (di *DubboInvoker) getTimeout(invocation *invocation_impl.RPCInvocation)
time.Duration {
- var timeout =
di.GetUrl().GetParam(strings.Join([]string{constant.METHOD_KEYS,
invocation.MethodName(), constant.TIMEOUT_KEY}, "."), "")
+ var timeout =
di.GetURL().GetParam(strings.Join([]string{constant.METHOD_KEYS,
invocation.MethodName(), constant.TIMEOUT_KEY}, "."), "")
if len(timeout) != 0 {
if t, err := time.ParseDuration(timeout); err == nil {
// config timeout into attachment
@@ -199,7 +199,7 @@ func (di *DubboInvoker) Destroy() {
activeNumber := client.DecreaseActiveNumber()
di.setClient(nil)
if activeNumber == 0 {
- exchangeClientMap.Delete(di.GetUrl().Location)
+ exchangeClientMap.Delete(di.GetURL().Location)
client.Close()
}
}
diff --git a/protocol/dubbo/dubbo_protocol.go b/protocol/dubbo/dubbo_protocol.go
index d6a71dc..94afbb1 100644
--- a/protocol/dubbo/dubbo_protocol.go
+++ b/protocol/dubbo/dubbo_protocol.go
@@ -79,7 +79,7 @@ func NewDubboProtocol() *DubboProtocol {
// Export export dubbo service.
func (dp *DubboProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
serviceKey := url.ServiceKey()
exporter := NewDubboExporter(serviceKey, invoker, dp.ExporterMap())
dp.SetExporterMap(serviceKey, exporter)
diff --git a/protocol/dubbo/dubbo_protocol_test.go
b/protocol/dubbo/dubbo_protocol_test.go
index f62cee1..97669a2 100644
--- a/protocol/dubbo/dubbo_protocol_test.go
+++ b/protocol/dubbo/dubbo_protocol_test.go
@@ -90,7 +90,7 @@ func TestDubboProtocol_Export(t *testing.T) {
assert.NoError(t, err)
exporter := proto.Export(protocol.NewBaseInvoker(url))
// make sure url
- eq := exporter.GetInvoker().GetUrl().URLEqual(url)
+ eq := exporter.GetInvoker().GetURL().URLEqual(url)
assert.True(t, eq)
// second service: the same path and the different version
@@ -98,7 +98,7 @@ func TestDubboProtocol_Export(t *testing.T) {
assert.NoError(t, err)
exporter2 := proto.Export(protocol.NewBaseInvoker(url2))
// make sure url
- eq2 := exporter2.GetInvoker().GetUrl().URLEqual(url2)
+ eq2 := exporter2.GetInvoker().GetURL().URLEqual(url2)
assert.True(t, eq2)
// make sure exporterMap after 'Unexport'
@@ -140,7 +140,7 @@ func TestDubboProtocol_Refer(t *testing.T) {
assert.NoError(t, err)
invoker := proto.Refer(url)
// make sure url
- eq := invoker.GetUrl().URLEqual(url)
+ eq := invoker.GetURL().URLEqual(url)
assert.True(t, eq)
// make sure invokers after 'Destroy'
diff --git a/protocol/grpc/grpc_exporter.go b/protocol/grpc/grpc_exporter.go
index 5beb4fe..76da1fb 100644
--- a/protocol/grpc/grpc_exporter.go
+++ b/protocol/grpc/grpc_exporter.go
@@ -42,9 +42,9 @@ func NewGrpcExporter(key string, invoker protocol.Invoker,
exporterMap *sync.Map
// Unexport and unregister gRPC service from registry and memory.
func (gg *GrpcExporter) Unexport() {
- interfaceName :=
gg.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "")
+ interfaceName :=
gg.GetInvoker().GetURL().GetParam(constant.INTERFACE_KEY, "")
gg.BaseExporter.Unexport()
- err := common.ServiceMap.UnRegister(interfaceName, GRPC,
gg.GetInvoker().GetUrl().ServiceKey())
+ err := common.ServiceMap.UnRegister(interfaceName, GRPC,
gg.GetInvoker().GetURL().ServiceKey())
if err != nil {
logger.Errorf("[GrpcExporter.Unexport] error: %v", err)
}
diff --git a/protocol/grpc/grpc_protocol.go b/protocol/grpc/grpc_protocol.go
index ec1f5aa..d06a835 100644
--- a/protocol/grpc/grpc_protocol.go
+++ b/protocol/grpc/grpc_protocol.go
@@ -58,7 +58,7 @@ func NewGRPCProtocol() *GrpcProtocol {
// Export gRPC service for remote invocation
func (gp *GrpcProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
serviceKey := url.ServiceKey()
exporter := NewGrpcExporter(serviceKey, invoker, gp.ExporterMap())
gp.SetExporterMap(serviceKey, exporter)
diff --git a/protocol/grpc/grpc_protocol_test.go
b/protocol/grpc/grpc_protocol_test.go
index 71f05d0..9b17ee4 100644
--- a/protocol/grpc/grpc_protocol_test.go
+++ b/protocol/grpc/grpc_protocol_test.go
@@ -79,7 +79,7 @@ func TestGrpcProtocolExport(t *testing.T) {
time.Sleep(time.Second)
// make sure url
- eq := exporter.GetInvoker().GetUrl().URLEqual(url)
+ eq := exporter.GetInvoker().GetURL().URLEqual(url)
assert.True(t, eq)
// make sure exporterMap after 'Unexport'
@@ -108,7 +108,7 @@ func TestGrpcProtocolRefer(t *testing.T) {
invoker := proto.Refer(url)
// make sure url
- eq := invoker.GetUrl().URLEqual(url)
+ eq := invoker.GetURL().URLEqual(url)
assert.True(t, eq)
// make sure invokers after 'Destroy'
diff --git a/protocol/invoker.go b/protocol/invoker.go
index e799991..6bf4d2c 100644
--- a/protocol/invoker.go
+++ b/protocol/invoker.go
@@ -71,8 +71,8 @@ func NewBaseInvoker(url *common.URL) *BaseInvoker {
return ivk
}
-// GetUrl gets base invoker URL
-func (bi *BaseInvoker) GetUrl() *common.URL {
+// GetURL gets base invoker URL
+func (bi *BaseInvoker) GetURL() *common.URL {
return bi.url
}
@@ -93,7 +93,7 @@ func (bi *BaseInvoker) Invoke(context context.Context,
invocation Invocation) Re
// Destroy changes available and destroyed flag
func (bi *BaseInvoker) Destroy() {
- logger.Infof("Destroy invoker: %s", bi.GetUrl())
+ logger.Infof("Destroy invoker: %s", bi.GetURL())
bi.destroyed.Store(true)
bi.available.Store(false)
}
diff --git a/protocol/invoker_test.go b/protocol/invoker_test.go
index c2a587d..5d78bde 100644
--- a/protocol/invoker_test.go
+++ b/protocol/invoker_test.go
@@ -34,7 +34,7 @@ func TestBaseInvoker(t *testing.T) {
assert.Nil(t, err)
ivk := NewBaseInvoker(url)
- assert.NotNil(t, ivk.GetUrl())
+ assert.NotNil(t, ivk.GetURL())
assert.True(t, ivk.IsAvailable())
assert.False(t, ivk.IsDestroyed())
diff --git a/protocol/jsonrpc/jsonrpc_exporter.go
b/protocol/jsonrpc/jsonrpc_exporter.go
index 6b91d26..32a637e 100644
--- a/protocol/jsonrpc/jsonrpc_exporter.go
+++ b/protocol/jsonrpc/jsonrpc_exporter.go
@@ -42,9 +42,9 @@ func NewJsonrpcExporter(key string, invoker protocol.Invoker,
exporterMap *sync.
// Unexport exported JSON RPC service.
func (je *JsonrpcExporter) Unexport() {
- interfaceName :=
je.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "")
+ interfaceName :=
je.GetInvoker().GetURL().GetParam(constant.INTERFACE_KEY, "")
je.BaseExporter.Unexport()
- err := common.ServiceMap.UnRegister(interfaceName, JSONRPC,
je.GetInvoker().GetUrl().ServiceKey())
+ err := common.ServiceMap.UnRegister(interfaceName, JSONRPC,
je.GetInvoker().GetURL().ServiceKey())
if err != nil {
logger.Errorf("[JsonrpcExporter.Unexport] error: %v", err)
}
diff --git a/protocol/jsonrpc/jsonrpc_invoker.go
b/protocol/jsonrpc/jsonrpc_invoker.go
index 357443f..b0f5a38 100644
--- a/protocol/jsonrpc/jsonrpc_invoker.go
+++ b/protocol/jsonrpc/jsonrpc_invoker.go
@@ -48,7 +48,7 @@ func (ji *JsonrpcInvoker) Invoke(ctx context.Context,
invocation protocol.Invoca
var result protocol.RPCResult
inv := invocation.(*invocation_impl.RPCInvocation)
- url := ji.GetUrl()
+ url := ji.GetURL()
req := ji.client.NewRequest(url, inv.MethodName(), inv.Arguments())
ctxNew := context.WithValue(ctx, constant.DUBBOGO_CTX_KEY,
map[string]string{
"X-Proxy-Id": "dubbogo",
diff --git a/protocol/jsonrpc/jsonrpc_protocol.go
b/protocol/jsonrpc/jsonrpc_protocol.go
index 643bcde..8dd59ed 100644
--- a/protocol/jsonrpc/jsonrpc_protocol.go
+++ b/protocol/jsonrpc/jsonrpc_protocol.go
@@ -61,7 +61,7 @@ func NewJsonrpcProtocol() *JsonrpcProtocol {
// Export JSON RPC service for remote invocation
func (jp *JsonrpcProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
serviceKey := strings.TrimPrefix(url.Path, "/")
exporter := NewJsonrpcExporter(serviceKey, invoker, jp.ExporterMap())
diff --git a/protocol/jsonrpc/jsonrpc_protocol_test.go
b/protocol/jsonrpc/jsonrpc_protocol_test.go
index 10a9016..76cbba7 100644
--- a/protocol/jsonrpc/jsonrpc_protocol_test.go
+++ b/protocol/jsonrpc/jsonrpc_protocol_test.go
@@ -46,7 +46,7 @@ func TestJsonrpcProtocolExport(t *testing.T) {
exporter := proto.Export(protocol.NewBaseInvoker(url))
// make sure url
- eq := exporter.GetInvoker().GetUrl().URLEqual(url)
+ eq := exporter.GetInvoker().GetURL().URLEqual(url)
assert.True(t, eq)
// make sure exporterMap after 'Unexport'
@@ -82,7 +82,7 @@ func TestJsonrpcProtocolRefer(t *testing.T) {
invoker := proto.Refer(url)
// make sure url
- eq := invoker.GetUrl().URLEqual(url)
+ eq := invoker.GetURL().URLEqual(url)
assert.True(t, eq)
// make sure invokers after 'Destroy'
diff --git a/protocol/mock/mock_invoker.go b/protocol/mock/mock_invoker.go
index 8a0973b..ed697cd 100644
--- a/protocol/mock/mock_invoker.go
+++ b/protocol/mock/mock_invoker.go
@@ -58,16 +58,16 @@ func (m *MockInvoker) EXPECT() *MockInvokerMockRecorder {
return m.recorder
}
-// GetUrl mocks base method
-func (m *MockInvoker) GetUrl() *common.URL {
- ret := m.ctrl.Call(m, "GetUrl")
+// GetURL mocks base method
+func (m *MockInvoker) GetURL() *common.URL {
+ ret := m.ctrl.Call(m, "GetURL")
ret0, _ := ret[0].(*common.URL)
return ret0
}
-// GetUrl indicates an expected call of GetUrl
-func (mr *MockInvokerMockRecorder) GetUrl() *gomock.Call {
- return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetUrl",
reflect.TypeOf((*MockInvoker)(nil).GetUrl))
+// GetURL indicates an expected call of GetURL
+func (mr *MockInvokerMockRecorder) GetURL() *gomock.Call {
+ return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetURL",
reflect.TypeOf((*MockInvoker)(nil).GetURL))
}
// IsAvailable mocks base method
diff --git a/protocol/protocolwrapper/protocol_filter_wrapper.go
b/protocol/protocolwrapper/protocol_filter_wrapper.go
index cfa4d24..affd085 100644
--- a/protocol/protocolwrapper/protocol_filter_wrapper.go
+++ b/protocol/protocolwrapper/protocol_filter_wrapper.go
@@ -48,7 +48,7 @@ type ProtocolFilterWrapper struct {
// Export service for remote invocation
func (pfw *ProtocolFilterWrapper) Export(invoker protocol.Invoker)
protocol.Exporter {
if pfw.protocol == nil {
- pfw.protocol = extension.GetProtocol(invoker.GetUrl().Protocol)
+ pfw.protocol = extension.GetProtocol(invoker.GetURL().Protocol)
}
invoker = BuildInvokerChain(invoker, constant.SERVICE_FILTER_KEY)
return pfw.protocol.Export(invoker)
@@ -72,7 +72,7 @@ func (pfw *ProtocolFilterWrapper) Destroy() {
}
func BuildInvokerChain(invoker protocol.Invoker, key string) protocol.Invoker {
- filterName := invoker.GetUrl().GetParam(key, "")
+ filterName := invoker.GetURL().GetParam(key, "")
if filterName == "" {
return invoker
}
@@ -105,8 +105,8 @@ type FilterInvoker struct {
}
// GetURL is used to get url from FilterInvoker
-func (fi *FilterInvoker) GetUrl() *common.URL {
- return fi.invoker.GetUrl()
+func (fi *FilterInvoker) GetURL() *common.URL {
+ return fi.invoker.GetURL()
}
// IsAvailable is used to get available status
diff --git a/protocol/rest/config/rest_config.go
b/protocol/rest/config/rest_config.go
index 27c67db..70a9903 100644
--- a/protocol/rest/config/rest_config.go
+++ b/protocol/rest/config/rest_config.go
@@ -69,7 +69,7 @@ func (c *RestProviderConfig) UnmarshalYAML(unmarshal
func(interface{}) error) er
// nolint
type RestServiceConfig struct {
InterfaceName string `required:"true"
yaml:"interface" json:"interface,omitempty" property:"interface"`
- Url string `yaml:"url"
json:"url,omitempty" property:"url"`
+ URL string `yaml:"url"
json:"url,omitempty" property:"url"`
Path string `yaml:"rest_path"
json:"rest_path,omitempty" property:"rest_path"`
Produces string `yaml:"rest_produces"
json:"rest_produces,omitempty" property:"rest_produces"`
Consumes string `yaml:"rest_consumes"
json:"rest_consumes,omitempty" property:"rest_consumes"`
@@ -96,7 +96,7 @@ func (c *RestServiceConfig) UnmarshalYAML(unmarshal
func(interface{}) error) err
type RestMethodConfig struct {
InterfaceName string
MethodName string `required:"true" yaml:"name"
json:"name,omitempty" property:"name"`
- Url string `yaml:"url" json:"url,omitempty" property:"url"`
+ URL string `yaml:"url" json:"url,omitempty" property:"url"`
Path string `yaml:"rest_path" json:"rest_path,omitempty"
property:"rest_path"`
Produces string `yaml:"rest_produces"
json:"rest_produces,omitempty" property:"rest_produces"`
Consumes string `yaml:"rest_consumes"
json:"rest_consumes,omitempty" property:"rest_consumes"`
diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go
index 7a49a20..1076f8f 100644
--- a/protocol/rest/rest_exporter.go
+++ b/protocol/rest/rest_exporter.go
@@ -42,9 +42,9 @@ func NewRestExporter(key string, invoker protocol.Invoker,
exporterMap *sync.Map
// Unexport unexport the RestExporter
func (re *RestExporter) Unexport() {
- interfaceName :=
re.GetInvoker().GetUrl().GetParam(constant.INTERFACE_KEY, "")
+ interfaceName :=
re.GetInvoker().GetURL().GetParam(constant.INTERFACE_KEY, "")
re.BaseExporter.Unexport()
- err := common.ServiceMap.UnRegister(interfaceName, REST,
re.GetInvoker().GetUrl().ServiceKey())
+ err := common.ServiceMap.UnRegister(interfaceName, REST,
re.GetInvoker().GetURL().ServiceKey())
if err != nil {
logger.Errorf("[RestExporter.Unexport] error: %v", err)
}
diff --git a/protocol/rest/rest_invoker.go b/protocol/rest/rest_invoker.go
index 898890e..a650f70 100644
--- a/protocol/rest/rest_invoker.go
+++ b/protocol/rest/rest_invoker.go
@@ -83,7 +83,7 @@ func (ri *RestInvoker) Invoke(ctx context.Context, invocation
protocol.Invocatio
body = inv.Arguments()[methodConfig.Body]
}
req := &client.RestClientRequest{
- Location: ri.GetUrl().Location,
+ Location: ri.GetURL().Location,
Method: methodConfig.MethodType,
Path: methodConfig.Path,
PathParams: pathParams,
diff --git a/protocol/rest/rest_protocol.go b/protocol/rest/rest_protocol.go
index d19bd00..011f5ee 100644
--- a/protocol/rest/rest_protocol.go
+++ b/protocol/rest/rest_protocol.go
@@ -68,7 +68,7 @@ func NewRestProtocol() *RestProtocol {
// Export export rest service
func (rp *RestProtocol) Export(invoker protocol.Invoker) protocol.Exporter {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
serviceKey := url.ServiceKey()
exporter := NewRestExporter(serviceKey, invoker, rp.ExporterMap())
id := url.GetParam(constant.BEAN_NAME_KEY, "")
diff --git a/protocol/rest/rest_protocol_test.go
b/protocol/rest/rest_protocol_test.go
index 580fc61..7e3fa84 100644
--- a/protocol/rest/rest_protocol_test.go
+++ b/protocol/rest/rest_protocol_test.go
@@ -56,7 +56,7 @@ func TestRestProtocolRefer(t *testing.T) {
invoker := proto.Refer(url)
// make sure url
- eq := invoker.GetUrl().URLEqual(url)
+ eq := invoker.GetURL().URLEqual(url)
assert.True(t, eq)
// make sure invokers after 'Destroy'
@@ -104,7 +104,7 @@ func TestRestProtocolExport(t *testing.T) {
proxyFactory := extension.GetProxyFactory("default")
exporter := proto.Export(proxyFactory.GetInvoker(url))
// make sure url
- eq := exporter.GetInvoker().GetUrl().URLEqual(url)
+ eq := exporter.GetInvoker().GetURL().URLEqual(url)
assert.True(t, eq)
// make sure exporterMap after 'Unexport'
fmt.Println(url.Path)
diff --git a/protocol/rest/server/rest_server.go
b/protocol/rest/server/rest_server.go
index b0bf0e0..e5fe40d 100644
--- a/protocol/rest/server/rest_server.go
+++ b/protocol/rest/server/rest_server.go
@@ -89,7 +89,7 @@ func GetRouteFunc(invoker protocol.Invoker, methodConfig
*rest_config.RestMethod
err error
args []interface{}
)
- svc :=
common.ServiceMap.GetServiceByServiceKey(invoker.GetUrl().Protocol,
invoker.GetUrl().ServiceKey())
+ svc :=
common.ServiceMap.GetServiceByServiceKey(invoker.GetURL().Protocol,
invoker.GetURL().ServiceKey())
// get method
method := svc.Method()[methodConfig.MethodName]
argsTypes := method.ArgsType()
diff --git a/protocol/rpc_status.go b/protocol/rpc_status.go
index 8fc5ddd..beaf687 100644
--- a/protocol/rpc_status.go
+++ b/protocol/rpc_status.go
@@ -203,21 +203,21 @@ func CleanAllStatus() {
// GetInvokerHealthyStatus get invoker's conn healthy status
func GetInvokerHealthyStatus(invoker Invoker) bool {
- _, found := invokerBlackList.Load(invoker.GetUrl().Key())
+ _, found := invokerBlackList.Load(invoker.GetURL().Key())
return !found
}
// SetInvokerUnhealthyStatus add target invoker to black list
func SetInvokerUnhealthyStatus(invoker Invoker) {
- invokerBlackList.Store(invoker.GetUrl().Key(), invoker)
- logger.Info("Add invoker ip = ", invoker.GetUrl().Location, " to black
list")
+ invokerBlackList.Store(invoker.GetURL().Key(), invoker)
+ logger.Info("Add invoker ip = ", invoker.GetURL().Location, " to black
list")
blackListCacheDirty.Store(true)
}
// RemoveInvokerUnhealthyStatus remove unhealthy status of target invoker from
blacklist
func RemoveInvokerUnhealthyStatus(invoker Invoker) {
- invokerBlackList.Delete(invoker.GetUrl().Key())
- logger.Info("Remove invoker ip = ", invoker.GetUrl().Location, " from
black list")
+ invokerBlackList.Delete(invoker.GetURL().Key())
+ logger.Info("Remove invoker ip = ", invoker.GetURL().Location, " from
black list")
blackListCacheDirty.Store(true)
}
diff --git a/registry/base_registry.go b/registry/base_registry.go
index df8c8a3..e39a242 100644
--- a/registry/base_registry.go
+++ b/registry/base_registry.go
@@ -112,8 +112,8 @@ func (r *BaseRegistry) InitBaseRegistry(url *common.URL,
facadeRegistry FacadeBa
return r
}
-// GetUrl for get registry's url
-func (r *BaseRegistry) GetUrl() *common.URL {
+// GetURL for get registry's url
+func (r *BaseRegistry) GetURL() *common.URL {
return r.URL
}
diff --git a/registry/consul/registry.go b/registry/consul/registry.go
index 4d3718e..a50536f 100644
--- a/registry/consul/registry.go
+++ b/registry/consul/registry.go
@@ -177,8 +177,8 @@ func (r *consulRegistry) getListener(url *common.URL)
(registry.Listener, error)
return listener, err
}
-// GetUrl get registry URL of consul registry center
-func (r *consulRegistry) GetUrl() *common.URL {
+// GetURL get registry URL of consul registry center
+func (r *consulRegistry) GetURL() *common.URL {
return r.URL
}
diff --git a/registry/directory/directory.go b/registry/directory/directory.go
index b5b9f71..263b248 100644
--- a/registry/directory/directory.go
+++ b/registry/directory/directory.go
@@ -297,7 +297,7 @@ func (dir *RegistryDirectory) toGroupInvokers()
[]protocol.Invoker {
})
for _, invoker := range newInvokersList {
- group := invoker.GetUrl().GetParam(constant.GROUP_KEY, "")
+ group := invoker.GetURL().GetParam(constant.GROUP_KEY, "")
groupInvokersMap[group] = append(groupInvokersMap[group],
invoker)
}
@@ -310,7 +310,7 @@ func (dir *RegistryDirectory) toGroupInvokers()
[]protocol.Invoker {
} else {
for _, invokers := range groupInvokersMap {
staticDir := directory.NewStaticDirectory(invokers)
- cst :=
extension.GetCluster(dir.GetUrl().SubURL.GetParam(constant.CLUSTER_KEY,
constant.DEFAULT_CLUSTER))
+ cst :=
extension.GetCluster(dir.GetURL().SubURL.GetParam(constant.CLUSTER_KEY,
constant.DEFAULT_CLUSTER))
err = staticDir.BuildRouterChain(invokers)
if err != nil {
logger.Error(err)
@@ -376,11 +376,11 @@ func (dir *RegistryDirectory) doCacheInvoker(newUrl
*common.URL) (protocol.Invok
} else {
// if cached invoker has the same URL with the new URL, then no
need to re-refer, and no need to destroy
// the old invoker.
- if common.GetCompareURLEqualFunc()(newUrl,
cacheInvoker.(protocol.Invoker).GetUrl()) {
+ if common.GetCompareURLEqualFunc()(newUrl,
cacheInvoker.(protocol.Invoker).GetURL()) {
return nil, true
}
- logger.Debugf("service will be updated in cache invokers: new
invoker url is %s, old invoker url is %s", newUrl,
cacheInvoker.(protocol.Invoker).GetUrl())
+ logger.Debugf("service will be updated in cache invokers: new
invoker url is %s, old invoker url is %s", newUrl,
cacheInvoker.(protocol.Invoker).GetURL())
newInvoker :=
extension.GetProtocol(protocolwrapper.FILTER).Refer(newUrl)
if newInvoker != nil {
dir.cacheInvokersMap.Store(key, newInvoker)
diff --git a/registry/directory/directory_test.go
b/registry/directory/directory_test.go
index b5d81eb..88f99d3 100644
--- a/registry/directory/directory_test.go
+++ b/registry/directory/directory_test.go
@@ -140,7 +140,7 @@ func Test_MergeProviderUrl(t *testing.T) {
time.Sleep(1e9)
assert.Len(t, registryDirectory.cacheInvokers, 1)
if len(registryDirectory.cacheInvokers) > 0 {
- assert.Equal(t, "mock",
registryDirectory.cacheInvokers[0].GetUrl().GetParam(constant.CLUSTER_KEY, ""))
+ assert.Equal(t, "mock",
registryDirectory.cacheInvokers[0].GetURL().GetParam(constant.CLUSTER_KEY, ""))
}
}
@@ -163,7 +163,7 @@ Loop1:
Loop2:
for {
if len(registryDirectory.cacheInvokers) > 0 {
- if "mock1" ==
registryDirectory.cacheInvokers[0].GetUrl().GetParam(constant.CLUSTER_KEY, "") {
+ if "mock1" ==
registryDirectory.cacheInvokers[0].GetURL().GetParam(constant.CLUSTER_KEY, "") {
assert.Len(t,
registryDirectory.cacheInvokers, 1)
assert.True(t, true)
break Loop2
@@ -183,7 +183,7 @@ func Test_toGroupInvokers(t *testing.T) {
defer ctrl.Finish()
invoker := mock.NewMockInvoker(ctrl)
newUrl, _ :=
common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
- invoker.EXPECT().GetUrl().Return(newUrl).AnyTimes()
+ invoker.EXPECT().GetURL().Return(newUrl).AnyTimes()
registryDirectory.cacheInvokersMap.Store("group1", invoker)
registryDirectory.cacheInvokersMap.Store("group2", invoker)
diff --git a/registry/mock_registry.go b/registry/mock_registry.go
index 6287bb0..044f961 100644
--- a/registry/mock_registry.go
+++ b/registry/mock_registry.go
@@ -71,7 +71,7 @@ func (r *MockRegistry) IsAvailable() bool {
}
// nolint
-func (r *MockRegistry) GetUrl() *common.URL {
+func (r *MockRegistry) GetURL() *common.URL {
return nil
}
diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go
index e9a4bd3..17064ad 100644
--- a/registry/nacos/registry.go
+++ b/registry/nacos/registry.go
@@ -214,8 +214,8 @@ func (nr *nacosRegistry) UnSubscribe(url *common.URL,
notifyListener registry.No
return perrors.New("UnSubscribe not support in nacosRegistry")
}
-// GetUrl gets its registration URL
-func (nr *nacosRegistry) GetUrl() *common.URL {
+// GetURL gets its registration URL
+func (nr *nacosRegistry) GetURL() *common.URL {
return nr.URL
}
diff --git a/registry/nacos/service_discovery_test.go
b/registry/nacos/service_discovery_test.go
index b6902ed..e073756 100644
--- a/registry/nacos/service_discovery_test.go
+++ b/registry/nacos/service_discovery_test.go
@@ -70,16 +70,6 @@ func Test_newNacosServiceDiscovery(t *testing.T) {
}
-func TestNacosServiceDiscovery_Destroy(t *testing.T) {
- prepareData()
- serviceDiscovery, err :=
extension.GetServiceDiscovery(constant.NACOS_KEY, testName)
- assert.Nil(t, err)
- assert.NotNil(t, serviceDiscovery)
- err = serviceDiscovery.Destroy()
- assert.Nil(t, err)
- assert.Nil(t, serviceDiscovery.(*nacosServiceDiscovery).namingClient)
-}
-
func TestNacosServiceDiscovery_CRUD(t *testing.T) {
if !checkNacosServerAlive() {
return
@@ -171,6 +161,16 @@ func TestNacosServiceDiscovery_GetDefaultPageSize(t
*testing.T) {
assert.Equal(t, registry.DefaultPageSize,
serviceDiscovery.GetDefaultPageSize())
}
+func TestNacosServiceDiscovery_Destroy(t *testing.T) {
+ prepareData()
+ serviceDiscovery, err :=
extension.GetServiceDiscovery(constant.NACOS_KEY, testName)
+ assert.Nil(t, err)
+ assert.NotNil(t, serviceDiscovery)
+ err = serviceDiscovery.Destroy()
+ assert.Nil(t, err)
+ assert.Nil(t, serviceDiscovery.(*nacosServiceDiscovery).namingClient)
+}
+
func prepareData() {
config.GetBaseConfig().ServiceDiscoveries[testName] =
&config.ServiceDiscoveryConfig{
Protocol: "nacos",
diff --git a/registry/protocol/protocol.go b/registry/protocol/protocol.go
index 8e928c2..e50e2b9 100644
--- a/registry/protocol/protocol.go
+++ b/registry/protocol/protocol.go
@@ -297,7 +297,7 @@ func (nl *overrideSubscribeListener)
doOverrideIfNecessary() {
providerUrl := getProviderUrl(nl.originInvoker)
key := getCacheKey(nl.originInvoker)
if exporter, ok := nl.protocol.bounds.Load(key); ok {
- currentUrl := exporter.(protocol.Exporter).GetInvoker().GetUrl()
+ currentUrl := exporter.(protocol.Exporter).GetInvoker().GetURL()
// Compatible with the 2.6.x
if nl.configurator != nil {
nl.configurator.Configure(providerUrl)
@@ -315,7 +315,7 @@ func (nl *overrideSubscribeListener)
doOverrideIfNecessary() {
}
if currentUrl.String() != providerUrl.String() {
- newRegUrl := nl.originInvoker.GetUrl().Clone()
+ newRegUrl := nl.originInvoker.GetURL().Clone()
setProviderUrl(newRegUrl, providerUrl)
nl.protocol.reExport(nl.originInvoker, newRegUrl)
}
@@ -406,7 +406,7 @@ func (proto *registryProtocol) Destroy() {
func getRegistryUrl(invoker protocol.Invoker) *common.URL {
// here add * for return a new url
- url := invoker.GetUrl()
+ url := invoker.GetURL()
// if the protocol == registry, set protocol the registry value in
url.params
if url.Protocol == constant.REGISTRY_PROTOCOL {
url.Protocol = url.GetParam(constant.REGISTRY_KEY, "")
@@ -415,7 +415,7 @@ func getRegistryUrl(invoker protocol.Invoker) *common.URL {
}
func getProviderUrl(invoker protocol.Invoker) *common.URL {
- url := invoker.GetUrl()
+ url := invoker.GetURL()
// be careful params maps in url is map type
return url.SubURL.Clone()
}
diff --git a/registry/protocol/protocol_test.go
b/registry/protocol/protocol_test.go
index 9796047..3f5389e 100644
--- a/registry/protocol/protocol_test.go
+++ b/registry/protocol/protocol_test.go
@@ -64,7 +64,7 @@ func referNormal(t *testing.T, regProtocol *registryProtocol)
{
invoker := regProtocol.Refer(url)
assert.IsType(t, &protocol.BaseInvoker{}, invoker)
- assert.Equal(t, invoker.GetUrl().String(), url.String())
+ assert.Equal(t, invoker.GetURL().String(), url.String())
}
func TestRefer(t *testing.T) {
@@ -134,7 +134,7 @@ func exporterNormal(t *testing.T, regProtocol
*registryProtocol) *common.URL {
exporter := regProtocol.Export(invoker)
assert.IsType(t, &protocol.BaseExporter{}, exporter)
- assert.Equal(t, exporter.GetInvoker().GetUrl().String(),
suburl.String())
+ assert.Equal(t, exporter.GetInvoker().GetURL().String(),
suburl.String())
return url
}
diff --git a/registry/servicediscovery/service_discovery_registry.go
b/registry/servicediscovery/service_discovery_registry.go
index c97a7f7..bf0e424 100644
--- a/registry/servicediscovery/service_discovery_registry.go
+++ b/registry/servicediscovery/service_discovery_registry.go
@@ -144,7 +144,7 @@ func (s *serviceDiscoveryRegistry) GetServiceDiscovery()
registry.ServiceDiscove
return s.serviceDiscovery
}
-func (s *serviceDiscoveryRegistry) GetUrl() *common.URL {
+func (s *serviceDiscoveryRegistry) GetURL() *common.URL {
return s.url
}
diff --git a/registry/zookeeper/service_discovery.go
b/registry/zookeeper/service_discovery.go
index 06fe0f7..1b04322 100644
--- a/registry/zookeeper/service_discovery.go
+++ b/registry/zookeeper/service_discovery.go
@@ -156,7 +156,7 @@ func (zksd *zookeeperServiceDiscovery) RestartCallBack()
bool {
}
// nolint
-func (zksd *zookeeperServiceDiscovery) GetUrl() *common.URL {
+func (zksd *zookeeperServiceDiscovery) GetURL() *common.URL {
return zksd.url
}
diff --git a/remoting/etcdv3/facade.go b/remoting/etcdv3/facade.go
index 614ba9a..ecda00b 100644
--- a/remoting/etcdv3/facade.go
+++ b/remoting/etcdv3/facade.go
@@ -62,7 +62,7 @@ LOOP:
case <-r.Client().Done():
r.ClientLock().Lock()
clientName := RegistryETCDV3Client
- timeout, _ :=
time.ParseDuration(r.GetUrl().GetParam(constant.REGISTRY_TIMEOUT_KEY,
constant.DEFAULT_REG_TIMEOUT))
+ timeout, _ :=
time.ParseDuration(r.GetURL().GetParam(constant.REGISTRY_TIMEOUT_KEY,
constant.DEFAULT_REG_TIMEOUT))
endpoints := r.Client().endpoints
r.Client().Close()
r.SetClient(nil)
diff --git a/remoting/exchange_server.go b/remoting/exchange_server.go
index a8d7c73..501e7ba 100644
--- a/remoting/exchange_server.go
+++ b/remoting/exchange_server.go
@@ -32,14 +32,14 @@ type Server interface {
// This is abstraction level. it is like facade.
type ExchangeServer struct {
Server Server
- Url *common.URL
+ URL *common.URL
}
// Create ExchangeServer
func NewExchangeServer(url *common.URL, server Server) *ExchangeServer {
exchangServer := &ExchangeServer{
Server: server,
- Url: url,
+ URL: url,
}
return exchangServer
}
diff --git a/remoting/kubernetes/client.go b/remoting/kubernetes/client.go
index ce6bccc..4feb5d3 100644
--- a/remoting/kubernetes/client.go
+++ b/remoting/kubernetes/client.go
@@ -173,7 +173,7 @@ func ValidateClient(container clientFacade) error {
// new Client
if client == nil || client.Valid() {
- newClient, err := newClient(container.GetUrl())
+ newClient, err := newClient(container.GetURL())
if err != nil {
logger.Warnf("new kubernetes client: %v)", err)
return perrors.WithMessage(err, "new kubernetes client")
diff --git a/remoting/kubernetes/facade_test.go
b/remoting/kubernetes/facade_test.go
index a6c6c02..9cefa9e 100644
--- a/remoting/kubernetes/facade_test.go
+++ b/remoting/kubernetes/facade_test.go
@@ -42,7 +42,7 @@ func (r *mockFacade) SetClient(client *Client) {
r.client = client
}
-func (r *mockFacade) GetUrl() *common.URL {
+func (r *mockFacade) GetURL() *common.URL {
return r.URL
}
diff --git a/remoting/zookeeper/client.go b/remoting/zookeeper/client.go
index 5d39666..bbc9b0a 100644
--- a/remoting/zookeeper/client.go
+++ b/remoting/zookeeper/client.go
@@ -48,7 +48,7 @@ var (
// ValidateZookeeperClient validates client and sets options
func ValidateZookeeperClient(container ZkClientFacade, zkName string) error {
lock := container.ZkClientLock()
- url := container.GetUrl()
+ url := container.GetURL()
lock.Lock()
defer lock.Unlock()
diff --git a/remoting/zookeeper/facade.go b/remoting/zookeeper/facade.go
index aeaa317..d735481 100644
--- a/remoting/zookeeper/facade.go
+++ b/remoting/zookeeper/facade.go
@@ -36,7 +36,7 @@ type ZkClientFacade interface {
WaitGroup() *sync.WaitGroup // for wait group control, zk client
listener & zk client container
Done() chan struct{} // for registry destroy
RestartCallBack() bool
- GetUrl() *common.URL
+ GetURL() *common.URL
}
// HandleClientRestart keeps the connection between client and server
diff --git a/remoting/zookeeper/facade_test.go
b/remoting/zookeeper/facade_test.go
index 6463e57..af8f887 100644
--- a/remoting/zookeeper/facade_test.go
+++ b/remoting/zookeeper/facade_test.go
@@ -90,7 +90,7 @@ func (r *mockFacade) Done() chan struct{} {
return r.done
}
-func (r *mockFacade) GetUrl() *common.URL {
+func (r *mockFacade) GetURL() *common.URL {
return r.URL
}