Merge pull request #135 from mercyblitz/0.3.0

Add Default properties
This commit is contained in:
小马哥 2018-10-19 11:22:54 +08:00 committed by GitHub
commit a41c173275
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 63 deletions

View File

@ -17,8 +17,8 @@ package com.alibaba.nacos.config.server.constant;
/**
* Server Constants
*
* @author Nacos
*
*/
public class Constants {
@ -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";
@ -164,6 +144,9 @@ public class Constants {
*/
public static final long TOTALTIME_INVALID_THRESHOLD = 60000;
/**
* 批量操作时, 单条数据的状态码
*/
/**
* 发生异常
*/

View File

@ -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);
}
}

View File

@ -1,6 +1,7 @@
# Nacos Default Properties
## Web Server
server.servlet.contextPath=/nacos
server.port=8848
server.tomcat.uri-encoding=UTF-8