Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix zookeeper ut bug #334

Merged
merged 3 commits into from
Jul 11, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ classname=com.weibo.motan.benchmark.TestStringRunnable
params=1

# 10kString
# classname=com.weibo.motan.test.benchmark.TestStringRunnable
# classname=com.weibo.motan.benchmark.TestStringRunnable
# params=10

# Empty
# classname=com.weibo.motan.test.benchmark.TestEmptyRunnable
# classname=com.weibo.motan.benchmark.TestEmptyRunnable
# params=1

# Pojo
# classname=com.weibo.motan.test.benchmark.TestPojoRunnable
# classname=com.weibo.motan.benchmark.TestPojoRunnable
# params=1
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,16 @@
import java.util.*;

/**
*
* <pre>
* Interface config,
*
*
* 配置约定
* 1 service 和 referer 端相同的参数的含义一定相同;
* 2 service端参数的覆盖策略:protocol--basicConfig--service,前面的配置会被后面的config参数覆盖;
* 3 registry 参数不进入service、referer端的参数列表;
* 4 referer端从注册中心拿到参数后,先用referer端的参数覆盖,然后再使用该service
* </pre>
*
*
* @author fishermen
* @version V1.0 created at: 2013-5-27
*/
Expand Down Expand Up @@ -116,13 +115,12 @@ public class AbstractInterfaceConfig extends AbstractConfig {
protected Integer mingzSize;

protected String codec;
protected String localServiceAddress;

public Integer getRetries() {
return retries;
}

protected String localServiceAddress;

public void setRetries(Integer retries) {
this.retries = retries;
}
Expand Down Expand Up @@ -231,15 +229,15 @@ public String getCheck() {
return check;
}

public void setCheck(String check) {
this.check = check;
}

@Deprecated
public void setCheck(Boolean check) {
this.check = String.valueOf(check);
}

public void setCheck(String check) {
this.check = check;
}

public Boolean getShareChannel() {
return shareChannel;
}
Expand Down Expand Up @@ -339,8 +337,9 @@ protected List<URL> loadRegistryUrls() {
if (!map.containsKey(URLParamType.protocol.getName())) {
if (address.contains("://")) {
map.put(URLParamType.protocol.getName(), address.substring(0, address.indexOf("://")));
} else {
map.put(URLParamType.protocol.getName(), MotanConstants.REGISTRY_PROTOCOL_LOCAL);
}
map.put(URLParamType.protocol.getName(), MotanConstants.REGISTRY_PROTOCOL_LOCAL);
}
// address内部可能包含多个注册中心地址
List<URL> urls = UrlUtils.parseURLs(address, map);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@
import junit.framework.Assert;
import org.I0Itec.zkclient.ZkClient;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.InputStream;
import java.util.List;
import java.util.Properties;

public class ZookeeperRegistryTest {
private ZookeeperRegistry registry;
private URL serviceUrl, clientUrl;
private EmbeddedZookeeper zookeeper;
private ZkClient zkClient;
private String service = "com.weibo.motan.demoService";

@Before
public void setUp() throws Exception {
private static ZookeeperRegistry registry;
private static URL serviceUrl, clientUrl;
private static EmbeddedZookeeper zookeeper;
private static ZkClient zkClient;
private static String service = "com.weibo.motan.demoService";

@BeforeClass
public static void setUp() throws Exception {
Properties properties = new Properties();
InputStream in = EmbeddedZookeeper.class.getResourceAsStream("/zoo.cfg");
properties.load(in);
Expand All @@ -38,15 +38,15 @@ public void setUp() throws Exception {

zookeeper = new EmbeddedZookeeper();
zookeeper.start();
Thread.sleep(300);

zkClient = new ZkClient("127.0.0.1:" + port, 5000);
registry = new ZookeeperRegistry(zkUrl, zkClient);
}

@After
public void tearDown() throws Exception {
public void tearDown() {
zkClient.deleteRecursive(MotanConstants.ZOOKEEPER_REGISTRY_NAMESPACE);
zookeeper = null;
}

@Test
Expand Down