fix: init current gateway node to default group

This commit is contained in:
hongqiaowei
2021-01-15 19:20:09 +08:00
parent e0f3269b14
commit c284889693
2 changed files with 12 additions and 19 deletions

View File

@@ -34,6 +34,8 @@ import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author hongqiaowei
@@ -52,7 +54,7 @@ public class GatewayGroupService {
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)
private ReactiveStringRedisTemplate rt;

View File

@@ -4,12 +4,14 @@ import org.junit.jupiter.api.Test;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import we.redis.RedisTemplateConfiguration;
import we.redis.RedisProperties;
import we.redis.RedisServerConfiguration;
import we.redis.RedisTemplateConfiguration;
import javax.annotation.Resource;
import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author hongqiaowei
*/
@@ -19,22 +21,6 @@ import javax.annotation.Resource;
// @ActiveProfiles("unittest")
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
private RedisProperties redisProperties;
@@ -42,8 +28,13 @@ public class ResourceRateLimitConfigServiceTests {
private StringRedisTemplate stringRedisTemplate;
@Test
void initTest() {
void initTest() throws InterruptedException {
System.err.println(redisProperties);
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);
}
}