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

[Dubbo-3555] check if remoteGroup is empty or not to fix 3555 #3558

Merged
merged 4 commits into from
Mar 8, 2019
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 @@ -84,7 +84,9 @@ public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap) {
String remoteGroup = map.get(Constants.GROUP_KEY);
String remoteRelease = map.get(Constants.RELEASE_KEY);
map.putAll(localMap);
map.put(Constants.GROUP_KEY, remoteGroup);
if (StringUtils.isNotEmpty(remoteGroup)) {
map.put(Constants.GROUP_KEY, remoteGroup);
}
// we should always keep the Provider RELEASE_KEY not overrode by the the value on Consumer side.
map.remove(Constants.RELEASE_KEY);
if (StringUtils.isNotEmpty(remoteRelease)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import javax.script.ScriptEngineManager;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
Expand Down Expand Up @@ -677,8 +678,9 @@ public void testNotifyoverrideUrls_Nouse() {
registryDirectory.notify(durls);
List<Invoker<?>> invokers = registryDirectory.list(invocation);
Assertions.assertEquals(2, invokers.size());
Invoker<?> a1Invoker = invokers.get(0);
Invoker<?> b1Invoker = invokers.get(1);
Map<String, Invoker<?>> map = new HashMap<>();
map.put(invokers.get(0).getUrl().getAddress(), invokers.get(0));
map.put(invokers.get(1).getUrl().getAddress(), invokers.get(1));

durls = new ArrayList<URL>();
durls.add(URL.valueOf("override://0.0.0.0?timeout=1&connections=5"));
Expand All @@ -688,13 +690,15 @@ public void testNotifyoverrideUrls_Nouse() {
invokers = registryDirectory.list(invocation);
Assertions.assertEquals(2, invokers.size());

Invoker<?> a2Invoker = invokers.get(0);
Invoker<?> b2Invoker = invokers.get(1);
Map<String, Invoker<?>> map2 = new HashMap<>();
map2.put(invokers.get(0).getUrl().getAddress(), invokers.get(0));
map2.put(invokers.get(1).getUrl().getAddress(), invokers.get(1));

//The parameters are different and must be rereferenced.
Assertions.assertTrue(a1Invoker == a2Invoker, "object should not same");
Assertions.assertFalse(map.get(SERVICEURL.getAddress()) == map2.get(SERVICEURL.getAddress()), "object should not same");

//The parameters can not be rereferenced
Assertions.assertFalse(b1Invoker == b2Invoker, "object should same");
Assertions.assertTrue(map.get(SERVICEURL2.getAddress()) == map2.get(SERVICEURL2.getAddress()), "object should not same");
}

/**
Expand Down