Skip to content
Snippets Groups Projects
Commit 47732082 authored by vito.he's avatar vito.he
Browse files

Add:unit test for dynamic cc 2.6

parents 389c5f0e c2840ee6
No related branches found
No related tags found
No related merge requests found
Showing
with 144 additions and 58 deletions
...@@ -17,10 +17,15 @@ coverage.txt ...@@ -17,10 +17,15 @@ coverage.txt
target/ target/
classes classes
# go mod, go test
# Gopkg.lock
vendor/ vendor/
coverage.txt
logs/ logs/
.vscode/ .vscode/
coverage.txt coverage.txt
# unit test
remoting/zookeeper/zookeeper-4unittest/
config_center/zookeeper/zookeeper-4unittest/
registry/zookeeper/zookeeper-4unittest/
...@@ -176,8 +176,6 @@ ...@@ -176,8 +176,6 @@
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
Copyright (c) 2016 ~ 2018 Alex Stocks.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at
......
...@@ -33,19 +33,18 @@ Finished List: ...@@ -33,19 +33,18 @@ Finished List:
- Role: Consumer, Provider - Role: Consumer, Provider
- Transport: HTTP, TCP - Transport: HTTP, TCP
- Codec: JsonRPC v2, Hessian v2 - Codec: JsonRPC v2, Hessian v2
- Registry: ZooKeeper/[etcd](https://github.com/apache/dubbo-go/pull/148)/[nacos](https://github.com/apache/dubbo-go/pull/151) - Registry: ZooKeeper/[etcd v3](https://github.com/apache/dubbo-go/pull/148)/[nacos](https://github.com/apache/dubbo-go/pull/151)/[consul](https://github.com/apache/dubbo-go/pull/121)
- Configure Center: Zookeeper - Configure Center: Zookeeper
- Cluster Strategy: Failover/[Failfast](https://github.com/apache/dubbo-go/pull/140)/[Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136)/Available/Broadcast - Cluster Strategy: Failover/[Failfast](https://github.com/apache/dubbo-go/pull/140)/[Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136)/[Available](https://github.com/apache/dubbo-go/pull/155)/[Broadcast](https://github.com/apache/dubbo-go/pull/158)/[Forking](https://github.com/apache/dubbo-go/pull/161)
- Load Balance: Random/[RoundRobin](https://github.com/apache/dubbo-go/pull/66)/[LeastActive](https://github.com/apache/dubbo-go/pull/65) - Load Balance: Random/[RoundRobin](https://github.com/apache/dubbo-go/pull/66)/[LeastActive](https://github.com/apache/dubbo-go/pull/65)
- Filter: Echo Health Check - Filter: Echo Health Check/[Circuit break and service downgrade](https://github.com/apache/dubbo-go/pull/133)
- Other feature: [generic invoke](https://github.com/apache/dubbo-go/pull/122)/start check/connecting certain provider/multi-protocols/multi-registries/multi-versions/service group - Other feature: [generic invoke](https://github.com/apache/dubbo-go/pull/122)/start check/connecting certain provider/multi-protocols/multi-registries/multi-versions/service group
Working List: Working List:
- Cluster Strategy: Forking
- Load Balance: ConsistentHash - Load Balance: ConsistentHash
- Filter: TokenFilter/AccessLogFilter/CountFilter/ExecuteLimitFilter/TpsLimitFilter - Filter: TokenFilter/AccessLogFilter/CountFilter/ExecuteLimitFilter/TpsLimitFilter
- Registry: k8s/consul - Registry: k8s
- Configure Center: apollo - Configure Center: apollo
- Dynamic Configuration Center & Metadata Center (dubbo v2.7.x) - Dynamic Configuration Center & Metadata Center (dubbo v2.7.x)
- Metrics: Promethus(dubbo v2.7.x) - Metrics: Promethus(dubbo v2.7.x)
......
...@@ -32,11 +32,11 @@ Apache License, Version 2.0 ...@@ -32,11 +32,11 @@ Apache License, Version 2.0
- 角色端: Consumer, Provider - 角色端: Consumer, Provider
- 传输协议: HTTP, TCP - 传输协议: HTTP, TCP
- 序列化协议: JsonRPC v2, Hessian v2 - 序列化协议: JsonRPC v2, Hessian v2
- 注册中心: ZooKeeper/[etcd](https://github.com/apache/dubbo-go/pull/148)/[nacos](https://github.com/apache/dubbo-go/pull/151) - 注册中心: ZooKeeper/[etcd v3](https://github.com/apache/dubbo-go/pull/148)/[nacos](https://github.com/apache/dubbo-go/pull/151)/[consul](https://github.com/apache/dubbo-go/pull/121)
- 配置中心: Zookeeper - 配置中心: Zookeeper
- 集群策略: Failover/[Failfast](https://github.com/apache/dubbo-go/pull/140)/[Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136)/Available/Broadcast - 集群策略: Failover/[Failfast](https://github.com/apache/dubbo-go/pull/140)/[Failsafe/Failback](https://github.com/apache/dubbo-go/pull/136)/[Available](https://github.com/apache/dubbo-go/pull/155)/[Broadcast](https://github.com/apache/dubbo-go/pull/158)/[Forking](https://github.com/apache/dubbo-go/pull/161)
- 负载均衡策略: Random/[RoundRobin](https://github.com/apache/dubbo-go/pull/66)/[LeastActive](https://github.com/apache/dubbo-go/pull/65) - 负载均衡策略: Random/[RoundRobin](https://github.com/apache/dubbo-go/pull/66)/[LeastActive](https://github.com/apache/dubbo-go/pull/65)
- 过滤器: Echo Health Check - 过滤器: Echo Health Check/[服务熔断&降级](https://github.com/apache/dubbo-go/pull/133)
- 其他功能支持: [泛化调用](https://github.com/apache/dubbo-go/pull/122)/启动时检查/服务直连/多服务协议/多注册中心/多服务版本/服务分组 - 其他功能支持: [泛化调用](https://github.com/apache/dubbo-go/pull/122)/启动时检查/服务直连/多服务协议/多注册中心/多服务版本/服务分组
开发中列表: 开发中列表:
...@@ -44,7 +44,7 @@ Apache License, Version 2.0 ...@@ -44,7 +44,7 @@ Apache License, Version 2.0
- 集群策略: Forking - 集群策略: Forking
- 负载均衡策略: ConsistentHash - 负载均衡策略: ConsistentHash
- 过滤器: TokenFilter/AccessLogFilter/CountFilter/ExecuteLimitFilter/TpsLimitFilter - 过滤器: TokenFilter/AccessLogFilter/CountFilter/ExecuteLimitFilter/TpsLimitFilter
- 注册中心: etcd/k8s/consul/nacos - 注册中心: k8s
- 配置中心: apollo - 配置中心: apollo
- 动态配置中心 & 元数据中心 (dubbo v2.7.x) - 动态配置中心 & 元数据中心 (dubbo v2.7.x)
- Metrics: Promethus(dubbo v2.7.x) - Metrics: Promethus(dubbo v2.7.x)
......
mkdir -p remoting/zookeeper/zookeeper-4unittest/contrib/fatjar config_center/zookeeper/zookeeper-4unittest/contrib/fatjar registry/zookeeper/zookeeper-4unittest/contrib/fatjar
wget -P "remoting/zookeeper/zookeeper-4unittest/contrib/fatjar" https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/zookeeper-3.4.9-fatjar.jar
cp remoting/zookeeper/zookeeper-4unittest/contrib/fatjar/zookeeper-3.4.9-fatjar.jar config_center/zookeeper/zookeeper-4unittest/contrib/fatjar/
cp remoting/zookeeper/zookeeper-4unittest/contrib/fatjar/zookeeper-3.4.9-fatjar.jar registry/zookeeper/zookeeper-4unittest/contrib/fatjar/
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package loadbalance package loadbalance
import ( import (
......
...@@ -36,6 +36,7 @@ const ( ...@@ -36,6 +36,7 @@ const (
OVERRIDE_PROVIDERS_KEY = "providerAddresses" OVERRIDE_PROVIDERS_KEY = "providerAddresses"
BEAN_NAME_KEY = "bean.name" BEAN_NAME_KEY = "bean.name"
GENERIC_KEY = "generic" GENERIC_KEY = "generic"
CLASSIFIER_KEY = "classifier"
) )
const ( const (
......
...@@ -32,7 +32,7 @@ func SetConfigurator(name string, v func(url *common.URL) config_center.Configur ...@@ -32,7 +32,7 @@ func SetConfigurator(name string, v func(url *common.URL) config_center.Configur
func GetConfigurator(name string, url *common.URL) config_center.Configurator { func GetConfigurator(name string, url *common.URL) config_center.Configurator {
if configurator[name] == nil { if configurator[name] == nil {
panic("config center for " + name + " is not existing, make sure you have import the package.") panic("configurator for " + name + " is not existing, make sure you have import the package.")
} }
return configurator[name](url) return configurator[name](url)
...@@ -43,14 +43,14 @@ func SetDefaultConfigurator(v func(url *common.URL) config_center.Configurator) ...@@ -43,14 +43,14 @@ func SetDefaultConfigurator(v func(url *common.URL) config_center.Configurator)
func GetDefaultConfigurator(url *common.URL) config_center.Configurator { func GetDefaultConfigurator(url *common.URL) config_center.Configurator {
if configurator["default"] == nil { if configurator["default"] == nil {
panic("config center for default is not existing, make sure you have import the package.") panic("configurator for default is not existing, make sure you have import the package.")
} }
return configurator["default"](url) return configurator["default"](url)
} }
func GetDefaultConfiguratorFunc() func(url *common.URL) config_center.Configurator { func GetDefaultConfiguratorFunc() func(url *common.URL) config_center.Configurator {
if configurator["default"] == nil { if configurator["default"] == nil {
panic("config center for default is not existing, make sure you have import the package.") panic("configurator for default is not existing, make sure you have import the package.")
} }
return configurator["default"] return configurator["default"]
} }
...@@ -72,9 +72,9 @@ type baseUrl struct { ...@@ -72,9 +72,9 @@ type baseUrl struct {
Location string // ip+port Location string // ip+port
Ip string Ip string
Port string Port string
Params url.Values
//url.Values is not safe map, add to avoid concurrent map read and map write error //url.Values is not safe map, add to avoid concurrent map read and map write error
paramsLock sync.Mutex paramsLock sync.RWMutex
Params url.Values
PrimitiveURL string PrimitiveURL string
ctx context.Context ctx context.Context
} }
...@@ -114,16 +114,19 @@ func WithParams(params url.Values) option { ...@@ -114,16 +114,19 @@ func WithParams(params url.Values) option {
url.Params = params url.Params = params
} }
} }
func WithParamsValue(key, val string) option { func WithParamsValue(key, val string) option {
return func(url *URL) { return func(url *URL) {
url.Params.Set(key, val) url.Params.Set(key, val)
} }
} }
func WithProtocol(proto string) option { func WithProtocol(proto string) option {
return func(url *URL) { return func(url *URL) {
url.Protocol = proto url.Protocol = proto
} }
} }
func WithIp(ip string) option { func WithIp(ip string) option {
return func(url *URL) { return func(url *URL) {
url.Ip = ip url.Ip = ip
...@@ -147,6 +150,7 @@ func WithLocation(location string) option { ...@@ -147,6 +150,7 @@ func WithLocation(location string) option {
url.Location = location url.Location = location
} }
} }
func NewURLWithOptions(opts ...option) *URL { func NewURLWithOptions(opts ...option) *URL {
url := &URL{} url := &URL{}
for _, opt := range opts { for _, opt := range opts {
...@@ -259,8 +263,8 @@ func (c URL) String() string { ...@@ -259,8 +263,8 @@ func (c URL) String() string {
func (c URL) Key() string { func (c URL) Key() string {
buildString := fmt.Sprintf( buildString := fmt.Sprintf(
"%s://%s:%s@%s:%s/?interface=%s&group=%s&version=%s&category_key=%s", "%s://%s:%s@%s:%s/?interface=%s&group=%s&version=%s",
c.Protocol, c.Username, c.Password, c.Ip, c.Port, c.Service(), c.GetParam(constant.GROUP_KEY, ""), c.GetParam(constant.VERSION_KEY, ""), c.GetParam(constant.CATEGORY_KEY, "")) c.Protocol, c.Username, c.Password, c.Ip, c.Port, c.Service(), c.GetParam(constant.GROUP_KEY, ""), c.GetParam(constant.VERSION_KEY, ""))
return buildString return buildString
//return c.ServiceKey() //return c.ServiceKey()
} }
...@@ -318,11 +322,11 @@ func (c *URL) AddParam(key string, value string) { ...@@ -318,11 +322,11 @@ func (c *URL) AddParam(key string, value string) {
func (c URL) GetParam(s string, d string) string { func (c URL) GetParam(s string, d string) string {
var r string var r string
c.paramsLock.Lock() c.paramsLock.RLock()
if r = c.Params.Get(s); r == "" { if r = c.Params.Get(s); len(r) == 0 {
r = d r = d
} }
c.paramsLock.Unlock() c.paramsLock.RUnlock()
return r return r
} }
func (c URL) GetParamAndDecoded(key string) (string, error) { func (c URL) GetParamAndDecoded(key string) (string, error) {
...@@ -498,5 +502,9 @@ func MergeUrl(serviceUrl URL, referenceUrl *URL) URL { ...@@ -498,5 +502,9 @@ func MergeUrl(serviceUrl URL, referenceUrl *URL) URL {
func (c *URL) Clone() *URL { func (c *URL) Clone() *URL {
newUrl := &URL{} newUrl := &URL{}
copier.Copy(newUrl, c) copier.Copy(newUrl, c)
newUrl.Params = url.Values{}
for k, v := range c.Params {
newUrl.Params[k] = v
}
return newUrl return newUrl
} }
...@@ -36,8 +36,8 @@ var ( ...@@ -36,8 +36,8 @@ var (
maxWait = 3 maxWait = 3
) )
// loaded comsumer & provider config from xxx.yml, and log config from xxx.xml // loaded consumer & provider config from xxx.yml, and log config from xxx.xml
// Namely: dubbo.comsumer.xml & dubbo.provider.xml in java dubbo // Namely: dubbo.consumer.xml & dubbo.provider.xml in java dubbo
func init() { func init() {
var ( var (
confConFile, confProFile string confConFile, confProFile string
...@@ -70,9 +70,8 @@ func Load() { ...@@ -70,9 +70,8 @@ func Load() {
SetConsumerService(genericService) SetConsumerService(genericService)
} }
rpcService := GetConsumerService(key) rpcService := GetConsumerService(key)
if rpcService == nil { if rpcService == nil {
logger.Warnf("%s is not exsist!", key) logger.Warnf("%s does not exist!", key)
continue continue
} }
ref.id = key ref.id = key
...@@ -99,7 +98,7 @@ func Load() { ...@@ -99,7 +98,7 @@ func Load() {
break break
} }
if refconfig.invoker == nil { if refconfig.invoker == nil {
logger.Warnf("The interface %s invoker not exsist , may you should check your interface config.", refconfig.InterfaceName) logger.Warnf("The interface %s invoker not exist , may you should check your interface config.", refconfig.InterfaceName)
} }
} }
} }
...@@ -120,7 +119,7 @@ func Load() { ...@@ -120,7 +119,7 @@ func Load() {
for key, svs := range providerConfig.Services { for key, svs := range providerConfig.Services {
rpcService := GetProviderService(key) rpcService := GetProviderService(key)
if rpcService == nil { if rpcService == nil {
logger.Warnf("%s is not exsist!", key) logger.Warnf("%s does not exist!", key)
continue continue
} }
svs.id = key svs.id = key
......
...@@ -52,6 +52,7 @@ type ConsumerConfig struct { ...@@ -52,6 +52,7 @@ type ConsumerConfig struct {
Registries map[string]*RegistryConfig `yaml:"registries" json:"registries,omitempty" property:"registries"` Registries map[string]*RegistryConfig `yaml:"registries" json:"registries,omitempty" property:"registries"`
References map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"` References map[string]*ReferenceConfig `yaml:"references" json:"references,omitempty" property:"references"`
ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf"` ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf"`
FilterConf interface{} `yaml:"filter_conf" json:"filter_conf,omitempty" property:"filter_conf" `
} }
func (*ConsumerConfig) Prefix() string { func (*ConsumerConfig) Prefix() string {
......
...@@ -46,6 +46,7 @@ type ProviderConfig struct { ...@@ -46,6 +46,7 @@ type ProviderConfig struct {
Services map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"` Services map[string]*ServiceConfig `yaml:"services" json:"services,omitempty" property:"services"`
Protocols map[string]*ProtocolConfig `yaml:"protocols" json:"protocols,omitempty" property:"protocols"` Protocols map[string]*ProtocolConfig `yaml:"protocols" json:"protocols,omitempty" property:"protocols"`
ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf" ` ProtocolConf interface{} `yaml:"protocol_conf" json:"protocol_conf,omitempty" property:"protocol_conf" `
FilterConf interface{} `yaml:"filter_conf" json:"filter_conf,omitempty" property:"filter_conf" `
} }
func (*ProviderConfig) Prefix() string { func (*ProviderConfig) Prefix() string {
......
...@@ -20,8 +20,6 @@ package config ...@@ -20,8 +20,6 @@ package config
import ( import (
"sync" "sync"
"testing" "testing"
"github.com/apache/dubbo-go/common/constant"
) )
import ( import (
...@@ -31,6 +29,7 @@ import ( ...@@ -31,6 +29,7 @@ import (
import ( import (
"github.com/apache/dubbo-go/cluster/cluster_impl" "github.com/apache/dubbo-go/cluster/cluster_impl"
"github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/extension"
"github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol"
) )
......
...@@ -21,10 +21,6 @@ import ( ...@@ -21,10 +21,6 @@ import (
"testing" "testing"
) )
import (
"github.com/stretchr/testify/assert"
)
import ( import (
"github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/extension"
) )
...@@ -116,9 +112,6 @@ func Test_Export(t *testing.T) { ...@@ -116,9 +112,6 @@ func Test_Export(t *testing.T) {
service := providerConfig.Services[i] service := providerConfig.Services[i]
service.Implement(&MockService{}) service.Implement(&MockService{})
service.Export() service.Export()
assert.Condition(t, func() bool {
return len(service.exporters) > 0
})
} }
providerConfig = nil providerConfig = nil
} }
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package configurator package configurator
import ( import (
"github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/config_center"
) )
...@@ -18,5 +35,7 @@ func (c *mockConfigurator) GetUrl() *common.URL { ...@@ -18,5 +35,7 @@ func (c *mockConfigurator) GetUrl() *common.URL {
} }
func (c *mockConfigurator) Configure(url *common.URL) { func (c *mockConfigurator) Configure(url *common.URL) {
if cluster := c.GetUrl().GetParam(constant.CLUSTER_KEY, ""); cluster != "" {
url.Params.Set(constant.CLUSTER_KEY, cluster)
}
} }
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package configurator package configurator
import ( import (
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package configurator package configurator
import ( import (
"context" "context"
"testing"
)
import (
"github.com/stretchr/testify/assert"
)
import (
"github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/constant"
"github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/extension"
"github.com/stretchr/testify/assert"
"testing"
) )
func Test_configureVerison2p6(t *testing.T) { func Test_configureVerison2p6(t *testing.T) {
url, err := common.NewURL(context.Background(), "override://0.0.0.0:0/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService") url, err := common.NewURL(context.Background(), "override://0.0.0.0:0/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService")
assert.NoError(t, err) assert.NoError(t, err)
configurator := extension.GetConfigurator("override", &url) configurator := extension.GetConfigurator("default", &url)
assert.Equal(t, "override", configurator.GetUrl().Protocol) assert.Equal(t, "override", configurator.GetUrl().Protocol)
providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100") providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100")
...@@ -23,7 +43,7 @@ func Test_configureVerison2p6(t *testing.T) { ...@@ -23,7 +43,7 @@ func Test_configureVerison2p6(t *testing.T) {
func Test_configureVerisonOverrideAddr(t *testing.T) { func Test_configureVerisonOverrideAddr(t *testing.T) {
url, err := common.NewURL(context.Background(), "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") url, err := common.NewURL(context.Background(), "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) assert.NoError(t, err)
configurator := extension.GetConfigurator("override", &url) configurator := extension.GetConfigurator("default", &url)
assert.Equal(t, "override", configurator.GetUrl().Protocol) assert.Equal(t, "override", configurator.GetUrl().Protocol)
providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100") providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100")
...@@ -34,7 +54,7 @@ func Test_configureVerisonOverrideAddr(t *testing.T) { ...@@ -34,7 +54,7 @@ func Test_configureVerisonOverrideAddr(t *testing.T) {
func Test_configureVerison2p6WithIp(t *testing.T) { func Test_configureVerison2p6WithIp(t *testing.T) {
url, err := common.NewURL(context.Background(), "override://127.0.0.1:20001/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService") url, err := common.NewURL(context.Background(), "override://127.0.0.1:20001/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService")
assert.NoError(t, err) assert.NoError(t, err)
configurator := extension.GetConfigurator("override", &url) configurator := extension.GetConfigurator("default", &url)
assert.Equal(t, "override", configurator.GetUrl().Protocol) assert.Equal(t, "override", configurator.GetUrl().Protocol)
providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100") providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100")
...@@ -46,7 +66,7 @@ func Test_configureVerison2p6WithIp(t *testing.T) { ...@@ -46,7 +66,7 @@ func Test_configureVerison2p6WithIp(t *testing.T) {
func Test_configureVerison2p7(t *testing.T) { func Test_configureVerison2p7(t *testing.T) {
url, err := common.NewURL(context.Background(), "jsonrpc://0.0.0.0:20001/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService&configVersion=1.0&side=provider") url, err := common.NewURL(context.Background(), "jsonrpc://0.0.0.0:20001/com.xxx.mock.userProvider?group=1&version=1&cluster=failfast&application=BDTService&configVersion=1.0&side=provider")
assert.NoError(t, err) assert.NoError(t, err)
configurator := extension.GetConfigurator("override", &url) configurator := extension.GetConfigurator("default", &url)
providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100") providerUrl, err := common.NewURL(context.Background(), "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=64225&retries=0&service.filter=echo&side=provider&timestamp=1562076628&version=&warmup=100")
configurator.Configure(&providerUrl) configurator.Configure(&providerUrl)
......
...@@ -19,7 +19,6 @@ package zookeeper ...@@ -19,7 +19,6 @@ package zookeeper
import ( import (
"context" "context"
"fmt" "fmt"
"github.com/apache/dubbo-go/config_center/parser"
"sync" "sync"
"testing" "testing"
) )
...@@ -32,7 +31,7 @@ import ( ...@@ -32,7 +31,7 @@ import (
import ( import (
"github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common"
"github.com/apache/dubbo-go/config_center" "github.com/apache/dubbo-go/config_center"
"github.com/apache/dubbo-go/remoting" "github.com/apache/dubbo-go/config_center/parser"
) )
func initZkData(group string, t *testing.T) (*zk.TestCluster, *zookeeperDynamicConfiguration) { func initZkData(group string, t *testing.T) (*zk.TestCluster, *zookeeperDynamicConfiguration) {
...@@ -162,7 +161,7 @@ type mockDataListener struct { ...@@ -162,7 +161,7 @@ type mockDataListener struct {
event string event string
} }
func (l *mockDataListener) Process(configType *remoting.ConfigChangeEvent) { func (l *mockDataListener) Process(configType *config_center.ConfigChangeEvent) {
fmt.Println("process!!!!!") fmt.Println("process!!!!!")
l.wg.Done() l.wg.Done()
l.event = configType.Key l.event = configType.Key
......
...@@ -135,7 +135,7 @@ func initSignal() { ...@@ -135,7 +135,7 @@ func initSignal() {
case syscall.SIGHUP: case syscall.SIGHUP:
// reload() // reload()
default: default:
go time.AfterFunc(time.Duration(survivalTimeout)*time.Second, func() { time.AfterFunc(time.Duration(survivalTimeout)*time.Second, func() {
logger.Warnf("app exit now by force...") logger.Warnf("app exit now by force...")
os.Exit(1) os.Exit(1)
}) })
......
#!/usr/bin/env bash #!/usr/bin/env bash
# ****************************************************** #
# DESC : dubbogo app devops script # Licensed to the Apache Software Foundation (ASF) under one or more
# AUTHOR : Alex Stocks # contributor license agreements. See the NOTICE file distributed with
# VERSION : 1.0 # this work for additional information regarding copyright ownership.
# LICENCE : Apache License 2.0 # The ASF licenses this file to You under the Apache License, Version 2.0
# EMAIL : alexstocks@foxmail.com # (the "License"); you may not use this file except in compliance with
# MOD : 2016-05-13 02:01 # the License. You may obtain a copy of the License at
# FILE : load.sh #
# ****************************************************** # http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
APP_NAME="APPLICATION_NAME" APP_NAME="APPLICATION_NAME"
APP_ARGS="" APP_ARGS=""
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment