Skip to content
Snippets Groups Projects
Commit 511f9865 authored by xujianhai666's avatar xujianhai666
Browse files

add forking

parent 21ffbef4
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,8 @@ package config
import (
"sync"
"testing"
"github.com/apache/dubbo-go/common/constant"
)
import (
......@@ -82,6 +84,7 @@ func doInit() {
"MockService": {
Params: map[string]string{
"serviceid": "soa.mock",
"forks": "5",
},
Registry: "shanghai_reg1,shanghai_reg2,hangzhou_reg1,hangzhou_reg2",
InterfaceName: "com.MockService",
......@@ -190,6 +193,23 @@ func Test_Implement(t *testing.T) {
consumerConfig = nil
}
func Test_Forking(t *testing.T) {
doInit()
extension.SetProtocol("dubbo", GetProtocol)
extension.SetProtocol("registry", GetProtocol)
m := consumerConfig.References["MockService"]
m.Url = "dubbo://127.0.0.1:20000;registry://127.0.0.2:20000"
for _, reference := range consumerConfig.References {
reference.Refer()
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)
}
consumerConfig = nil
}
func GetProtocol() protocol.Protocol {
if regProtocol != nil {
return regProtocol
......
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