Skip to content

Commit 8d51702

Browse files
flygoodsfelixgis14
authored andcommitted
style: Fix the problems detected by CI
checkstyle,rat_check
1 parent aa09508 commit 8d51702

File tree

39 files changed

+474
-386
lines changed

39 files changed

+474
-386
lines changed

demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ClientWebsocketController.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@
3030
@RestSchema(schemaId = "ClientWebsocketController")
3131
@RequestMapping(path = "/ws")
3232
public class ClientWebsocketController {
33-
interface ProviderService {
34-
WebSocket websocket();
35-
}
33+
interface ProviderService {
34+
WebSocket websocket();
35+
}
3636

37-
@RpcReference(schemaId = "WebsocketController", microserviceName = "provider")
38-
private ProviderService providerService;
37+
@RpcReference(schemaId = "WebsocketController", microserviceName = "provider")
38+
private ProviderService providerService;
3939

40-
@PostMapping("/websocket")
41-
@Transport(name = CoreConst.WEBSOCKET)
42-
public void websocket(ServerWebSocket serverWebsocket) {
43-
WebSocket providerWebSocket = providerService.websocket();
44-
providerWebSocket.closeHandler(v -> serverWebsocket.close());
45-
providerWebSocket.textMessageHandler(m -> {
46-
serverWebsocket.writeTextMessage(m);
47-
});
48-
serverWebsocket.textMessageHandler(m -> {
49-
providerWebSocket.writeTextMessage(m);
50-
});
51-
}
40+
@PostMapping("/websocket")
41+
@Transport(name = CoreConst.WEBSOCKET)
42+
public void websocket(ServerWebSocket serverWebsocket) {
43+
WebSocket providerWebSocket = providerService.websocket();
44+
providerWebSocket.closeHandler(v -> serverWebsocket.close());
45+
providerWebSocket.textMessageHandler(m -> {
46+
serverWebsocket.writeTextMessage(m);
47+
});
48+
serverWebsocket.textMessageHandler(m -> {
49+
providerWebSocket.writeTextMessage(m);
50+
});
51+
}
5252
}

demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsulConsumerApplication.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
@SpringBootApplication
2525
public class ConsulConsumerApplication {
26-
public static void main(String[] args) throws Exception {
27-
try {
28-
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulConsumerApplication.class).run(args);
29-
} catch (Exception e) {
30-
e.printStackTrace();
31-
}
26+
public static void main(String[] args) throws Exception {
27+
try {
28+
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulConsumerApplication.class).run(args);
29+
} catch (Exception e) {
30+
e.printStackTrace();
3231
}
32+
}
3333
}

demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@
3030
@RestSchema(schemaId = "ConsumerController")
3131
@RequestMapping(path = "/")
3232
public class ConsumerController {
33-
@RpcReference(schemaId = "ProviderController", microserviceName = "provider")
34-
private ProviderService providerService;
33+
@RpcReference(schemaId = "ProviderController", microserviceName = "provider")
34+
private ProviderService providerService;
3535

36-
// consumer service which delegate the implementation to provider service.
37-
@GetMapping("/sayHello")
38-
public String sayHello(@RequestParam("name") String name) {
39-
return providerService.sayHello(name);
40-
}
36+
// consumer service which delegate the implementation to provider service.
37+
@GetMapping("/sayHello")
38+
public String sayHello(@RequestParam("name") String name) {
39+
return providerService.sayHello(name);
40+
}
4141

42-
@GetMapping("/getConfig")
43-
public String getConfig(@RequestParam("key") String key) {
44-
return providerService.getConfig(key);
45-
}
42+
@GetMapping("/getConfig")
43+
public String getConfig(@RequestParam("key") String key) {
44+
return providerService.getConfig(key);
45+
}
4646

47-
@PostMapping(path = "/testContentType", consumes = MediaType.APPLICATION_JSON_VALUE)
48-
@ResponseBody
49-
public User testContentType(@RequestBody User user) {
50-
return providerService.testContentType(user);
51-
}
47+
@PostMapping(path = "/testContentType", consumes = MediaType.APPLICATION_JSON_VALUE)
48+
@ResponseBody
49+
public User testContentType(@RequestBody User user) {
50+
return providerService.testContentType(user);
51+
}
5252
}

demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerReactiveStreamController.java

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -28,57 +28,57 @@
2828
@RestSchema(schemaId = "ReactiveStreamController")
2929
@RequestMapping(path = "/")
3030
public class ConsumerReactiveStreamController {
31-
interface ProviderReactiveStreamController {
32-
Publisher<String> sseString();
31+
interface ProviderReactiveStreamController {
32+
Publisher<String> sseString();
3333

34-
Publisher<Model> sseModel();
35-
}
36-
37-
@RpcReference(microserviceName = "provider", schemaId = "ReactiveStreamController")
38-
ProviderReactiveStreamController controller;
39-
40-
public static class Model {
41-
private String name;
34+
Publisher<Model> sseModel();
35+
}
4236

43-
private int age;
37+
@RpcReference(microserviceName = "provider", schemaId = "ReactiveStreamController")
38+
ProviderReactiveStreamController controller;
4439

45-
public Model() {
40+
public static class Model {
41+
private String name;
4642

47-
}
43+
private int age;
4844

49-
public Model(String name, int age) {
50-
this.name = name;
51-
this.age = age;
52-
}
45+
public Model() {
5346

54-
public int getAge() {
55-
return age;
56-
}
47+
}
5748

58-
public Model setAge(int age) {
59-
this.age = age;
60-
return this;
61-
}
49+
public Model(String name, int age) {
50+
this.name = name;
51+
this.age = age;
52+
}
6253

63-
public String getName() {
64-
return name;
65-
}
54+
public int getAge() {
55+
return age;
56+
}
6657

67-
public Model setName(String name) {
68-
this.name = name;
69-
return this;
70-
}
58+
public Model setAge(int age) {
59+
this.age = age;
60+
return this;
7161
}
7262

73-
@GetMapping("/sseString")
74-
@Transport(name = CoreConst.RESTFUL)
75-
public Publisher<String> sseString() {
76-
return controller.sseString();
63+
public String getName() {
64+
return name;
7765
}
7866

79-
@GetMapping("/sseModel")
80-
@Transport(name = CoreConst.RESTFUL)
81-
public Publisher<Model> sseModel() {
82-
return controller.sseModel();
67+
public Model setName(String name) {
68+
this.name = name;
69+
return this;
8370
}
71+
}
72+
73+
@GetMapping("/sseString")
74+
@Transport(name = CoreConst.RESTFUL)
75+
public Publisher<String> sseString() {
76+
return controller.sseString();
77+
}
78+
79+
@GetMapping("/sseModel")
80+
@Transport(name = CoreConst.RESTFUL)
81+
public Publisher<Model> sseModel() {
82+
return controller.sseModel();
83+
}
8484
}

demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/User.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,23 @@
1919

2020
public class User {
2121

22-
private Long id;
22+
private Long id;
2323

24-
private String name;
24+
private String name;
2525

26-
public Long getId() {
27-
return id;
28-
}
26+
public Long getId() {
27+
return id;
28+
}
2929

30-
public void setId(Long id) {
31-
this.id = id;
32-
}
30+
public void setId(Long id) {
31+
this.id = id;
32+
}
3333

34-
public String getName() {
35-
return name;
36-
}
34+
public String getName() {
35+
return name;
36+
}
3737

38-
public void setName(String name) {
39-
this.name = name;
40-
}
38+
public void setName(String name) {
39+
this.name = name;
40+
}
4141
}

demo/demo-consul/consumer/src/main/resources/application.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## See the License for the specific language governing permissions and
1616
## limitations under the License.
1717
## ---------------------------------------------------------------------------
18+
1819
servicecomb:
1920
service:
2021
application: demo-consul

demo/demo-consul/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
@SpringBootApplication
2525
public class GatewayApplication {
26-
public static void main(String[] args) throws Exception {
27-
try {
28-
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(GatewayApplication.class).run(args);
29-
} catch (Exception e) {
30-
e.printStackTrace();
31-
}
26+
public static void main(String[] args) throws Exception {
27+
try {
28+
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(GatewayApplication.class).run(args);
29+
} catch (Exception e) {
30+
e.printStackTrace();
3231
}
32+
}
3333
}

demo/demo-consul/gateway/src/main/resources/application.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## See the License for the specific language governing permissions and
1616
## limitations under the License.
1717
## ---------------------------------------------------------------------------
18+
1819
servicecomb:
1920
service:
2021
application: demo-consul

demo/demo-consul/pom.xml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
219
<project xmlns="http://maven.apache.org/POM/4.0.0"
320
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
421
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
@@ -13,13 +30,6 @@
1330
<name>Java Chassis::Demo::Consul</name>
1431
<packaging>pom</packaging>
1532

16-
<modules>
17-
<module>provider</module>
18-
<module>consumer</module>
19-
<module>gateway</module>
20-
<module>test-client</module>
21-
</modules>
22-
2333
<dependencies>
2434
<dependency>
2535
<groupId>org.apache.servicecomb.demo</groupId>
@@ -42,4 +52,12 @@
4252
<artifactId>log4j-api</artifactId>
4353
</dependency>
4454
</dependencies>
55+
56+
<modules>
57+
<module>provider</module>
58+
<module>consumer</module>
59+
<module>gateway</module>
60+
<module>test-client</module>
61+
</modules>
62+
4563
</project>

demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ConsulProviderApplication.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323

2424
@SpringBootApplication
2525
public class ConsulProviderApplication {
26-
public static void main(String[] args) throws Exception {
27-
try {
28-
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulProviderApplication.class).run(args);
29-
} catch (Exception e) {
30-
e.printStackTrace();
31-
}
26+
public static void main(String[] args) throws Exception {
27+
try {
28+
new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulProviderApplication.class).run(args);
29+
} catch (Exception e) {
30+
e.printStackTrace();
3231
}
32+
}
3333
}

0 commit comments

Comments
 (0)