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/05/08 08:05:05 UTC
[incubator-servicecomb-java-chassis] 02/05: SCB-504 fix warnings
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 1664e0270d456241af892258279a9f029866e8d7
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Wed May 2 15:53:25 2018 +0800
SCB-504 fix warnings
Signed-off-by: zhengyangyong <ya...@huawei.com>
---
.../java/org/apache/servicecomb/demo/edge/consumer/Consumer.java | 6 +++---
.../servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java | 6 +++---
.../servicecomb/config/TestLastPropertyPlaceholderConfigurer.java | 2 +-
.../springboot/starter/discovery/CseDiscoveryClient.java | 1 +
.../starter/discovery/CseDiscoveryClientConfiguration.java | 4 ++--
.../springboot/starter/discovery/TestCseDiscoveryClient.java | 1 -
6 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/demo/demo-edge/consumer/src/main/java/org/apache/servicecomb/demo/edge/consumer/Consumer.java b/demo/demo-edge/consumer/src/main/java/org/apache/servicecomb/demo/edge/consumer/Consumer.java
index 284a883..7bdbb54 100644
--- a/demo/demo-edge/consumer/src/main/java/org/apache/servicecomb/demo/edge/consumer/Consumer.java
+++ b/demo/demo-edge/consumer/src/main/java/org/apache/servicecomb/demo/edge/consumer/Consumer.java
@@ -114,7 +114,7 @@ public class Consumer {
}, resp -> {
byte[] buf = new byte[1 * 1024 * 1024];
try (InputStream is = resp.getBody()) {
- for (;;) {
+ for (; ; ) {
int len = is.read(buf);
if (len == -1) {
break;
@@ -125,14 +125,14 @@ public class Consumer {
}
return null;
});
- Assert.isTrue(size.get() == 10 * 1024 * 1024);
+ Assert.isTrue(size.get() == 10 * 1024 * 1024, "size is : " + String.valueOf(size.get()) + " not 10 * 1024 * 1024");
System.out.println("test download bigFile finished");
}
protected void testDownload() {
String url = edgePrefix + "/v2/download";
String content = template.getForObject(url, String.class);
- Assert.isTrue("download".equals(content));
+ Assert.isTrue("download".equals(content), "content is : " + content + " not download");
System.out.println("test download finished");
}
diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
index 5bbd007..8cae971 100644
--- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
+++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java
@@ -85,7 +85,7 @@ public class CodeFirstSpringmvc {
String content1 = IOUtils.toString(is1);
String content2 = IOUtils.toString(is2);
return String.format("%s:%s:%s\n"
- + "%s:%s:%s",
+ + "%s:%s:%s",
file1.getOriginalFilename(),
file1.getContentType(),
content1,
@@ -310,7 +310,7 @@ public class CodeFirstSpringmvc {
return new OutputModelForTestIgnore("output_id", input.getInputId(), input.getContent(), input.getInputObject(),
input.getInputJsonObject(), input.getInputIgnoreInterface(),
new Person("outputSomeone"), new JsonObject("{\"OutputJsonKey\" : \"OutputJsonValue\"}"), () -> {
- });
+ });
}
@SuppressWarnings("unchecked")
@@ -336,7 +336,7 @@ public class CodeFirstSpringmvc {
public String testform(HttpServletRequest request) {
String form1 = request.getParameter("form1");
String form2 = request.getParameter("form2");
- Assert.notNull(form1);
+ Assert.notNull(form1, "from1 is null");
return form1 + form2;
}
diff --git a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestLastPropertyPlaceholderConfigurer.java b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestLastPropertyPlaceholderConfigurer.java
index a6dfc39..d3d8491 100644
--- a/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestLastPropertyPlaceholderConfigurer.java
+++ b/foundations/foundation-config/src/test/java/org/apache/servicecomb/config/TestLastPropertyPlaceholderConfigurer.java
@@ -61,7 +61,7 @@ public class TestLastPropertyPlaceholderConfigurer {
bean.resolver.resolveStringValue("${b}");
Assert.fail("must throw exception");
} catch (IllegalArgumentException e) {
- Assert.assertEquals("Could not resolve placeholder 'b' in string value \"${b}\"", e.getMessage());
+ Assert.assertEquals("Could not resolve placeholder 'b' in value \"${b}\"", e.getMessage());
}
context.close();
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClient.java b/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClient.java
index 341864b..ef48575 100644
--- a/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClient.java
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClient.java
@@ -65,6 +65,7 @@ public class CseDiscoveryClient implements DiscoveryClient {
}
@Override
+ @Deprecated
public ServiceInstance getLocalServiceInstance() {
return null;
}
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClientConfiguration.java b/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClientConfiguration.java
index 603d9a0..a6c377e 100644
--- a/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClientConfiguration.java
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/main/java/org/apache/servicecomb/springboot/starter/discovery/CseDiscoveryClientConfiguration.java
@@ -19,12 +19,12 @@ package org.apache.servicecomb.springboot.starter.discovery;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.cloud.client.discovery.noop.NoopDiscoveryClientAutoConfiguration;
+import org.springframework.cloud.client.discovery.simple.SimpleDiscoveryClientAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
-@AutoConfigureBefore(NoopDiscoveryClientAutoConfiguration.class)
+@AutoConfigureBefore(SimpleDiscoveryClientAutoConfiguration.class)
@Configuration
public class CseDiscoveryClientConfiguration {
@Bean
diff --git a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/org/apache/servicecomb/springboot/starter/discovery/TestCseDiscoveryClient.java b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/org/apache/servicecomb/springboot/starter/discovery/TestCseDiscoveryClient.java
index 08a13ce..727b306 100644
--- a/spring-boot-starter/spring-boot-starter-discovery/src/test/java/org/apache/servicecomb/springboot/starter/discovery/TestCseDiscoveryClient.java
+++ b/spring-boot-starter/spring-boot-starter-discovery/src/test/java/org/apache/servicecomb/springboot/starter/discovery/TestCseDiscoveryClient.java
@@ -75,7 +75,6 @@ public class TestCseDiscoveryClient {
DiscoveryClient client = new CseDiscoveryClient();
Assert.assertEquals("Spring Cloud CSE Discovery Client", client.description());
- Assert.assertEquals(null, client.getLocalServiceInstance());
Assert.assertEquals(2, client.getServices().size());
Assert.assertEquals("server2", client.getServices().get(1));
Assert.assertEquals(2, client.getInstances("service1-instance1").size());
--
To stop receiving notification emails like this one, please contact
liubao@apache.org.