mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
sync & commit in finchley
This commit is contained in:
@@ -19,8 +19,6 @@ package com.alibaba.cloud.sentinel.datasource;
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.config.AbstractDataSourceProperties;
|
||||
import com.alibaba.csp.sentinel.slots.block.AbstractRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
|
||||
@@ -29,6 +27,8 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule;
|
||||
import com.alibaba.csp.sentinel.slots.system.SystemRule;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Enum for {@link AbstractRule} class, using in
|
||||
* {@link AbstractDataSourceProperties#ruleType}
|
||||
@@ -38,48 +38,48 @@ import com.alibaba.csp.sentinel.slots.system.SystemRule;
|
||||
public enum RuleType {
|
||||
|
||||
/**
|
||||
* flow
|
||||
* flow.
|
||||
*/
|
||||
FLOW("flow", FlowRule.class),
|
||||
/**
|
||||
* degrade
|
||||
* degrade.
|
||||
*/
|
||||
DEGRADE("degrade", DegradeRule.class),
|
||||
/**
|
||||
* param flow
|
||||
* param flow.
|
||||
*/
|
||||
PARAM_FLOW("param-flow", ParamFlowRule.class),
|
||||
/**
|
||||
* system
|
||||
* system.
|
||||
*/
|
||||
SYSTEM("system", SystemRule.class),
|
||||
/**
|
||||
* authority
|
||||
* authority.
|
||||
*/
|
||||
AUTHORITY("authority", AuthorityRule.class),
|
||||
/**
|
||||
* gateway flow
|
||||
* gateway flow.
|
||||
*/
|
||||
GW_FLOW("gw-flow",
|
||||
"com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule"),
|
||||
/**
|
||||
* api
|
||||
* api.
|
||||
*/
|
||||
GW_API_GROUP("gw-api-group",
|
||||
"com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition");
|
||||
|
||||
/**
|
||||
* alias for {@link AbstractRule}
|
||||
* alias for {@link AbstractRule}.
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
/**
|
||||
* concrete {@link AbstractRule} class
|
||||
* concrete {@link AbstractRule} class.
|
||||
*/
|
||||
private Class clazz;
|
||||
|
||||
/**
|
||||
* concrete {@link AbstractRule} class name
|
||||
* concrete {@link AbstractRule} class name.
|
||||
*/
|
||||
private String clazzName;
|
||||
|
||||
|
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
*/
|
||||
public interface SentinelDataSourceConstants {
|
||||
|
||||
String PROPERTY_PREFIX = "spring.cloud.sentinel";
|
||||
|
||||
}
|
@@ -19,8 +19,6 @@ package com.alibaba.cloud.sentinel.datasource.config;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.RuleType;
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager;
|
||||
import com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager;
|
||||
@@ -33,6 +31,8 @@ import com.alibaba.csp.sentinel.slots.system.SystemRuleManager;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
/**
|
||||
* Abstract class Using by {@link DataSourcePropertiesConfiguration}
|
||||
*
|
||||
@@ -42,11 +42,15 @@ public class AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
private String dataType = "json";
|
||||
|
||||
@NotNull
|
||||
private RuleType ruleType;
|
||||
|
||||
private String converterClass;
|
||||
|
||||
@JsonIgnore
|
||||
private final String factoryBeanName;
|
||||
|
||||
@JsonIgnore
|
||||
private Environment env;
|
||||
|
||||
|
@@ -30,8 +30,10 @@ public class ApolloDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
private String namespaceName;
|
||||
|
||||
@NotEmpty
|
||||
private String flowRulesKey;
|
||||
|
||||
private String defaultFlowRuleValue;
|
||||
|
||||
public ApolloDataSourceProperties() {
|
||||
|
@@ -21,10 +21,10 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
* Using By ConfigurationProperties.
|
||||
*
|
||||
|
@@ -20,11 +20,11 @@ import java.io.IOException;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean;
|
||||
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean;
|
||||
|
||||
/**
|
||||
* File Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* {@link FileRefreshableDataSourceFactoryBean}
|
||||
@@ -35,8 +35,11 @@ public class FileDataSourceProperties extends AbstractDataSourceProperties {
|
||||
|
||||
@NotEmpty
|
||||
private String file;
|
||||
|
||||
private String charset = "utf-8";
|
||||
|
||||
private long recommendRefreshMs = 3000L;
|
||||
|
||||
private int bufSize = 1024 * 1024;
|
||||
|
||||
public FileDataSourceProperties() {
|
||||
|
@@ -18,10 +18,10 @@ package com.alibaba.cloud.sentinel.datasource.config;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Nacos Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* {@link NacosDataSourceFactoryBean}
|
||||
@@ -39,8 +39,11 @@ public class NacosDataSourceProperties extends AbstractDataSourceProperties {
|
||||
private String dataId;
|
||||
|
||||
private String endpoint;
|
||||
|
||||
private String namespace;
|
||||
|
||||
private String accessKey;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
public NacosDataSourceProperties() {
|
||||
|
@@ -19,10 +19,10 @@ package com.alibaba.cloud.sentinel.datasource.config;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.RedisDataSourceFactoryBean;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Zookeeper Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* {@link RedisDataSourceFactoryBean}
|
||||
@@ -36,27 +36,27 @@ public class RedisDataSourceProperties extends AbstractDataSourceProperties {
|
||||
}
|
||||
|
||||
/**
|
||||
* redis server host
|
||||
* redis server host.
|
||||
*/
|
||||
private String host = "localhost";
|
||||
|
||||
/**
|
||||
* redis server port
|
||||
* redis server port.
|
||||
*/
|
||||
private int port = 6379;
|
||||
|
||||
/**
|
||||
* redis server password
|
||||
* redis server password.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
/**
|
||||
* redis server default select database
|
||||
* redis server default select database.
|
||||
*/
|
||||
private int database;
|
||||
|
||||
/**
|
||||
* redis server timeout
|
||||
* redis server timeout.
|
||||
*/
|
||||
private Duration timeout;
|
||||
|
||||
@@ -66,17 +66,17 @@ public class RedisDataSourceProperties extends AbstractDataSourceProperties {
|
||||
private List<String> nodes;
|
||||
|
||||
/**
|
||||
* data key in Redis
|
||||
* data key in Redis.
|
||||
*/
|
||||
private String ruleKey;
|
||||
|
||||
/**
|
||||
* channel to subscribe in Redis
|
||||
* channel to subscribe in Redis.
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* redis sentinel model
|
||||
* redis sentinel model.
|
||||
*/
|
||||
private String masterId;
|
||||
|
||||
|
@@ -16,12 +16,10 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource.config;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
||||
|
||||
/**
|
||||
* Zookeeper Properties class Using by {@link DataSourcePropertiesConfiguration} and
|
||||
* {@link ZookeeperDataSourceFactoryBean}
|
||||
@@ -34,8 +32,7 @@ public class ZookeeperDataSourceProperties extends AbstractDataSourceProperties
|
||||
super(ZookeeperDataSourceFactoryBean.class.getName());
|
||||
}
|
||||
|
||||
@NotEmpty
|
||||
private String serverAddr;
|
||||
private String serverAddr = "localhost:2181";
|
||||
|
||||
private String path;
|
||||
|
||||
|
@@ -24,10 +24,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
|
||||
@@ -37,6 +33,10 @@ import com.alibaba.csp.sentinel.slots.system.SystemRule;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Convert sentinel rules for json or xml array Using strict mode to parse json or xml
|
||||
@@ -85,6 +85,7 @@ public abstract class SentinelConverter<T extends Object>
|
||||
List sourceArray = objectMapper.readValue(source,
|
||||
new TypeReference<List<HashMap>>() {
|
||||
});
|
||||
|
||||
for (Object obj : sourceArray) {
|
||||
String item = null;
|
||||
try {
|
||||
|
@@ -16,11 +16,11 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource.factorybean;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating {@link ApolloDataSource} instance.
|
||||
*
|
||||
@@ -30,8 +30,11 @@ import com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource;
|
||||
public class ApolloDataSourceFactoryBean implements FactoryBean<ApolloDataSource> {
|
||||
|
||||
private String namespaceName;
|
||||
|
||||
private String flowRulesKey;
|
||||
|
||||
private String defaultFlowRuleValue;
|
||||
|
||||
private Converter converter;
|
||||
|
||||
@Override
|
||||
|
@@ -19,11 +19,11 @@ package com.alibaba.cloud.sentinel.datasource.factorybean;
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating {@link FileRefreshableDataSource} instance.
|
||||
*
|
||||
@@ -34,9 +34,13 @@ public class FileRefreshableDataSourceFactoryBean
|
||||
implements FactoryBean<FileRefreshableDataSource> {
|
||||
|
||||
private String file;
|
||||
|
||||
private String charset;
|
||||
|
||||
private long recommendRefreshMs;
|
||||
|
||||
private int bufSize;
|
||||
|
||||
private Converter converter;
|
||||
|
||||
@Override
|
||||
|
@@ -18,13 +18,13 @@ package com.alibaba.cloud.sentinel.datasource.factorybean;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource;
|
||||
import com.alibaba.nacos.api.PropertyKeyConst;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating {@link NacosDataSource} instance.
|
||||
*
|
||||
@@ -34,13 +34,19 @@ import com.alibaba.nacos.api.PropertyKeyConst;
|
||||
public class NacosDataSourceFactoryBean implements FactoryBean<NacosDataSource> {
|
||||
|
||||
private String serverAddr;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String dataId;
|
||||
|
||||
private Converter converter;
|
||||
|
||||
private String endpoint;
|
||||
|
||||
private String namespace;
|
||||
|
||||
private String accessKey;
|
||||
|
||||
private String secretKey;
|
||||
|
||||
@Override
|
||||
|
@@ -19,15 +19,15 @@ package com.alibaba.cloud.sentinel.datasource.factorybean;
|
||||
import java.time.Duration;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.redis.RedisDataSource;
|
||||
import com.alibaba.csp.sentinel.datasource.redis.config.RedisConnectionConfig;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating {@link RedisDataSource} instance.
|
||||
*
|
||||
@@ -52,17 +52,17 @@ public class RedisDataSourceFactoryBean implements FactoryBean<RedisDataSource>
|
||||
private Converter converter;
|
||||
|
||||
/**
|
||||
* data key in Redis
|
||||
* data key in Redis.
|
||||
*/
|
||||
private String ruleKey;
|
||||
|
||||
/**
|
||||
* channel to subscribe in Redis
|
||||
* channel to subscribe in Redis.
|
||||
*/
|
||||
private String channel;
|
||||
|
||||
/**
|
||||
* redis server password
|
||||
* redis server password.
|
||||
*/
|
||||
private String password;
|
||||
|
||||
|
@@ -16,12 +16,13 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource.factorybean;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
|
||||
/**
|
||||
* A {@link FactoryBean} for creating {@link ZookeeperDataSource} instance.
|
||||
*
|
||||
@@ -35,6 +36,7 @@ public class ZookeeperDataSourceFactoryBean implements FactoryBean<ZookeeperData
|
||||
private String path;
|
||||
|
||||
private String groupId;
|
||||
|
||||
private String dataId;
|
||||
|
||||
private Converter converter;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
nacos=com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource
|
||||
file=com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource
|
||||
apollo=com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource
|
||||
zk=com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource
|
||||
redis=com.alibaba.csp.sentinel.datasource.redis.RedisDataSource
|
||||
nacos = com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource
|
||||
file =com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource
|
||||
apollo = com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource
|
||||
zk = com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource
|
||||
redis = com.alibaba.csp.sentinel.datasource.redis.RedisDataSource
|
@@ -16,19 +16,19 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.JsonConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ApolloDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.JsonConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ApolloDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
*/
|
||||
|
@@ -16,16 +16,9 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.config.ApolloDataSourceProperties;
|
||||
import com.alibaba.cloud.sentinel.datasource.config.FileDataSourceProperties;
|
||||
import com.alibaba.cloud.sentinel.datasource.config.ZookeeperDataSourceProperties;
|
||||
@@ -39,6 +32,13 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRuleManager;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
|
@@ -16,19 +16,10 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.FileRefreshableDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource;
|
||||
@@ -36,6 +27,15 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
|
@@ -16,19 +16,19 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.SentinelConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.SentinelConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
*/
|
||||
|
@@ -16,12 +16,12 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import com.alibaba.cloud.sentinel.datasource.config.NacosDataSourceProperties;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.config.NacosDataSourceProperties;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.NacosDataSourceFactoryBean;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
|
@@ -16,12 +16,6 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.alibaba.csp.sentinel.slots.block.AbstractRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.authority.AuthorityRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule;
|
||||
@@ -29,6 +23,12 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
import com.alibaba.csp.sentinel.slots.block.flow.param.ParamFlowRule;
|
||||
import com.alibaba.csp.sentinel.slots.system.SystemRule;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
*/
|
||||
|
@@ -16,16 +16,9 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Test;
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.JsonConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.XmlConverter;
|
||||
import com.alibaba.csp.sentinel.slots.block.RuleConstant;
|
||||
@@ -33,6 +26,13 @@ import com.alibaba.csp.sentinel.slots.block.flow.FlowRule;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.util.ResourceUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
|
@@ -16,19 +16,19 @@
|
||||
|
||||
package com.alibaba.cloud.sentinel.datasource;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.XmlConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.alibaba.cloud.sentinel.datasource.converter.XmlConverter;
|
||||
import com.alibaba.cloud.sentinel.datasource.factorybean.ZookeeperDataSourceFactoryBean;
|
||||
import com.alibaba.csp.sentinel.datasource.Converter;
|
||||
import com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource;
|
||||
|
||||
/**
|
||||
* @author <a href="mailto:fangjian0423@gmail.com">Jim</a>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user