Skip to content

Commit

Permalink
use the correct spi ZookeeperTransporter when initialize the default …
Browse files Browse the repository at this point in the history
…ConfigCenter's zkClient(#4511)
  • Loading branch information
CodingSinger committed Jul 9, 2019
1 parent 519df67 commit 180b5d0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,7 @@ private void useRegistryForConfigIfNecessary() {
Environment.getInstance().getDynamicConfiguration().orElseGet(() -> {
ConfigManager configManager = ConfigManager.getInstance();
ConfigCenterConfig cc = configManager.getConfigCenter().orElse(new ConfigCenterConfig());
cc.setClient(rc.getClient());
cc.setProtocol(rc.getProtocol());
cc.setAddress(rc.getAddress());
cc.setHighestPriority(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ public class ConfigCenterConfig extends AbstractConfig {
*/
private Map<String, String> parameters;

/*
* as same as org.apache.dubbo.config.RegistryConfig.client
*/
private String client;

public ConfigCenterConfig() {
}

Expand Down Expand Up @@ -228,6 +233,14 @@ public void setParameters(Map<String, String> parameters) {
this.parameters = parameters;
}

public String getClient() {
return client;
}

public void setClient(String client) {
this.client = client;
}

@Override
@Parameter(excluded = true)
public boolean isValid() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ public void testPrefix() {
ConfigCenterConfig config = new ConfigCenterConfig();
Assertions.assertEquals("dubbo.config-center", config.getPrefix());
}

@Test
public void testAppendClientToUrl() {
ConfigCenterConfig config = new ConfigCenterConfig();
config.setClient("zk");
Assertions.assertEquals(config.toUrl().getParameter("client"), config.getClient());
}
}

0 comments on commit 180b5d0

Please sign in to comment.