Commit 36d0754f32ad7c1f85b14fc3e4e6ae976ae877f3
1 parent
04c243f8
【3.2.0 版本发布】微服务测试示例调整
Showing
5 changed files
with
25 additions
and
20 deletions
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/controller/JcloudDemoController.java renamed to jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/controller/JcloudDemoFeignController.java
... | ... | @@ -18,10 +18,10 @@ |
18 | 18 | // * |
19 | 19 | // */ |
20 | 20 | //@Slf4j |
21 | -//@Api(tags = "Cloud示例") | |
21 | +//@Api(tags = "【微服务】单元测试") | |
22 | 22 | //@RestController |
23 | 23 | //@RequestMapping("/test") |
24 | -//public class JcloudDemoController { | |
24 | +//public class JcloudDemoFeignController { | |
25 | 25 | // @Resource |
26 | 26 | // private ISysBaseAPI sysBaseApi; |
27 | 27 | //// @Autowired |
... | ... | @@ -32,10 +32,10 @@ |
32 | 32 | // * |
33 | 33 | // * @return |
34 | 34 | // */ |
35 | -// @GetMapping("/remote") | |
36 | -// @SentinelResource(value = "remoteDict",fallback = "getDefaultHandler") | |
37 | -// @ApiOperation(value = "测试feign", notes = "测试feign") | |
38 | -// public Result remoteDict() { | |
35 | +// @GetMapping("/callSystem") | |
36 | +// //@SentinelResource(value = "remoteDict",fallback = "getDefaultHandler") | |
37 | +// @ApiOperation(value = "通过feign调用system服务", notes = "测试jeecg-demo服务,是否通过fegin调用system服务接口") | |
38 | +// public Result getRemoteDict() { | |
39 | 39 | // List<DictModel> list = sysBaseApi.queryAllDict(); |
40 | 40 | // return Result.OK(list); |
41 | 41 | // } |
... | ... | @@ -47,9 +47,9 @@ |
47 | 47 | //// * http://doc.jeecg.com/2194069 |
48 | 48 | //// * @return |
49 | 49 | //// */ |
50 | -//// @GetMapping("/remoteErp") | |
50 | +//// @GetMapping("/callErp") | |
51 | 51 | //// @ApiOperation(value = "测试feign erp", notes = "测试feign erp") |
52 | -//// public Result remoteCrm() { | |
52 | +//// public Result callErp() { | |
53 | 53 | //// log.info("call erp 服务"); |
54 | 54 | //// String res = erpHelloApi.callHello(); |
55 | 55 | //// return Result.OK(res); |
... | ... | @@ -62,8 +62,7 @@ |
62 | 62 | // */ |
63 | 63 | // public Result<Object> getDefaultHandler() { |
64 | 64 | // log.info("测试JcloudDemoController-remoteDict 熔断降级"); |
65 | -// return Result.OK("测试JcloudDemoController-remoteDict 熔断降级"); | |
65 | +// return Result.error("测试JcloudDemoController-remoteDict 熔断降级"); | |
66 | 66 | // } |
67 | 67 | // |
68 | -// | |
69 | 68 | //} |
... | ... |
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/provider/JcloudDemoProvider.java renamed to jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/controller/JcloudDemoProviderController.java
1 | -package org.jeecg.modules.demo.cloud.provider; | |
1 | +package org.jeecg.modules.demo.cloud.controller; | |
2 | 2 | |
3 | +import lombok.extern.slf4j.Slf4j; | |
3 | 4 | import org.jeecg.common.api.vo.Result; |
4 | 5 | import org.jeecg.modules.demo.cloud.service.JcloudDemoService; |
5 | 6 | import org.springframework.web.bind.annotation.GetMapping; |
... | ... | @@ -10,19 +11,23 @@ import org.springframework.web.bind.annotation.RestController; |
10 | 11 | import javax.annotation.Resource; |
11 | 12 | |
12 | 13 | /** |
13 | - * feign服务端接口 | |
14 | + * 服务端提供方——feign接口 | |
15 | + * 【提供给system-start调用测试,看feign是否畅通】 | |
14 | 16 | * @author: jeecg-boot |
15 | 17 | */ |
18 | +@Slf4j | |
16 | 19 | @RestController |
17 | 20 | @RequestMapping("/test") |
18 | -public class JcloudDemoProvider { | |
21 | +public class JcloudDemoProviderController { | |
19 | 22 | |
20 | 23 | @Resource |
21 | 24 | private JcloudDemoService jcloudDemoService; |
22 | 25 | |
23 | 26 | @GetMapping("/getMessage") |
24 | - public Result<String> getMessage(@RequestParam String name) { | |
25 | - return jcloudDemoService.getMessage(name); | |
27 | + public String getMessage(@RequestParam String name) { | |
28 | + String msg = jcloudDemoService.getMessage(name); | |
29 | + log.info(" 微服务被调用:{} ",msg); | |
30 | + return msg; | |
26 | 31 | } |
27 | 32 | |
28 | 33 | } |
... | ... |
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/service/JcloudDemoService.java
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/service/impl/JcloudDemoServiceImpl.java
... | ... | @@ -11,7 +11,8 @@ import org.springframework.stereotype.Service; |
11 | 11 | @Service |
12 | 12 | public class JcloudDemoServiceImpl implements JcloudDemoService { |
13 | 13 | @Override |
14 | - public Result<String> getMessage(String name) { | |
15 | - return Result.OK("Hello," + name); | |
14 | + public String getMessage(String name) { | |
15 | + String resMsg = "Hello,我是jeecg-demo服务节点,收到你的消息:【 "+ name +" 】"; | |
16 | + return resMsg; | |
16 | 17 | } |
17 | 18 | } |
... | ... |
jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/xxljob/TestJobHandler.java renamed to jeecg-boot/jeecg-boot-module-demo/src/main/java/org/jeecg/modules/demo/cloud/xxljob/TestJobHandler.java
1 | 1 | // |
2 | -//package org.jeecg.modules.demo.xxljob; | |
2 | +//package org.jeecg.modules.demo.cloud.xxljob; | |
3 | 3 | // |
4 | 4 | //import com.xxl.job.core.biz.model.ReturnT; |
5 | 5 | //import com.xxl.job.core.handler.annotation.XxlJob; |
... | ... | @@ -17,8 +17,8 @@ |
17 | 17 | ///** |
18 | 18 | // * xxl-job定时任务测试 |
19 | 19 | // */ |
20 | -//@Component | |
21 | 20 | //@Slf4j |
21 | +//@Component | |
22 | 22 | //public class TestJobHandler { |
23 | 23 | // @Autowired |
24 | 24 | // ISysBaseAPI sysBaseApi; |
... | ... |