Revert Constants.java & testcase
This commit is contained in:
parent
69c3989a17
commit
cc616f8d6d
@ -17,8 +17,8 @@ package com.alibaba.nacos.config.server.constant;
|
||||
|
||||
/**
|
||||
* Server Constants
|
||||
*
|
||||
* @author Nacos
|
||||
*
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
@ -31,7 +31,7 @@ public class Constants {
|
||||
public static final String DEFAULT_GROUP = "DEFAULT_GROUP";
|
||||
|
||||
/**
|
||||
* server端配置文件基目录
|
||||
* server端配置文件基目录
|
||||
*/
|
||||
public static final String BASE_DIR = "config-data";
|
||||
|
||||
@ -101,43 +101,23 @@ public class Constants {
|
||||
*/
|
||||
public static final int RECV_WAIT_TIMEOUT = ONCE_TIMEOUT * 5;
|
||||
|
||||
public static final String BASE_PATH = "/nacos/v1/cs";
|
||||
public static final String BASE_PATH = "/v1/cs";
|
||||
|
||||
public static final String DEFAULT_OPS_CONTROLLER_PATH = BASE_PATH + "/ops";
|
||||
public static final String OPS_CONTROLLER_PATH = BASE_PATH + "/ops";
|
||||
|
||||
public static final String OPS_CONTROLLER_PATH = "${nacos.config.ops.path" + ":" + DEFAULT_OPS_CONTROLLER_PATH + "}";
|
||||
public static final String CAPACITY_CONTROLLER_PATH = BASE_PATH + "/capacity";
|
||||
|
||||
public static final String DEFAULT_CAPACITY_CONTROLLER_PATH = BASE_PATH + "/capacity";
|
||||
public static final String COMMUNICATION_CONTROLLER_PATH = BASE_PATH + "/communication";
|
||||
|
||||
public static final String CAPACITY_CONTROLLER_PATH = "${nacos.config.capacity.path" + ":" + DEFAULT_CAPACITY_CONTROLLER_PATH + "}";
|
||||
public static final String CONFIG_CONTROLLER_PATH = BASE_PATH + "/configs";
|
||||
|
||||
public static final String DEFAULT_COMMUNICATION_CONTROLLER_PATH = BASE_PATH + "/communication";
|
||||
public static final String HEALTH_CONTROLLER_PATH = BASE_PATH + "/health";
|
||||
|
||||
// public static final String COMMUNICATION_CONTROLLER_PATH = "${nacos.config.communication.path" + ":" + DEFAULT_COMMUNICATION_CONTROLLER_PATH + "}";
|
||||
public static final String HISTORY_CONTROLLER_PATH = BASE_PATH + "/history";
|
||||
|
||||
public static final String COMMUNICATION_CONTROLLER_PATH = DEFAULT_COMMUNICATION_CONTROLLER_PATH;
|
||||
public static final String LISTENER_CONTROLLER_PATH = BASE_PATH + "/listener";
|
||||
|
||||
public static final String DEFAULT_CONFIG_CONTROLLER_PATH = BASE_PATH + "/configs";
|
||||
|
||||
public static final String CONFIG_CONTROLLER_PATH = "${nacos.config.path" + ":" + DEFAULT_CONFIG_CONTROLLER_PATH + "}";
|
||||
|
||||
public static final String DEFAULT_HEALTH_CONTROLLER_PATH = BASE_PATH + "/health";
|
||||
|
||||
// public static final String HEALTH_CONTROLLER_PATH = "${nacos.config.health.path" + ":" + DEFAULT_HEALTH_CONTROLLER_PATH + "}";
|
||||
|
||||
public static final String HEALTH_CONTROLLER_PATH = DEFAULT_HEALTH_CONTROLLER_PATH;
|
||||
|
||||
public static final String DEFAULT_HISTORY_CONTROLLER_PATH = BASE_PATH + "/history";
|
||||
|
||||
public static final String HISTORY_CONTROLLER_PATH = "${nacos.config.history.path" + ":" + DEFAULT_HISTORY_CONTROLLER_PATH + "}";
|
||||
|
||||
public static final String DEFAULT_LISTENER_CONTROLLER_PATH = BASE_PATH + "/listener";
|
||||
|
||||
public static final String LISTENER_CONTROLLER_PATH = "${nacos.config.listener.path" + ":" + DEFAULT_LISTENER_CONTROLLER_PATH + "}";
|
||||
|
||||
public static final String DEFAULT_NAMESPACE_CONTROLLER_PATH = BASE_PATH + "/namespaces";
|
||||
|
||||
public static final String NAMESPACE_CONTROLLER_PATH = "${nacos.config.namespaces.path" + ":" + DEFAULT_NAMESPACE_CONTROLLER_PATH + "}";
|
||||
public static final String NAMESPACE_CONTROLLER_PATH = BASE_PATH + "/namespaces";
|
||||
|
||||
public static final String ENCODE = "UTF-8";
|
||||
|
||||
@ -156,36 +136,39 @@ public class Constants {
|
||||
public static final String NACOS_LINE_SEPARATOR = "\r\n";
|
||||
|
||||
/**
|
||||
* 从网络获取数据的总时间, 当超过此时间, 不再从网络获取数据, 单位ms
|
||||
* 从网络获取数据的总时间, 当超过此时间, 不再从网络获取数据, 单位ms
|
||||
*/
|
||||
public static final long TOTALTIME_FROM_SERVER = 10000;
|
||||
/**
|
||||
* 从网络获取数据的总时间的失效时间, 单位ms
|
||||
* 从网络获取数据的总时间的失效时间, 单位ms
|
||||
*/
|
||||
public static final long TOTALTIME_INVALID_THRESHOLD = 60000;
|
||||
|
||||
/**
|
||||
* 发生异常
|
||||
* 批量操作时, 单条数据的状态码
|
||||
*/
|
||||
/**
|
||||
* 发生异常
|
||||
*/
|
||||
public static final int BATCH_OP_ERROR = -1;
|
||||
public static final String BATCH_OP_ERROR_IO_MSG = "get config dump error";
|
||||
public static final String BATCH_OP_ERROR_CONFLICT_MSG = "config get conflicts";
|
||||
/**
|
||||
* 查询成功, 数据存在
|
||||
* 查询成功, 数据存在
|
||||
*/
|
||||
public static final int BATCH_QUERY_EXISTS = 1;
|
||||
public static final String BATCH_QUERY_EXISTS_MSG = "config exits";
|
||||
/**
|
||||
* 查询成功, 数据不存在
|
||||
* 查询成功, 数据不存在
|
||||
*/
|
||||
public static final int BATCH_QUERY_NONEXISTS = 2;
|
||||
public static final String BATCH_QUERY_NONEEXISTS_MSG = "config not exits";
|
||||
/**
|
||||
* 新增成功
|
||||
* 新增成功
|
||||
*/
|
||||
public static final int BATCH_ADD_SUCCESS = 3;
|
||||
/**
|
||||
* 更新成功
|
||||
* 更新成功
|
||||
*/
|
||||
public static final int BATCH_UPDATE_SUCCESS = 4;
|
||||
|
||||
@ -197,15 +180,15 @@ public class Constants {
|
||||
public static final int MAX_ADDACK_COUNT = 5;
|
||||
|
||||
/**
|
||||
* 数据的初始版本号
|
||||
* 数据的初始版本号
|
||||
*/
|
||||
public static final int FIRST_VERSION = 1;
|
||||
/**
|
||||
* 数据被删除的标识版本号
|
||||
* 数据被删除的标识版本号
|
||||
*/
|
||||
public static final int POISON_VERSION = -1;
|
||||
/**
|
||||
* 写磁盘文件时, 临时版本号
|
||||
* 写磁盘文件时, 临时版本号
|
||||
*/
|
||||
public static final int TEMP_VERSION = 0;
|
||||
/**
|
||||
@ -221,11 +204,11 @@ public class Constants {
|
||||
public static final String CLIENT_REQUEST_TS_HEADER = "Client-RequestTS";
|
||||
public static final String CLIENT_REQUEST_TOKEN_HEADER = "Client-RequestToken";
|
||||
/**
|
||||
* client, sdk请求server服务的身份
|
||||
* client, sdk请求server服务的身份
|
||||
*/
|
||||
public static final String REQUEST_IDENTITY = "Request-Identity";
|
||||
/**
|
||||
* 鉴权结果信息
|
||||
* 鉴权结果信息
|
||||
*/
|
||||
public static final String ACL_RESPONSE = "ACL-Response";
|
||||
|
||||
|
@ -18,9 +18,14 @@ package com.alibaba.nacos.config.server.constant;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.springframework.mock.env.MockEnvironment;
|
||||
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.*;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.CAPACITY_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.COMMUNICATION_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.CONFIG_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.HEALTH_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.HISTORY_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.LISTENER_CONTROLLER_PATH;
|
||||
import static com.alibaba.nacos.config.server.constant.Constants.NAMESPACE_CONTROLLER_PATH;
|
||||
|
||||
/**
|
||||
* {@link Constants} Test
|
||||
@ -33,23 +38,12 @@ public class ConstantsTest {
|
||||
@Test
|
||||
public void testControllerPathsDefaultValues() {
|
||||
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
|
||||
Assert.assertEquals(DEFAULT_CAPACITY_CONTROLLER_PATH, environment.resolvePlaceholders(CAPACITY_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_COMMUNICATION_CONTROLLER_PATH, environment.resolvePlaceholders(COMMUNICATION_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_CONFIG_CONTROLLER_PATH, environment.resolvePlaceholders(CONFIG_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_HEALTH_CONTROLLER_PATH, environment.resolvePlaceholders(HEALTH_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_HISTORY_CONTROLLER_PATH, environment.resolvePlaceholders(HISTORY_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_LISTENER_CONTROLLER_PATH, environment.resolvePlaceholders(LISTENER_CONTROLLER_PATH));
|
||||
Assert.assertEquals(DEFAULT_NAMESPACE_CONTROLLER_PATH, environment.resolvePlaceholders(NAMESPACE_CONTROLLER_PATH));
|
||||
|
||||
|
||||
Assert.assertEquals("/nacos/v1/cs/capacity", DEFAULT_CAPACITY_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/communication", DEFAULT_COMMUNICATION_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/configs", DEFAULT_CONFIG_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/health", DEFAULT_HEALTH_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/history", DEFAULT_HISTORY_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/listener", DEFAULT_LISTENER_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/nacos/v1/cs/namespaces", DEFAULT_NAMESPACE_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/capacity", CAPACITY_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/communication", COMMUNICATION_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/configs", CONFIG_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/health", HEALTH_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/history", HISTORY_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/listener", LISTENER_CONTROLLER_PATH);
|
||||
Assert.assertEquals("/v1/cs/namespaces", NAMESPACE_CONTROLLER_PATH);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user