Merge remote-tracking branch 'origin/feature/flow' into feature/flow
This commit is contained in:
@@ -33,7 +33,7 @@ import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||
|
||||
public abstract class SchedConfig implements SchedulingConfigurer {
|
||||
|
||||
private int executors;
|
||||
private int executors = 1;
|
||||
|
||||
public void setExecutors(int es) {
|
||||
executors = es;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package we.stats.ratelimit;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author hongqiaowei
|
||||
*/
|
||||
|
||||
public class ResourceRateLimitConfigServiceTests {
|
||||
|
||||
@Test
|
||||
void initTest() {
|
||||
|
||||
// 其实就是要构建个 context,里面有 redis、ReactiveStringRedisTemplate、ResourceRateLimitConfigService
|
||||
// ResourceRateLimitConfigService 依赖 ReactiveStringRedisTemplate,然后能 PostConstruct
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package we.stats.ratelimit;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import we.util.JacksonUtils;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
/**
|
||||
* @author hongqiaowei
|
||||
*/
|
||||
|
||||
public class ResourceRateLimitConfigTests {
|
||||
|
||||
@Test
|
||||
void test() {
|
||||
String resourceRateLimitConfigJson = "{\"concurrents\":1000,\"enable\":1,\"id\":1,\"isDeleted\":0,\"qps\":500,\"resource\":\"_global\",\"responseContent\":\"{\\\"msg\\\":\\\"rate limit, please try again\\\"}\",\"responseType\":\"application/json; charset=UTF-8\",\"type\":1}";
|
||||
ResourceRateLimitConfig resourceRateLimitConfig = JacksonUtils.readValue(resourceRateLimitConfigJson, ResourceRateLimitConfig.class);
|
||||
assertEquals("application/json; charset=UTF-8", resourceRateLimitConfig.responseType);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user