[incubator-dubbo] branch master updated: [Dubbo-1684] add unit test for dubbo spring config (#1809)

2018-05-31 Thread wangxin
This is an automated email from the ASF dual-hosted git repository.

wangxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new b7dde72  [Dubbo-1684] add unit test for dubbo spring config (#1809)
b7dde72 is described below

commit b7dde7236ff255cc51e087f025dc096dc0395a00
Author: Huang YunKun 
AuthorDate: Fri Jun 1 13:07:03 2018 +0800

[Dubbo-1684] add unit test for dubbo spring config (#1809)

* add test for config spring module

* add more test for serviceBean and refBean
---
 .codecov.yml   |   3 +-
 .../alibaba/dubbo/config/spring/ConfigTest.java|   2 +-
 .../dubbo/config/spring/ServiceBeanTest.java   |  40 ++
 .../ReferenceAnnotationBeanPostProcessorTest.java  |  23 +++
 .../spring/schema/DubboNamespaceHandlerTest.java   | 160 +
 .../spring/status/DataSourceStatusCheckerTest.java | 100 +
 .../spring/status/SpringStatusCheckerTest.java |  80 +++
 .../META-INF/spring/dubbo-annotation-consumer.xml  |   3 +
 ...ay-fixed-time.xml => consumer-notification.xml} |  67 -
 .../dubbo/config/spring/delay-fixed-time.xml   |   5 +-
 .../{delay-fixed-time.xml => multi-monitor.xml}|  74 +-
 .../{delay-fixed-time.xml => provider-multi.xml}   |  80 ++-
 ...lay-fixed-time.xml => provider-with-module.xml} |  78 +-
 ...ay-fixed-time.xml => provider-with-monitor.xml} |  72 +-
 14 files changed, 601 insertions(+), 186 deletions(-)

diff --git a/.codecov.yml b/.codecov.yml
index bd786c1..3d04ce5 100644
--- a/.codecov.yml
+++ b/.codecov.yml
@@ -6,4 +6,5 @@ coverage:
 threshold: 0.1%
 ignore:
   - "dubbo-demo/.*"
-  - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #  
internal JSON impl is deprecate, ignore test coverage for them
\ No newline at end of file
+  - "dubbo-common/src/main/java/com/alibaba/dubbo/common/json/*.java" #  
internal JSON impl is deprecate, ignore test coverage for them
+  - 
"dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/AnnotationBean.java"
 # Deprecated
\ No newline at end of file
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
index 80de429..86c37be 100644
--- 
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ConfigTest.java
@@ -46,7 +46,7 @@ import com.alibaba.dubbo.rpc.RpcContext;
 import com.alibaba.dubbo.rpc.RpcException;
 import com.alibaba.dubbo.rpc.service.GenericException;
 import com.alibaba.dubbo.rpc.service.GenericService;
-import junit.framework.Assert;
+import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.springframework.beans.factory.BeanCreationException;
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
new file mode 100644
index 000..11f7055
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/ServiceBeanTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+package com.alibaba.dubbo.config.spring;
+
+import com.alibaba.dubbo.config.annotation.Service;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.mockito.Mockito.mock;
+
+public class ServiceBeanTest {
+@Test
+public void testGetService() {
+TestService service = mock(TestService.class);
+ServiceBean serviceBean = new ServiceBean(service);
+
+Service beanService = serviceBean.getService();
+Assert.assertThat(beanService, not(nullValue()));
+}
+
+abstract class TestService implements Service {
+
+}
+}
\ 

[incubator-dubbo.wiki] branch master updated: Updated New Committer Guide (markdown)

2018-05-31 Thread wangxin
This is an automated email from the ASF dual-hosted git repository.

wangxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.wiki.git


The following commit(s) were added to refs/heads/master by this push:
 new 1a10420  Updated New Committer Guide (markdown)
1a10420 is described below

commit 1a1042081ad23e43a37bce11043c652a6c4948b2
Author: Xin Wang 
AuthorDate: Fri Jun 1 00:42:36 2018 +0800

Updated New Committer Guide (markdown)
---
 New-Committer-Guide.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/New-Committer-Guide.md b/New-Committer-Guide.md
index c3007f8..d7380a7 100644
--- a/New-Committer-Guide.md
+++ b/New-Committer-Guide.md
@@ -2,7 +2,7 @@
 
 ##  First: How to become a committer
 
-### Initializes the initiator of the project hatching
+### Initializer committers at the project incubator stage
 At the project incubator stage, there will be an initialize committers list in 
the proposal of the incubator project. Confirm that you are one of the 
initialize committers. After the vote is passed in the Apache incubator 
community, the committer can start preparing his account. You can see 
[incubator wiki](https://wiki.apache.org/incubator/).
 
 ### The active contributor is elected as a committer

-- 
To stop receiving notification emails like this one, please contact
wang...@apache.org.


[incubator-dubbo.wiki] branch master updated: init new committer guide

2018-05-31 Thread wangxin
This is an automated email from the ASF dual-hosted git repository.

wangxin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.wiki.git


The following commit(s) were added to refs/heads/master by this push:
 new a2d5951  init new committer guide
a2d5951 is described below

commit a2d595194389566490c1608524b83e7ce7144d95
Author: Xin Wang 
AuthorDate: Fri Jun 1 00:16:30 2018 +0800

init new committer guide
---
 New-Committer-Guide.md | 90 ++
 1 file changed, 90 insertions(+)

diff --git a/New-Committer-Guide.md b/New-Committer-Guide.md
new file mode 100644
index 000..c3007f8
--- /dev/null
+++ b/New-Committer-Guide.md
@@ -0,0 +1,90 @@
+# Apache committer guide
+
+##  First: How to become a committer
+
+### Initializes the initiator of the project hatching
+At the project incubator stage, there will be an initialize committers list in 
the proposal of the incubator project. Confirm that you are one of the 
initialize committers. After the vote is passed in the Apache incubator 
community, the committer can start preparing his account. You can see 
[incubator wiki](https://wiki.apache.org/incubator/).
+
+### The active contributor is elected as a committer
+In the late development process, a active contributor can be elected as a 
committer. See [how to become a 
committer](https://www.apache.org/dev/new-committers-guide.html#becoming-a-committer)
+
+## Second: The individual contributor submits ICLA
+
+### 1, Apache ID
+Choose a Apache ID not in the [apache committers list 
page](http://people.apache.org/committer-index.html).
+
+### 2, Individual Contributor License Agreement  (ICLA):
+Download the [ICLA template](https://www.apache.org/licenses/icla.pdf) to find 
the available ID. After filling the icla.pdf personal information correctly, 
printing, signing, scanning, and sending mail as an attachment to the secretary 
secret...@apache.org, the secretary will help to create the Apache user ID. At 
the same time, a your...@apache.org mailbox can be created. You can see if the 
user has been created on the [apache committers list page 
(http://people.apache.org/committer-inde [...]
+
+## Third: Join the Apache developer group
+
+* 1, login the [Apache account tool](https://id.apache.org/), when you login 
at the first time, you can select the "Change password?" checkbox  to get the 
initializer password. Then the initializer password will be sent to the forward 
mailbox (the developer mail recorded in the project incubator proposal)
+
+* 2, about Apache mailbox: apache.org mailbox does not have its own mail 
content storage server. It needs to borrow other mail providers' mail content 
storage and mail sending functions. In many voting sessions, Apache mailbox is 
recommended.
+
+There is a question about how to configure the apache.org mailbox forwarding 
function in other mailboxes.
+
+1) inbox: to receive mails that sent to youer...@apache.org mailbox. The 
forward mailbox in the first step the configured int the Apache account tool 
can use forward mailbox to pick up the mail.
+
+2) the Outbox: the sent email will shows the sender as  your...@apache.org 
account. Please refer to: [set up Apache mailbox 
guide](https://reference.apache.org/committer/email) and [gmail mailbox 
setting]http://gmailblog.blogspot.com/2009/07/send-mail-from-another-address-without.html.
 In other mailbox service settings, this forwarding mode is not easy to find. 
Gmail is the most convenient, so it is recommended to use Gmail  (not 
advertising).
+
+* 3, Modify the homepage URL option in the edit page, homepage link of  your 
account can be added in [apache committer index 
page](http://people.apache.org/committer-index.html) 
+
+* 4, Modify the GitHub account in the edit page, and  an email will be sent to 
invite you to join the github.com/apache-commiiters group. Now, please learn 
from the way [ASF 
works](http://www.apache.org/foundation/how-it-works.html#developers) to do 
some basic preparation of ASF development.
+
+## Fourth: To obtain write permission of the project
+
+The operation of the [GitBox account link 
tool](https://gitbox.apache.org/setup/) 
+
+### 1, Apache account authorization
+
+According to the prompt, the OAuth protocol of Apache account is authorized to 
login.
+
+### 2, Github account authorization
+
+According to the prompt, the OAuth protocol of Github account is authorized to 
login.
+
+### 3, Set up GitHub account in github.com, two-factors authorization (2FA)
+
+According to [authorized GitHub 2FA 
wiki](https://help.github.com/articles/configuring-two-factor-authentication-via-a-totp-mobile-app/)
 operation:
+
+* 1) install Google identity checker on mobile phone app
+* 2), Following the [authorized GitHub 2FA 
wiki](https://help.github.com/articles/configuring-two-factor-authentication-via-a-totp-mobile-app/),
  you can operation step by step .
+
+In the [two-factors authorization 

[incubator-dubbo] branch master updated: Merge pull request #1843, support implicit delivery of attachments from provider to consumer.

2018-05-31 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new e506367  Merge pull request #1843, support implicit delivery of 
attachments from provider to consumer.
e506367 is described below

commit e5063679abf2ae2dc028b91b02cb8c8d41251a3d
Author: ken.lj 
AuthorDate: Thu May 31 16:21:55 2018 +0800

Merge pull request #1843, support implicit delivery of attachments from 
provider to consumer.

Fixes #889, #1466, #1834, #1466, #1524
---
 .../loadbalance/ConsistentHashLoadBalance.java |   8 +-
 .../java/com/alibaba/dubbo/common/Constants.java   |   4 +-
 .../java/com/alibaba/dubbo/common/Version.java |  46 ++-
 .../alibaba/dubbo/common/version/VersionTest.java  |  28 ++---
 .../dubbo/config/AbstractInterfaceConfig.java  |   4 +-
 .../com/alibaba/dubbo/config/ReferenceConfig.java  |   2 +-
 .../com/alibaba/dubbo/config/ServiceConfig.java|   2 +-
 .../com/alibaba/dubbo/config/cache/CacheTest.java  |   1 +
 .../spring/schema/DubboBeanDefinitionParser.java   |   3 +-
 .../remoting/exchange/codec/ExchangeCodec.java |  16 ++-
 .../support/header/HeaderExchangeChannel.java  |   5 +-
 .../support/header/HeaderExchangeServer.java   |   3 +-
 .../exchange/support/header/HeartBeatTask.java |   3 +-
 .../dubbo/remoting/codec/ExchangeCodecTest.java|  15 +--
 .../transport/codec/DeprecatedExchangeCodec.java   |   3 +-
 .../java/com/alibaba/dubbo/rpc/RpcContext.java |  24 
 .../main/java/com/alibaba/dubbo/rpc/RpcResult.java |  12 +-
 .../dubbo/rpc/filter/ConsumerContextFilter.java|   5 +-
 .../alibaba/dubbo/rpc/filter/ContextFilter.java|   7 +-
 .../protocol/dubbo/DecodeableRpcInvocation.java|   5 +-
 .../rpc/protocol/dubbo/DecodeableRpcResult.java|  30 +
 .../dubbo/rpc/protocol/dubbo/DubboCodec.java   |  36 --
 .../rpc/protocol/hessian/HessianProtocolTest.java  |   2 +-
 .../dubbo/rpc/protocol/hessian/HessianService.java |   2 +-
 .../rpc/protocol/hessian/HessianServiceImpl.java   |   2 +-
 .../dubbo/rpc/protocol/rmi/RmiProtocol.java|   2 +-
 .../dubbo/rpc/protocol/thrift/AbstractTest.java|   6 +-
 .../caucho/hessian/io/AbstractDeserializer.java|  15 ++-
 .../caucho/hessian/io/AbstractHessianInput.java|   9 +-
 .../caucho/hessian/io/CollectionDeserializer.java  |   4 +-
 .../com/caucho/hessian/io/Deserializer.java|  10 +-
 .../com/caucho/hessian/io/Hessian2Input.java   |  13 +-
 .../com/caucho/hessian/io/JavaDeserializer.java| 135 ++---
 .../com/caucho/hessian/io/SerializerFactory.java   |   2 +-
 .../caucho/hessian/io/Hessian2StringShortTest.java |  38 +++---
 .../hessian/io/beans/Hessian2StringShortType.java  |   4 +-
 .../com/caucho/hessian/io/beans/PersonType.java|   2 +-
 pom.xml|   4 +
 38 files changed, 329 insertions(+), 183 deletions(-)

diff --git 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
index 44c751d..ec86f1d 100644
--- 
a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
+++ 
b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
@@ -101,10 +101,10 @@ public class ConsistentHashLoadBalance extends 
AbstractLoadBalance {
 
 private Invoker selectForKey(long hash) {
 Map.Entry> entry = virtualInvokers.tailMap(hash, 
true).firstEntry();
-   if (entry == null) {
-   entry = virtualInvokers.firstEntry();
-   }
-   return entry.getValue();
+if (entry == null) {
+entry = virtualInvokers.firstEntry();
+}
+return entry.getValue();
 }
 
 private long hash(byte[] digest, int number) {
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java 
b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java
index 55e86d0..404fe8f 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/Constants.java
@@ -156,7 +156,7 @@ public class Constants {
 
 public static final String LOADBALANCE_KEY = "loadbalance";
 
-// key for router type, for e.g., "script"/"file",  corresponding to 
ScriptRouterFactory.NAME, FileRouterFactory.NAME 
+// key for router type, for e.g., "script"/"file",  corresponding to 
ScriptRouterFactory.NAME, FileRouterFactory.NAME
 public static final String ROUTER_KEY = "router";
 
 public static final String CLUSTER_KEY = "cluster";
@@ -624,7 +624,7 @@ public class Constants {
 public static 

[incubator-dubbo] branch master updated: Merge pull request #1837, spring spi support inject by type.

2018-05-31 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git


The following commit(s) were added to refs/heads/master by this push:
 new 5f5fecd  Merge pull request #1837, spring spi support inject by type.
5f5fecd is described below

commit 5f5fecd68e209c79a7f9ac382b95296713c77bea
Author: ken.lj 
AuthorDate: Thu May 31 16:11:00 2018 +0800

Merge pull request #1837, spring spi support inject by type.
---
 .../spring/extension/SpringExtensionFactory.java   | 28 +++
 .../config/spring/extension/BeanForContext2.java   | 31 +++
 .../extension/SpringExtensionFactoryTest.java  | 95 ++
 3 files changed, 154 insertions(+)

diff --git 
a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java
 
b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java
index a4c05c3..389515d 100644
--- 
a/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java
+++ 
b/dubbo-config/dubbo-config-spring/src/main/java/com/alibaba/dubbo/config/spring/extension/SpringExtensionFactory.java
@@ -17,7 +17,12 @@
 package com.alibaba.dubbo.config.spring.extension;
 
 import com.alibaba.dubbo.common.extension.ExtensionFactory;
+import com.alibaba.dubbo.common.logger.Logger;
+import com.alibaba.dubbo.common.logger.LoggerFactory;
 import com.alibaba.dubbo.common.utils.ConcurrentHashSet;
+
+import org.springframework.beans.factory.NoSuchBeanDefinitionException;
+import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
 import org.springframework.context.ApplicationContext;
 
 import java.util.Set;
@@ -26,6 +31,7 @@ import java.util.Set;
  * SpringExtensionFactory
  */
 public class SpringExtensionFactory implements ExtensionFactory {
+private static final Logger logger = 
LoggerFactory.getLogger(SpringExtensionFactory.class);
 
 private static final Set contexts = new 
ConcurrentHashSet();
 
@@ -37,6 +43,11 @@ public class SpringExtensionFactory implements 
ExtensionFactory {
 contexts.remove(context);
 }
 
+// currently for test purpose
+public static void clearContexts() {
+contexts.clear();
+}
+
 @Override
 @SuppressWarnings("unchecked")
 public  T getExtension(Class type, String name) {
@@ -48,6 +59,23 @@ public class SpringExtensionFactory implements 
ExtensionFactory {
 }
 }
 }
+
+logger.warn("No spring extension(bean) named:" + name + ", try to find 
an extension(bean) of type " + type.getName());
+
+for (ApplicationContext context : contexts) {
+try {
+return context.getBean(type);
+} catch (NoUniqueBeanDefinitionException multiBeanExe) {
+throw multiBeanExe;
+} catch (NoSuchBeanDefinitionException noBeanExe) {
+if (logger.isDebugEnabled()) {
+logger.debug("Error when get spring extension(bean) for 
type:" + type.getName(), noBeanExe);
+}
+}
+}
+
+logger.warn("No spring extension(bean) named:" + name + ", type:" + 
type.getName() + " found, stop get bean.");
+
 return null;
 }
 
diff --git 
a/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/extension/BeanForContext2.java
 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/extension/BeanForContext2.java
new file mode 100644
index 000..cc272d8
--- /dev/null
+++ 
b/dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/extension/BeanForContext2.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ */
+package com.alibaba.dubbo.config.spring.extension;
+
+import com.alibaba.dubbo.config.spring.api.DemoService;
+import com.alibaba.dubbo.config.spring.impl.DemoServiceImpl;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class 

[incubator-dubbo] branch master updated (fd7bab3 -> 1b553fd)

2018-05-31 Thread liujun
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git.


from fd7bab3  Merge pull request #1866, clarify license for codes 
referencing thirdparty repositories.
 add 1b553fd  Merge pull request #1820, improve graceful shutdown.

No new revisions were added by this update.

Summary of changes:
 .../org/apache/dubbo/bootstrap/DubboBootstrap.java | 74 ++---
 .../com/alibaba/dubbo/config/AbstractConfig.java   |  3 +
 .../alibaba/dubbo/config/DubboShutdownHook.java| 92 ++
 .../com/alibaba/dubbo/config/ProtocolConfig.java   |  8 ++
 .../initializer/DubboApplicationListener.java  |  6 +-
 .../initializer/DubboApplicationListenerTest.java  | 59 ++
 .../java/com/alibaba/dubbo/container/Main.java |  2 +-
 dubbo-container/dubbo-container-spring/pom.xml |  5 ++
 .../dubbo/container/spring/SpringContainer.java|  6 +-
 9 files changed, 134 insertions(+), 121 deletions(-)
 copy 
dubbo-bootstrap/src/main/java/org/apache/dubbo/bootstrap/DubboBootstrap.java => 
dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config/DubboShutdownHook.java
 (50%)
 create mode 100644 
dubbo-config/dubbo-config-spring/src/test/java/com/alibaba/dubbo/config/spring/initializer/DubboApplicationListenerTest.java

-- 
To stop receiving notification emails like this one, please contact
liu...@apache.org.