This commit is contained in:
kezhijie
2023-11-06 12:41:57 +08:00
parent 232037ec58
commit 9bed25be8c
219 changed files with 1747 additions and 1608 deletions

View File

@ -1,6 +1,8 @@
package org.jeecg.modules.test.feign.controller;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
@ -8,8 +10,6 @@ import org.jeecg.modules.test.feign.client.JeecgTestClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* 微服务单元测试
@ -19,7 +19,7 @@ import io.swagger.annotations.ApiOperation;
@Slf4j
@RestController
@RequestMapping("/sys/test")
@Api(tags = "【微服务】单元测试")
@Tag(name = "【微服务】单元测试")
public class JeecgTestFeignController {
@Autowired
@ -32,7 +32,7 @@ public class JeecgTestFeignController {
* @return
*/
@GetMapping("/getMessage")
@ApiOperation(value = "测试feign调用demo服务1", notes = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
@Operation(summary = "测试feign @SentinelResource熔断写法 | 测试熔断关闭jeecg-demo服务")
@SentinelResource(value = "test_more_getMessage", fallback = "getDefaultUser")
public Result<String> getMessage(@RequestParam(value = "name", required = false) String name) {
log.info("---------Feign fallbackFactory优先级高于@SentinelResource-----------------");
@ -47,7 +47,7 @@ public class JeecgTestFeignController {
* @return
*/
@GetMapping("/getMessage2")
@ApiOperation(value = "测试feign调用demo服务2", notes = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
@Operation(summary = "测试feign fallbackFactory熔断写法 | 测试熔断关闭jeecg-demo服务")
public Result<String> getMessage2(@RequestParam(value = "name", required = false) String name) {
log.info("---------测试 Feign fallbackFactory-----------------");
String resultMsg = jeecgTestClient.getMessage(" I am jeecg-system 服务节点,呼叫 jeecg-demo!");
@ -56,7 +56,7 @@ public class JeecgTestFeignController {
@GetMapping("/fallback")
@ApiOperation(value = "测试熔断", notes = "测试熔断")
@Operation(summary = "测试熔断")
@SentinelResource(value = "test_more_fallback", fallback = "getDefaultUser")
public Result<Object> test(@RequestParam(value = "name", required = false) String name) {
if (StringUtils.isEmpty(name)) {