1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

Fix the code style issues

This commit is contained in:
mercyblitz
2020-09-03 10:06:57 +08:00
parent a61f523d78
commit 5cd6c0f1e7
35 changed files with 263 additions and 267 deletions

View File

@@ -131,15 +131,17 @@ public class ReactiveSentinelCircuitBreakerIntegrationTest {
@Bean
public Customizer<ReactiveSentinelCircuitBreakerFactory> slowCustomizer() {
return factory -> {
factory.configure(builder -> builder
.rules(Collections.singletonList(new DegradeRule("slow_mono")
.setCount(50).setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5))),
factory.configure(
builder -> builder.rules(Collections
.singletonList(new DegradeRule("slow_mono").setCount(50)
.setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5))),
"slow_mono");
factory.configure(builder -> builder
.rules(Collections.singletonList(new DegradeRule("slow_mono")
.setCount(50).setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5))),
factory.configure(
builder -> builder.rules(Collections
.singletonList(new DegradeRule("slow_mono").setCount(50)
.setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5))),
"slow_flux");
factory.configureDefault(id -> new SentinelConfigBuilder()
.resourceName(id)

View File

@@ -101,7 +101,8 @@ public class SentinelCircuitBreakerIntegrationTest {
protected static class Application {
@GetMapping("/slow")
public String slow(@RequestParam(required = false) Boolean slow) throws InterruptedException {
public String slow(@RequestParam(required = false) Boolean slow)
throws InterruptedException {
if (slow == null || slow) {
Thread.sleep(80);
}
@@ -116,10 +117,10 @@ public class SentinelCircuitBreakerIntegrationTest {
@Bean
public Customizer<SentinelCircuitBreakerFactory> slowCustomizer() {
String slowId = "slow";
List<DegradeRule> rules = Collections.singletonList(
new DegradeRule(slowId).setGrade(RuleConstant.DEGRADE_GRADE_RT)
.setCount(50).setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5));
List<DegradeRule> rules = Collections.singletonList(new DegradeRule(slowId)
.setGrade(RuleConstant.DEGRADE_GRADE_RT).setCount(50)
.setSlowRatioThreshold(0.7).setMinRequestAmount(5)
.setStatIntervalMs(30000).setTimeWindow(5));
return factory -> {
factory.configure(builder -> builder.rules(rules), slowId);
factory.configureDefault(id -> new SentinelConfigBuilder()
@@ -146,7 +147,8 @@ public class SentinelCircuitBreakerIntegrationTest {
public String slow(boolean slow) {
return cbFactory.create("slow").run(
() -> rest.getForObject("/slow?slow=" + slow, String.class), t -> "fallback");
() -> rest.getForObject("/slow?slow=" + slow, String.class),
t -> "fallback");
}
public String normal() {