You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by wu...@apache.org on 2018/01/09 06:54:21 UTC
[incubator-servicecomb-java-chassis] 04/06: fix coverage downgrade
This is an automated email from the ASF dual-hosted git repository.
wujimin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-java-chassis.git
commit ebffd49f9a80fab07e8d149e46f443f10e273d77
Author: bao.liu <ba...@huawei.com>
AuthorDate: Mon Jan 8 11:43:21 2018 +0800
fix coverage downgrade
---
.../servicecomb/loadbalance/ServerListCache.java | 37 -----------
.../loadbalance/TestServerListCache.java | 73 ----------------------
.../TestCseDiscoveryClientConfiguration.java | 12 ++++
.../TestCseRibbonClientConfiguration.java | 16 +++++
.../discovery/TestServiceCombServerList.java | 1 +
5 files changed, 29 insertions(+), 110 deletions(-)
diff --git a/handlers/handler-loadbalance/src/main/java/io/servicecomb/loadbalance/ServerListCache.java b/handlers/handler-loadbalance/src/main/java/io/servicecomb/loadbalance/ServerListCache.java
deleted file mode 100644
index cb035ea..0000000
--- a/handlers/handler-loadbalance/src/main/java/io/servicecomb/loadbalance/ServerListCache.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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 io.servicecomb.loadbalance;
-
-import com.netflix.loadbalancer.Server;
-
-import io.servicecomb.core.Transport;
-import io.servicecomb.core.endpoint.AbstractEndpointsCache;
-import io.servicecomb.serviceregistry.cache.CacheEndpoint;
-
-public class ServerListCache extends AbstractEndpointsCache<Server> {
-
- public ServerListCache(String appId, String microserviceName, String microserviceVersionRule,
- String transportName) {
- super(appId, microserviceName, microserviceVersionRule, transportName);
- }
-
- @Override
- protected Server createEndpoint(Transport transport, CacheEndpoint cacheEndpoint) {
- return new CseServer(transport, cacheEndpoint);
- }
-}
diff --git a/handlers/handler-loadbalance/src/test/java/io/servicecomb/loadbalance/TestServerListCache.java b/handlers/handler-loadbalance/src/test/java/io/servicecomb/loadbalance/TestServerListCache.java
deleted file mode 100644
index 8b89650..0000000
--- a/handlers/handler-loadbalance/src/test/java/io/servicecomb/loadbalance/TestServerListCache.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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 io.servicecomb.loadbalance;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-
-import com.netflix.loadbalancer.Server;
-
-import io.servicecomb.core.Transport;
-import io.servicecomb.serviceregistry.cache.CacheEndpoint;
-import io.servicecomb.serviceregistry.cache.InstanceCache;
-import io.servicecomb.serviceregistry.cache.InstanceCacheManager;
-import mockit.Mock;
-import mockit.MockUp;
-
-public class TestServerListCache {
-
- private ServerListCache instance = null;
-
- private Transport transport = null;
-
- private void mockTestCases() {
- new MockUp<InstanceCacheManager>() {
- @Mock
- public InstanceCache getOrCreate(String appId, String microserviceName, String microserviceVersionRule) {
- return null;
- }
- };
-
- transport = Mockito.mock(Transport.class);
- }
-
- @Before
- public void setUp() throws Exception {
- mockTestCases();
- instance = new ServerListCache("appId", "microserviceName", "microserviceVersionRule", "transportName");
- }
-
- @After
- public void tearDown() throws Exception {
- instance = null;
- }
-
- @Test
- public void testServerListCache() {
- Assert.assertNotNull(instance);
- }
-
- @Test
- public void testCreateEndpointTransportString() {
- Server server = instance.createEndpoint(transport, new CacheEndpoint("stringAddress", null));
- Assert.assertNotNull(server);
- }
-}
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseDiscoveryClientConfiguration.java b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseDiscoveryClientConfiguration.java
new file mode 100644
index 0000000..947106f
--- /dev/null
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseDiscoveryClientConfiguration.java
@@ -0,0 +1,12 @@
+package io.servicecomb.springboot.starter.discovery;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestCseDiscoveryClientConfiguration {
+ @Test
+ public void testCseDiscoveryClientConfiguration() {
+ CseDiscoveryClientConfiguration discoveryClientConfiguration = new CseDiscoveryClientConfiguration();
+ Assert.assertTrue(discoveryClientConfiguration.cseDiscoveryClient() instanceof CseDiscoveryClient);
+ }
+}
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseRibbonClientConfiguration.java b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseRibbonClientConfiguration.java
new file mode 100644
index 0000000..4b2ba69
--- /dev/null
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestCseRibbonClientConfiguration.java
@@ -0,0 +1,16 @@
+package io.servicecomb.springboot.starter.discovery;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import com.netflix.client.config.IClientConfig;
+
+import mockit.Injectable;
+
+public class TestCseRibbonClientConfiguration {
+ @Test
+ public void testCseRibbonClientConfiguration(@Injectable IClientConfig clientConfig) {
+ CseRibbonClientConfiguration config = new CseRibbonClientConfiguration();
+ Assert.assertTrue(config.ribbonServerList(clientConfig) instanceof ServiceCombServerList);
+ }
+}
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestServiceCombServerList.java b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestServiceCombServerList.java
index 41bbdff..124ad23 100644
--- a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestServiceCombServerList.java
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/io/servicecomb/springboot/starter/discovery/TestServiceCombServerList.java
@@ -71,5 +71,6 @@ public class TestServiceCombServerList {
List<Server> serverList = list.getInitialListOfServers();
Assert.assertEquals(2, serverList.size());
Assert.assertEquals(4444, serverList.get(1).getPort());
+ Assert.assertEquals(serverList.size(), list.getUpdatedListOfServers().size());
}
}
--
To stop receiving notification emails like this one, please contact
"commits@servicecomb.apache.org" <co...@servicecomb.apache.org>.