fix: init current gateway node to default group
This commit is contained in:
@@ -34,6 +34,8 @@ import javax.annotation.PostConstruct;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongqiaowei
|
* @author hongqiaowei
|
||||||
@@ -52,7 +54,7 @@ public class GatewayGroupService {
|
|||||||
|
|
||||||
private Map<Integer, GatewayGroup> oldGatewayGroupMap = new HashMap<>(6);
|
private Map<Integer, GatewayGroup> oldGatewayGroupMap = new HashMap<>(6);
|
||||||
|
|
||||||
public Set<String> currentGatewayGroupSet = new HashSet<>(6);
|
public Set<String> currentGatewayGroupSet = Stream.of(GatewayGroup.DEFAULT).collect(Collectors.toSet());
|
||||||
|
|
||||||
@Resource(name = AggregateRedisConfig.AGGREGATE_REACTIVE_REDIS_TEMPLATE)
|
@Resource(name = AggregateRedisConfig.AGGREGATE_REACTIVE_REDIS_TEMPLATE)
|
||||||
private ReactiveStringRedisTemplate rt;
|
private ReactiveStringRedisTemplate rt;
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import org.junit.jupiter.api.Test;
|
|||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.test.context.TestPropertySource;
|
import org.springframework.test.context.TestPropertySource;
|
||||||
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
|
||||||
import we.redis.RedisTemplateConfiguration;
|
|
||||||
import we.redis.RedisProperties;
|
import we.redis.RedisProperties;
|
||||||
import we.redis.RedisServerConfiguration;
|
import we.redis.RedisServerConfiguration;
|
||||||
|
import we.redis.RedisTemplateConfiguration;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hongqiaowei
|
* @author hongqiaowei
|
||||||
*/
|
*/
|
||||||
@@ -19,22 +21,6 @@ import javax.annotation.Resource;
|
|||||||
// @ActiveProfiles("unittest")
|
// @ActiveProfiles("unittest")
|
||||||
public class ResourceRateLimitConfigServiceTests {
|
public class ResourceRateLimitConfigServiceTests {
|
||||||
|
|
||||||
// private static RedisServer redisServer;
|
|
||||||
//
|
|
||||||
// @BeforeAll
|
|
||||||
// static void startRedis() {
|
|
||||||
// redisServer = RedisServer.builder()
|
|
||||||
// .port(6379)
|
|
||||||
// .setting("maxmemory 32M")
|
|
||||||
// .build();
|
|
||||||
// redisServer.start();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @AfterAll
|
|
||||||
// static void stopRedis() {
|
|
||||||
// redisServer.stop();
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private RedisProperties redisProperties;
|
private RedisProperties redisProperties;
|
||||||
|
|
||||||
@@ -42,8 +28,13 @@ public class ResourceRateLimitConfigServiceTests {
|
|||||||
private StringRedisTemplate stringRedisTemplate;
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void initTest() {
|
void initTest() throws InterruptedException {
|
||||||
System.err.println(redisProperties);
|
System.err.println(redisProperties);
|
||||||
System.err.println(stringRedisTemplate);
|
System.err.println(stringRedisTemplate);
|
||||||
|
stringRedisTemplate.opsForValue().set("name", "F-22");
|
||||||
|
Thread.sleep(2000);
|
||||||
|
String name = stringRedisTemplate.opsForValue().get("name");
|
||||||
|
assertEquals(name, "F-22");
|
||||||
|
System.err.println(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user