Skip to content

Commit e262719

Browse files
author
youzhihao
committed
合并主干的master到本地的fork分支
* remotes/upstream/master: Fix all unit test case Merge pull request apache#107 from sonicwu:master Open UT on travis Merge pull request apache#749 from Just-CJ:master Fix config error of heartbeat UT in dubbo-test-examples Merge pull request apache#755 from Elin-Zhou:master Merge pull request apache#748 from mysqto:master Merge pull request apache#765 from hollyshi:patch-1 Delete dubbo1 rpc protocol copatipable logic Create Contributing.md
2 parents 5400dbf + e4d8014 commit e262719

File tree

23 files changed

+120
-67
lines changed

23 files changed

+120
-67
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ jdk:
33
- oraclejdk8
44
- openjdk7
55

6-
script: mvn -DskipTests=true clean package
6+
script: mvn clean package

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
## Contributing to dubbo
3+
Dubbo is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into master. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.
4+
### Sign the Contributor License Agreement
5+
Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.
6+
### Code Conventions
7+
Our code style is almost in line with the standard java conventions(Popular IDE's default setting satisfy this), only changed the following two restricts:
8+
1. Classes under 'com.alibaba.*' and 'com.taobao.*' package are grouped separately, and put on top of all other 'imports'.
9+
2. If there are more than 120 characters in current line, start a new line.
10+
11+
We provide a template file [dubbo_codestyle_for_idea.xml](https://github.com/alibaba/dubbo/tree/master/codestyle/dubbo_codestyle_for_idea.xml) for IntelliJ idea, you can import it to you IDE. If you use Eclipse you can config manually by referencing the same file.
12+
13+
* Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and a @date tag identifying birth, and preferably at least a paragraph on what the class is for.
14+
15+
* Add the ASF license header comment to all new .java files (copy from existing files in the project)
16+
17+
* Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).
18+
19+
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
20+
21+
* A few unit tests should be added for a new feature or an important bugfix.
22+
23+
* If no-one else is using your branch, please rebase it against the current master (or other target branch in the main project).
24+
25+
* When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes #XXX at the end of the commit message (where XXX is the issue number).

dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/support/ClusterUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public static URL mergeUrl(URL remoteUrl, Map<String, String> localMap) {
8181
map.put(Constants.METHODS_KEY, methods);
8282
}
8383
// 保留provider的启动timestamp
84-
map.put(Constants.REMOTE_TIMESTAMP_KEY, remoteMap.get(Constants.TIMESTAMP_KEY));
84+
String remoteTimestamp = remoteMap.get(Constants.TIMESTAMP_KEY);
85+
if (remoteTimestamp != null && remoteTimestamp.length() > 0) {
86+
map.put(Constants.REMOTE_TIMESTAMP_KEY, remoteMap.get(Constants.TIMESTAMP_KEY));
87+
}
8588
// 合并filter和listener
8689
String remoteFilter = remoteMap.get(Constants.REFERENCE_FILTER_KEY);
8790
String localFilter = localMap.get(Constants.REFERENCE_FILTER_KEY);

dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/configurator/absent/AbsentConfiguratorTest.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
package com.alibaba.dubbo.rpc.cluster.configurator.absent;
1717

1818
import com.alibaba.dubbo.common.URL;
19+
import com.alibaba.dubbo.common.utils.NetUtils;
1920

2021
import junit.framework.Assert;
2122
import org.junit.Test;
@@ -31,33 +32,35 @@ public class AbsentConfiguratorTest {
3132
public void testOverride_Application() {
3233
AbsentConfigurator configurator = new AbsentConfigurator(URL.valueOf("override://foo@0.0.0.0/com.foo.BarService?timeout=200"));
3334

34-
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo"));
35+
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&side=consumer"));
3536
Assert.assertEquals("200", url.getParameter("timeout"));
3637

37-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000"));
38+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000&side=consumer"));
3839
Assert.assertEquals("1000", url.getParameter("timeout"));
3940

40-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar"));
41+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&side=consumer"));
4142
Assert.assertNull(url.getParameter("timeout"));
4243

43-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000"));
44+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000&side=consumer"));
4445
Assert.assertEquals("1000", url.getParameter("timeout"));
4546
}
4647

4748
@Test
4849
public void testOverride_Host() {
49-
AbsentConfigurator configurator = new AbsentConfigurator(URL.valueOf("override://10.20.153.10/com.foo.BarService?timeout=200"));
50+
AbsentConfigurator configurator = new AbsentConfigurator(URL.valueOf("override://" + NetUtils.getLocalHost() + "/com.foo.BarService?timeout=200"));
5051

51-
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo"));
52+
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&side=consumer"));
5253
Assert.assertEquals("200", url.getParameter("timeout"));
5354

54-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000"));
55+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000&side=consumer"));
5556
Assert.assertEquals("1000", url.getParameter("timeout"));
5657

57-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar"));
58+
AbsentConfigurator configurator1 = new AbsentConfigurator(URL.valueOf("override://10.20.153.10/com.foo.BarService?timeout=200"));
59+
60+
url = configurator1.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=bar&side=consumer"));
5861
Assert.assertNull(url.getParameter("timeout"));
5962

60-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000"));
63+
url = configurator1.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=bar&timeout=1000&side=consumer"));
6164
Assert.assertEquals("1000", url.getParameter("timeout"));
6265
}
6366

dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/configurator/override/OverrideConfiguratorTest.java

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
package com.alibaba.dubbo.rpc.cluster.configurator.override;
1717

1818
import com.alibaba.dubbo.common.URL;
19+
import com.alibaba.dubbo.common.utils.NetUtils;
20+
import com.alibaba.dubbo.rpc.cluster.configurator.absent.AbsentConfigurator;
1921

2022
import junit.framework.Assert;
2123
import org.junit.Test;
@@ -31,33 +33,35 @@ public class OverrideConfiguratorTest {
3133
public void testOverride_Application() {
3234
OverrideConfigurator configurator = new OverrideConfigurator(URL.valueOf("override://foo@0.0.0.0/com.foo.BarService?timeout=200"));
3335

34-
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo"));
36+
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&side=consumer"));
3537
Assert.assertEquals("200", url.getParameter("timeout"));
3638

37-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000"));
39+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000&side=consumer"));
3840
Assert.assertEquals("200", url.getParameter("timeout"));
3941

40-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar"));
42+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&side=consumer"));
4143
Assert.assertNull(url.getParameter("timeout"));
4244

43-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000"));
45+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000&side=consumer"));
4446
Assert.assertEquals("1000", url.getParameter("timeout"));
4547
}
4648

4749
@Test
4850
public void testOverride_Host() {
49-
OverrideConfigurator configurator = new OverrideConfigurator(URL.valueOf("override://10.20.153.10/com.foo.BarService?timeout=200"));
51+
OverrideConfigurator configurator = new OverrideConfigurator(URL.valueOf("override://" + NetUtils.getLocalHost() + "/com.foo.BarService?timeout=200"));
5052

51-
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo"));
53+
URL url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&side=consumer"));
5254
Assert.assertEquals("200", url.getParameter("timeout"));
5355

54-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000"));
56+
url = configurator.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=foo&timeout=1000&side=consumer"));
5557
Assert.assertEquals("200", url.getParameter("timeout"));
5658

57-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar"));
59+
AbsentConfigurator configurator1 = new AbsentConfigurator(URL.valueOf("override://10.20.153.10/com.foo.BarService?timeout=200"));
60+
61+
url = configurator1.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=bar&side=consumer"));
5862
Assert.assertNull(url.getParameter("timeout"));
5963

60-
url = configurator.configure(URL.valueOf("dubbo://10.20.153.11:20880/com.foo.BarService?application=bar&timeout=1000"));
64+
url = configurator1.configure(URL.valueOf("dubbo://10.20.153.10:20880/com.foo.BarService?application=bar&timeout=1000&side=consumer"));
6165
Assert.assertEquals("1000", url.getParameter("timeout"));
6266
}
6367

dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/DubboAppender.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public static void clear() {
4141

4242
public void append(LoggingEvent event) {
4343
super.append(event);
44-
if (available == true) {
44+
if (available) {
4545
Log temp = parseLog(event);
4646
logList.add(temp);
4747
}
@@ -56,4 +56,4 @@ private Log parseLog(LoggingEvent event) {
5656
return log;
5757
}
5858

59-
}
59+
}

dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/PojoUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,12 +412,16 @@ private static Object realize0(Object pojo, Class<?> type, Type genericType, fin
412412
Class<?> keyClazz;
413413
if (keyType instanceof Class) {
414414
keyClazz = (Class<?>) keyType;
415+
} else if (keyType instanceof ParameterizedType) {
416+
keyClazz = (Class<?>) ((ParameterizedType) keyType).getRawType();
415417
} else {
416418
keyClazz = entry.getKey() == null ? null : entry.getKey().getClass();
417419
}
418420
Class<?> valueClazz;
419421
if (valueType instanceof Class) {
420422
valueClazz = (Class<?>) valueType;
423+
} else if (valueType instanceof ParameterizedType) {
424+
valueClazz = (Class<?>) ((ParameterizedType) valueType).getRawType();
421425
} else {
422426
valueClazz = entry.getValue() == null ? null : entry.getValue().getClass();
423427
}

dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/AbstractInterfaceConfig.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,23 +272,23 @@ protected void checkStubAndMock(Class<?> interfaceClass) {
272272
if (ConfigUtils.isNotEmpty(local)) {
273273
Class<?> localClass = ConfigUtils.isDefault(local) ? ReflectUtils.forName(interfaceClass.getName() + "Local") : ReflectUtils.forName(local);
274274
if (!interfaceClass.isAssignableFrom(localClass)) {
275-
throw new IllegalStateException("The local implemention class " + localClass.getName() + " not implement interface " + interfaceClass.getName());
275+
throw new IllegalStateException("The local implementation class " + localClass.getName() + " not implement interface " + interfaceClass.getName());
276276
}
277277
try {
278278
ReflectUtils.findConstructor(localClass, interfaceClass);
279279
} catch (NoSuchMethodException e) {
280-
throw new IllegalStateException("No such constructor \"public " + localClass.getSimpleName() + "(" + interfaceClass.getName() + ")\" in local implemention class " + localClass.getName());
280+
throw new IllegalStateException("No such constructor \"public " + localClass.getSimpleName() + "(" + interfaceClass.getName() + ")\" in local implementation class " + localClass.getName());
281281
}
282282
}
283283
if (ConfigUtils.isNotEmpty(stub)) {
284284
Class<?> localClass = ConfigUtils.isDefault(stub) ? ReflectUtils.forName(interfaceClass.getName() + "Stub") : ReflectUtils.forName(stub);
285285
if (!interfaceClass.isAssignableFrom(localClass)) {
286-
throw new IllegalStateException("The local implemention class " + localClass.getName() + " not implement interface " + interfaceClass.getName());
286+
throw new IllegalStateException("The local implementation class " + localClass.getName() + " not implement interface " + interfaceClass.getName());
287287
}
288288
try {
289289
ReflectUtils.findConstructor(localClass, interfaceClass);
290290
} catch (NoSuchMethodException e) {
291-
throw new IllegalStateException("No such constructor \"public " + localClass.getSimpleName() + "(" + interfaceClass.getName() + ")\" in local implemention class " + localClass.getName());
291+
throw new IllegalStateException("No such constructor \"public " + localClass.getSimpleName() + "(" + interfaceClass.getName() + ")\" in local implementation class " + localClass.getName());
292292
}
293293
}
294294
if (ConfigUtils.isNotEmpty(mock)) {
@@ -302,12 +302,12 @@ protected void checkStubAndMock(Class<?> interfaceClass) {
302302
} else {
303303
Class<?> mockClass = ConfigUtils.isDefault(mock) ? ReflectUtils.forName(interfaceClass.getName() + "Mock") : ReflectUtils.forName(mock);
304304
if (!interfaceClass.isAssignableFrom(mockClass)) {
305-
throw new IllegalStateException("The mock implemention class " + mockClass.getName() + " not implement interface " + interfaceClass.getName());
305+
throw new IllegalStateException("The mock implementation class " + mockClass.getName() + " not implement interface " + interfaceClass.getName());
306306
}
307307
try {
308308
mockClass.getConstructor(new Class<?>[0]);
309309
} catch (NoSuchMethodException e) {
310-
throw new IllegalStateException("No such empty constructor \"public " + mockClass.getSimpleName() + "()\" in mock implemention class " + mockClass.getName());
310+
throw new IllegalStateException("No such empty constructor \"public " + mockClass.getSimpleName() + "()\" in mock implementation class " + mockClass.getName());
311311
}
312312
}
313313
}

dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/ServiceConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ protected synchronized void doExport() {
279279
throw new IllegalStateException(e.getMessage(), e);
280280
}
281281
if (!interfaceClass.isAssignableFrom(localClass)) {
282-
throw new IllegalStateException("The local implemention class " + localClass.getName() + " not implement interface " + interfaceName);
282+
throw new IllegalStateException("The local implementation class " + localClass.getName() + " not implement interface " + interfaceName);
283283
}
284284
}
285285
if (stub != null) {
@@ -293,7 +293,7 @@ protected synchronized void doExport() {
293293
throw new IllegalStateException(e.getMessage(), e);
294294
}
295295
if (!interfaceClass.isAssignableFrom(stubClass)) {
296-
throw new IllegalStateException("The stub implemention class " + stubClass.getName() + " not implement interface " + interfaceName);
296+
throw new IllegalStateException("The stub implementation class " + stubClass.getName() + " not implement interface " + interfaceName);
297297
}
298298
}
299299
checkApplication();

dubbo-config/dubbo-config-spring/src/main/resources/META-INF/dubbo.xsd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
</xsd:attribute>
5454
<xsd:attribute name="mock" type="xsd:string" use="optional">
5555
<xsd:annotation>
56-
<xsd:documentation><![CDATA[ Use service mock implemention. ]]></xsd:documentation>
56+
<xsd:documentation><![CDATA[ Use service mock implementation. ]]></xsd:documentation>
5757
</xsd:annotation>
5858
</xsd:attribute>
5959
<xsd:attribute name="merger" type="xsd:string" use="optional">
@@ -83,12 +83,12 @@
8383
</xsd:attribute>
8484
<xsd:attribute name="local" type="xsd:string" use="optional">
8585
<xsd:annotation>
86-
<xsd:documentation><![CDATA[ Use service local implemention. ]]></xsd:documentation>
86+
<xsd:documentation><![CDATA[ Use service local implementation. ]]></xsd:documentation>
8787
</xsd:annotation>
8888
</xsd:attribute>
8989
<xsd:attribute name="stub" type="xsd:string" use="optional">
9090
<xsd:annotation>
91-
<xsd:documentation><![CDATA[ Use service local implemention. ]]></xsd:documentation>
91+
<xsd:documentation><![CDATA[ Use service local implementation. ]]></xsd:documentation>
9292
</xsd:annotation>
9393
</xsd:attribute>
9494
<xsd:attribute name="proxy" type="xsd:string" use="optional">

0 commit comments

Comments
 (0)