From a8b515bb188780833dc687960efccba9dda7642d Mon Sep 17 00:00:00 2001 From: moriadry Date: Fri, 26 Apr 2019 15:13:26 +0800 Subject: [PATCH 1/2] fix typo --- .../extension/AdaptiveClassCodeGenerator.java | 4 +- .../dubbo/config/AbstractConfigTest.java | 2 +- .../support/AbstractRegistryTest.java | 52 +++++++++---------- .../remoting/transport/AbstractClient.java | 2 +- .../etcd/support/AbstractEtcdClient.java | 6 +-- .../dubbo/rpc/protocol/AbstractProtocol.java | 2 +- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGenerator.java b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGenerator.java index fcce47feaf1..50bf9508359 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGenerator.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/AdaptiveClassCodeGenerator.java @@ -224,7 +224,7 @@ private String generateMethodContent(Method method) { code.append(generateExtensionAssignment()); // return statement - code.append(generateReturnAndInovation(method)); + code.append(generateReturnAndInvocation(method)); } return code.toString(); @@ -292,7 +292,7 @@ private String generateExtensionAssignment() { /** * generate method invocation statement and return it if necessary */ - private String generateReturnAndInovation(Method method) { + private String generateReturnAndInvocation(Method method) { String returnStatement = method.getReturnType().equals(void.class) ? "" : "return "; String args = Arrays.stream(method.getParameters()).map(Parameter::getName).collect(Collectors.joining(", ")); diff --git a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java index 2d40cc369fd..10cac653e99 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/org/apache/dubbo/config/AbstractConfigTest.java @@ -306,7 +306,7 @@ public void testRefreshAll() { System.setProperty("dubbo.override.address", "system://127.0.0.1:2181"); System.setProperty("dubbo.override.protocol", "system"); - // this will not override, use 'key' instread, @Parameter(key="key1", useKeyAsProperty=false) + // this will not override, use 'key' instead, @Parameter(key="key1", useKeyAsProperty=false) System.setProperty("dubbo.override.key1", "system"); System.setProperty("dubbo.override.key2", "system"); diff --git a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java index 23364d06e4f..8c959ebe8a0 100644 --- a/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java +++ b/dubbo-registry/dubbo-registry-api/src/test/java/org/apache/dubbo/registry/support/AbstractRegistryTest.java @@ -312,20 +312,20 @@ public void testRecover2() throws Exception { @Test public void testNotify() throws Exception { final AtomicReference notified = new AtomicReference(false); - NotifyListener listner1 = urls -> notified.set(Boolean.TRUE); + NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer); - abstractRegistry.subscribe(url1, listner1); - NotifyListener listner2 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url1, listener1); + NotifyListener listener2 = urls -> notified.set(Boolean.TRUE); URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer); - abstractRegistry.subscribe(url2, listner2); - NotifyListener listner3 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url2, listener2); + NotifyListener listener3 = urls -> notified.set(Boolean.TRUE); URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer); - abstractRegistry.subscribe(url3, listner3); + abstractRegistry.subscribe(url3, listener3); List urls = new ArrayList<>(); urls.add(url1); urls.add(url2); urls.add(url3); - abstractRegistry.notify(url1, listner1, urls); + abstractRegistry.notify(url1, listener1, urls); Map>> map = abstractRegistry.getNotified(); MatcherAssert.assertThat(true, Matchers.equalTo(map.containsKey(url1))); MatcherAssert.assertThat(false, Matchers.equalTo(map.containsKey(url2))); @@ -338,15 +338,15 @@ public void testNotify() throws Exception { @Test public void testNotifyList() throws Exception { final AtomicReference notified = new AtomicReference(false); - NotifyListener listner1 = urls -> notified.set(Boolean.TRUE); + NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer); - abstractRegistry.subscribe(url1, listner1); - NotifyListener listner2 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url1, listener1); + NotifyListener listener2 = urls -> notified.set(Boolean.TRUE); URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer); - abstractRegistry.subscribe(url2, listner2); - NotifyListener listner3 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url2, listener2); + NotifyListener listener3 = urls -> notified.set(Boolean.TRUE); URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer); - abstractRegistry.subscribe(url3, listner3); + abstractRegistry.subscribe(url3, listener3); List urls = new ArrayList<>(); urls.add(url1); urls.add(url2); @@ -362,20 +362,20 @@ public void testNotifyList() throws Exception { public void testNotifyIfURLNull() throws Exception { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); - NotifyListener listner1 = urls -> notified.set(Boolean.TRUE); + NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer); - abstractRegistry.subscribe(url1, listner1); - NotifyListener listner2 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url1, listener1); + NotifyListener listener2 = urls -> notified.set(Boolean.TRUE); URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer); - abstractRegistry.subscribe(url2, listner2); - NotifyListener listner3 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url2, listener2); + NotifyListener listener3 = urls -> notified.set(Boolean.TRUE); URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer); - abstractRegistry.subscribe(url3, listner3); + abstractRegistry.subscribe(url3, listener3); List urls = new ArrayList<>(); urls.add(url1); urls.add(url2); urls.add(url3); - abstractRegistry.notify(null, listner1, urls); + abstractRegistry.notify(null, listener1, urls); Assertions.fail("notify url == null"); }); } @@ -384,15 +384,15 @@ public void testNotifyIfURLNull() throws Exception { public void testNotifyIfNotifyNull() { Assertions.assertThrows(IllegalArgumentException.class, () -> { final AtomicReference notified = new AtomicReference(false); - NotifyListener listner1 = urls -> notified.set(Boolean.TRUE); + NotifyListener listener1 = urls -> notified.set(Boolean.TRUE); URL url1 = new URL("dubbo", "192.168.0.1", 2200, parametersConsumer); - abstractRegistry.subscribe(url1, listner1); - NotifyListener listner2 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url1, listener1); + NotifyListener listener2 = urls -> notified.set(Boolean.TRUE); URL url2 = new URL("dubbo", "192.168.0.2", 2201, parametersConsumer); - abstractRegistry.subscribe(url2, listner2); - NotifyListener listner3 = urls -> notified.set(Boolean.TRUE); + abstractRegistry.subscribe(url2, listener2); + NotifyListener listener3 = urls -> notified.set(Boolean.TRUE); URL url3 = new URL("dubbo", "192.168.0.3", 2202, parametersConsumer); - abstractRegistry.subscribe(url3, listner3); + abstractRegistry.subscribe(url3, listener3); List urls = new ArrayList<>(); urls.add(url1); urls.add(url2); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java index 2afdc4d0f02..dd02651e018 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java @@ -192,7 +192,7 @@ protected void connect() throws RemotingException { } else { if (logger.isInfoEnabled()) { - logger.info("Successed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " " + logger.info("Succeed connect to server " + getRemoteAddress() + " from " + getClass().getSimpleName() + " " + NetUtils.getLocalHost() + " using dubbo version " + Version.getVersion() + ", channel is " + this.getChannel()); } diff --git a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/support/AbstractEtcdClient.java b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/support/AbstractEtcdClient.java index bf639ab3c93..0a6d26f90e9 100644 --- a/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/support/AbstractEtcdClient.java +++ b/dubbo-remoting/dubbo-remoting-etcd3/src/main/java/org/apache/dubbo/remoting/etcd/support/AbstractEtcdClient.java @@ -58,7 +58,7 @@ public abstract class AbstractEtcdClient implements EtcdClient private final Set stateListeners = new ConcurrentHashSet<>(); private final ConcurrentMap> childListeners = new ConcurrentHashMap<>(); - private final List categroies = Arrays.asList(Constants.PROVIDERS_CATEGORY + private final List categories = Arrays.asList(Constants.PROVIDERS_CATEGORY , Constants.CONSUMERS_CATEGORY , Constants.ROUTERS_CATEGORY , Constants.CONFIGURATORS_CATEGORY); @@ -158,11 +158,11 @@ protected void createParentIfAbsent(String fixedPath) { int i = fixedPath.lastIndexOf('/'); if (i > 0) { String parentPath = fixedPath.substring(0, i); - if (categroies.stream().anyMatch(c -> fixedPath.endsWith(c))) { + if (categories.stream().anyMatch(c -> fixedPath.endsWith(c))) { if (!checkExists(parentPath)) { this.doCreatePersistent(parentPath); } - } else if (categroies.stream().anyMatch(c -> parentPath.endsWith(c))) { + } else if (categories.stream().anyMatch(c -> parentPath.endsWith(c))) { String grandfather = parentPath.substring(0, parentPath.lastIndexOf('/')); if (!checkExists(grandfather)) { this.doCreatePersistent(grandfather); diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProtocol.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProtocol.java index 86ef44ca54a..814e9182280 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProtocol.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/protocol/AbstractProtocol.java @@ -40,7 +40,7 @@ public abstract class AbstractProtocol implements Protocol { protected final Map> exporterMap = new ConcurrentHashMap>(); - //TODO SOFEREFENCE + //TODO SoftReference protected final Set> invokers = new ConcurrentHashSet>(); protected static String serviceKey(URL url) { From dbddfbf94886b9288810a18f44c404ffaeb4affc Mon Sep 17 00:00:00 2001 From: moriadry Date: Fri, 26 Apr 2019 15:38:36 +0800 Subject: [PATCH 2/2] fix typo --- .../loadbalance/LeastActiveLoadBalance.java | 4 ++-- .../loadbalance/LeastActiveBalanceTest.java | 2 +- .../support/FailfastClusterInvokerTest.java | 4 ++-- .../beanutil/JavaBeanSerializeUtilTest.java | 18 +++++++++--------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java index 784195877be..0706053b52f 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveLoadBalance.java @@ -71,7 +71,7 @@ protected Invoker doSelect(List> invokers, URL url, Invocation leastActive = active; // Reset the number of least active invokers leastCount = 1; - // Put the first least active invoker first in leastIndexs + // Put the first least active invoker first in leastIndexes leastIndexes[0] = i; // Reset totalWeight totalWeight = afterWarmup; @@ -81,7 +81,7 @@ protected Invoker doSelect(List> invokers, URL url, Invocation sameWeight = true; // If current invoker's active value equals with leaseActive, then accumulating. } else if (active == leastActive) { - // Record the index of the least active invoker in leastIndexs order + // Record the index of the least active invoker in leastIndexes order leastIndexes[leastCount++] = i; // Accumulate the total weight of the least active invoker totalWeight += afterWarmup; diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java index 00b5c14db1b..89dc66be01c 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/loadbalance/LeastActiveBalanceTest.java @@ -35,7 +35,7 @@ public void testLeastActiveLoadBalance_select() { Long count = entry.getValue().get(); // System.out.println(count); Assertions.assertTrue( - Math.abs(count - runs / (0f + invokers.size())) < runs / (0f + invokers.size()), "abs diff shoud < avg"); + Math.abs(count - runs / (0f + invokers.size())) < runs / (0f + invokers.size()), "abs diff should < avg"); } } diff --git a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java index d8dd653f34e..9b6d2e88b73 100644 --- a/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java +++ b/dubbo-cluster/src/test/java/org/apache/dubbo/rpc/cluster/support/FailfastClusterInvokerTest.java @@ -80,7 +80,7 @@ private void resetInvoker1ToNoException() { } @Test - public void testInvokeExceptoin() { + public void testInvokeException() { Assertions.assertThrows(RpcException.class, () -> { resetInvoker1ToException(); FailfastClusterInvoker invoker = new FailfastClusterInvoker(dic); @@ -90,7 +90,7 @@ public void testInvokeExceptoin() { } @Test() - public void testInvokeNoExceptoin() { + public void testInvokeNoException() { resetInvoker1ToNoException(); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java index 5c72a14d3d0..4b3654a73d5 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/beanutil/JavaBeanSerializeUtilTest.java @@ -441,20 +441,20 @@ static void assertEqualsBigPerson(BigPerson person, Object obj) { assertEqualsPrimitive(person.getInfoProfile().isMale(), infoProfile.getProperty("male")); } - static void assertEqualsPhone(Phone excpected, Object obj) { + static void assertEqualsPhone(Phone expected, Object obj) { JavaBeanDescriptor descriptor = (JavaBeanDescriptor) obj; Assertions.assertTrue(descriptor.isBeanType()); - if (excpected.getArea() != null) { - assertEqualsPrimitive(excpected.getArea(), descriptor.getProperty("area")); + if (expected.getArea() != null) { + assertEqualsPrimitive(expected.getArea(), descriptor.getProperty("area")); } - if (excpected.getCountry() != null) { - assertEqualsPrimitive(excpected.getCountry(), descriptor.getProperty("country")); + if (expected.getCountry() != null) { + assertEqualsPrimitive(expected.getCountry(), descriptor.getProperty("country")); } - if (excpected.getExtensionNumber() != null) { - assertEqualsPrimitive(excpected.getExtensionNumber(), descriptor.getProperty("extensionNumber")); + if (expected.getExtensionNumber() != null) { + assertEqualsPrimitive(expected.getExtensionNumber(), descriptor.getProperty("extensionNumber")); } - if (excpected.getNumber() != null) { - assertEqualsPrimitive(excpected.getNumber(), descriptor.getProperty("number")); + if (expected.getNumber() != null) { + assertEqualsPrimitive(expected.getNumber(), descriptor.getProperty("number")); } }