Newer
Older
/*
* 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.
*/
import (
"github.com/stretchr/testify/assert"
)
import (

AlexStocks
committed
"github.com/apache/dubbo-go/common/extension"

vito.he
committed
ApplicationConfig: &ApplicationConfig{
Organization: "dubbo_org",
Name: "dubbo",
Module: "module",
Version: "2.6.0",
Owner: "dubbo",
Environment: "test"},

vito.he
committed
Registries: map[string]*RegistryConfig{
"shanghai_reg1": {
Protocol: "mock",
TimeoutStr: "2s",
Group: "shanghai_idc",
Address: "127.0.0.1:2181",
Username: "user1",
Password: "pwd1",
},

vito.he
committed
"shanghai_reg2": {
Protocol: "mock",
TimeoutStr: "2s",
Group: "shanghai_idc",
Address: "127.0.0.2:2181",
Username: "user1",
Password: "pwd1",
},

vito.he
committed
"hangzhou_reg1": {
Protocol: "mock",
TimeoutStr: "2s",
Group: "hangzhou_idc",
Address: "127.0.0.3:2181",
Username: "user1",
Password: "pwd1",
},

vito.he
committed
"hangzhou_reg2": {
Protocol: "mock",
TimeoutStr: "2s",
Group: "hangzhou_idc",
Address: "127.0.0.4:2181",
Username: "user1",
Password: "pwd1",
},
},

vito.he
committed
Services: map[string]*ServiceConfig{
"MockService": {
Registry: "shanghai_reg1,shanghai_reg2,hangzhou_reg1,hangzhou_reg2",
Cluster: "failover",
Loadbalance: "random",
Retries: 3,
Group: "huadong_idc",
Version: "1.0.0",

vito.he
committed
Methods: []*MethodConfig{
{
Name: "GetUser",
Retries: 2,
Loadbalance: "random",
Weight: 200,
},
{
Name: "GetUser1",
Retries: 2,
Loadbalance: "random",
Weight: 200,
},
},
},
},

vito.he
committed
Protocols: map[string]*ProtocolConfig{
"mock": {
Name: "mock",
Ip: "127.0.0.1",
Port: "20000",

AlexStocks
committed
func Test_Export(t *testing.T) {
doinit()
extension.SetProtocol("registry", GetProtocol)
service := providerConfig.Services[i]