[GitHub] diecui1202 commented on a change in pull request #1267: [dubbo-1267]add consistentHashLoadBalance test

2018-05-08 Thread GitBox
diecui1202 commented on a change in pull request #1267: [dubbo-1267]add 
consistentHashLoadBalance test 
URL: https://github.com/apache/incubator-dubbo/pull/1267#discussion_r186944520
 
 

 ##
 File path: 
dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java
 ##
 @@ -71,6 +73,14 @@ public void setUp() throws Exception {
 invoker3 = EasyMock.createMock(Invoker.class);
 invoker4 = EasyMock.createMock(Invoker.class);
 invoker5 = EasyMock.createMock(Invoker.class);
+invocationList = new ArrayList();
+for(int i=0; i<1000; i++){
+Invocation  invocation1 = EasyMock.createMock(Invocation.class);
+
EasyMock.expect(invocation1.getMethodName()).andReturn("method1").anyTimes();
+EasyMock.expect(invocation1.getArguments()).andReturn(new 
Object[]{randomString(3),randomString(5)}).anyTimes();
+EasyMock.replay(invocation1);
 
 Review comment:
   Here, we have changed test framework to Mockito, so could you change it to 
mockito again? Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org



[GitHub] diecui1202 commented on a change in pull request #1267: [dubbo-1267]add consistentHashLoadBalance test

2018-05-08 Thread GitBox
diecui1202 commented on a change in pull request #1267: [dubbo-1267]add 
consistentHashLoadBalance test 
URL: https://github.com/apache/incubator-dubbo/pull/1267#discussion_r186944295
 
 

 ##
 File path: 
dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java
 ##
 @@ -117,6 +127,18 @@ public void testRoundRobinLoadBalance_select() {
 }
 }
 
+@Test
+public void testConsistentHashLoadBalance_select() {
+Map counter = 
getInvokeCounter(ConsistentHashLoadBalance.NAME, invocationList);
+
+long runs = invocationList.size();
+for (Invoker minvoker : counter.keySet()) {
+Long count = counter.get(minvoker).get();
+float ratio = count/(runs / (0f + invokers.size()));
+Assert.assertTrue("invoker ratio must be gt 0.5 and lt 
2",ratio>0.5 && ratio< 2);
 
 Review comment:
   I also have the same concern.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org



[GitHub] diecui1202 commented on a change in pull request #1267: [dubbo-1267]add consistentHashLoadBalance test

2018-05-08 Thread GitBox
diecui1202 commented on a change in pull request #1267: [dubbo-1267]add 
consistentHashLoadBalance test 
URL: https://github.com/apache/incubator-dubbo/pull/1267#discussion_r186943993
 
 

 ##
 File path: 
dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java
 ##
 @@ -71,6 +73,14 @@ public void setUp() throws Exception {
 invoker3 = EasyMock.createMock(Invoker.class);
 invoker4 = EasyMock.createMock(Invoker.class);
 invoker5 = EasyMock.createMock(Invoker.class);
+invocationList = new ArrayList();
+for(int i=0; i<1000; i++){
 
 Review comment:
   Could you format the code ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org



[GitHub] diecui1202 commented on a change in pull request #1267: [dubbo-1267]add consistentHashLoadBalance test

2018-05-08 Thread GitBox
diecui1202 commented on a change in pull request #1267: [dubbo-1267]add 
consistentHashLoadBalance test 
URL: https://github.com/apache/incubator-dubbo/pull/1267#discussion_r186944119
 
 

 ##
 File path: 
dubbo-cluster/src/test/java/com/alibaba/dubbo/rpc/cluster/loadbalance/LoadBalanceTest.java
 ##
 @@ -71,6 +73,14 @@ public void setUp() throws Exception {
 invoker3 = EasyMock.createMock(Invoker.class);
 invoker4 = EasyMock.createMock(Invoker.class);
 invoker5 = EasyMock.createMock(Invoker.class);
+invocationList = new ArrayList();
+for(int i=0; i<1000; i++){
+Invocation  invocation1 = EasyMock.createMock(Invocation.class);
 
 Review comment:
   `invocation` is a better variable name here.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org



[GitHub] diecui1202 commented on a change in pull request #1267: [dubbo-1267]add consistentHashLoadBalance test

2018-05-08 Thread GitBox
diecui1202 commented on a change in pull request #1267: [dubbo-1267]add 
consistentHashLoadBalance test 
URL: https://github.com/apache/incubator-dubbo/pull/1267#discussion_r186939176
 
 

 ##
 File path: 
dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java
 ##
 @@ -36,6 +36,8 @@
  */
 public class ConsistentHashLoadBalance extends AbstractLoadBalance {
 
+public static final String NAME = "consistenthash";
 
 Review comment:
   IMO, this is ok.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org
For additional commands, e-mail: notifications-h...@dubbo.apache.org