You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2018/04/23 02:26:17 UTC
[incubator-servicecomb-java-chassis] 03/05: [SCB-487] fix bug:
avoid service center remote call during UT, which will cause random failed.
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit a62d7b968007f797cc5c877a68ddc0587137c5af
Author: wujimin <wu...@huawei.com>
AuthorDate: Sun Apr 22 13:15:14 2018 +0800
[SCB-487] fix bug: avoid service center remote call during UT, which will cause random failed.
---
.../serviceregistry/registry/RemoteServiceRegistry.java | 10 +++++-----
.../serviceregistry/registry/TestServiceRegistryFactory.java | 6 +++++-
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/RemoteServiceRegistry.java b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/RemoteServiceRegistry.java
index 2a60472..7e683d3 100644
--- a/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/RemoteServiceRegistry.java
+++ b/service-registry/src/main/java/org/apache/servicecomb/serviceregistry/registry/RemoteServiceRegistry.java
@@ -82,11 +82,11 @@ public class RemoteServiceRegistry extends AbstractServiceRegistry {
serviceRegistryConfig.getHeartbeatInterval(),
TimeUnit.SECONDS);
- taskPool.scheduleAtFixedRate(
- () -> eventBus.post(new PeriodicPullEvent()),
- serviceRegistryConfig.getInstancePullInterval(),
- serviceRegistryConfig.getInstancePullInterval(),
- TimeUnit.SECONDS);
+ taskPool.scheduleAtFixedRate(
+ () -> eventBus.post(new PeriodicPullEvent()),
+ serviceRegistryConfig.getInstancePullInterval(),
+ serviceRegistryConfig.getInstancePullInterval(),
+ TimeUnit.SECONDS);
}
diff --git a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestServiceRegistryFactory.java b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestServiceRegistryFactory.java
index 1e62441..07f7e08 100644
--- a/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestServiceRegistryFactory.java
+++ b/service-registry/src/test/java/org/apache/servicecomb/serviceregistry/registry/TestServiceRegistryFactory.java
@@ -31,13 +31,17 @@ import org.junit.Test;
import com.google.common.eventbus.EventBus;
import mockit.Deencapsulation;
+import mockit.Mocked;
/**
* Created by on 2017/3/31.
*/
public class TestServiceRegistryFactory {
@Test
- public void testGetRemoteRegistryClient() {
+ // mock ServiceRegistryClientImpl to avoid send request to remote SC
+ // even there is no any reference to registryClient, DO NOT delete it.
+ // because what changed is class ServiceRegistryClientImpl
+ public void testGetRemoteRegistryClient(@Mocked ServiceRegistryClientImpl registryClient) {
EventBus eventBus = new EventBus();
ServiceRegistryConfig serviceRegistryConfig = ServiceRegistryConfig.INSTANCE;
MicroserviceDefinition microserviceDefinition = new MicroserviceDefinition(Collections.emptyList());
--
To stop receiving notification emails like this one, please contact
liubao@apache.org.