use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.
the class ConfigControllerTest method testChangeConfig1.
@Test
public void testChangeConfig1() throws Exception {
ConfigModel model = new ConfigModel();
model.setKey(DefaultConsoleDbConfig.KEY_ALERT_SYSTEM_ON);
model.setVal(String.valueOf(false));
RetMessage ret = controller.changeConfig(request, model);
Assert.assertEquals(RetMessage.SUCCESS_STATE, ret.getState());
}
use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.
the class ConfigControllerTest method testChangeConfig2.
@Test
public void testChangeConfig2() throws Exception {
ConfigModel model = new ConfigModel();
model.setKey("Key Unknown");
model.setVal(String.valueOf(false));
RetMessage ret = controller.changeConfig(request, model);
Assert.assertEquals(RetMessage.FAIL_STATE, ret.getState());
Assert.assertEquals("Unknown config key: Key Unknown", ret.getMessage());
}
use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.
the class SentinelUpdateControllerTest method reBalanceSentinels2.
@Test
public void reBalanceSentinels2() throws Exception {
String expectedMessage = "Expected Message";
when(clusterService.reBalanceSentinels(-1)).thenThrow(new RuntimeException(expectedMessage));
RetMessage message = controller.reBalanceSentinels(-1);
Assert.assertEquals(-1, message.getState());
Assert.assertEquals(expectedMessage, message.getMessage());
}
use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.
the class MetaUpdateTest method testUpdateCLusterWithNoOrgIDFound.
@Test
public void testUpdateCLusterWithNoOrgIDFound() throws Exception {
String CLUSTER_NAME = "cluster-name";
long ORG_ID = 99L;
String EXPECTED_MESSAGE = String.format("Organization Id: %d, could not be found", ORG_ID);
ClusterTbl clusterTbl = new ClusterTbl().setClusterName(CLUSTER_NAME).setClusterDescription("").setActivedcId(1).setIsXpipeInterested(true).setStatus("normal").setClusterLastModifiedTime(DateTimeUtils.currentTimeAsString());
clusterDao.createCluster(clusterTbl);
ClusterCreateInfo clusterInfo = new ClusterCreateInfo();
clusterInfo.setClusterName(CLUSTER_NAME);
clusterInfo.setClusterAdminEmails("test@ctrip.com");
clusterInfo.setOrganizationId(ORG_ID);
RetMessage retMessage = clusterController.updateCluster(clusterInfo);
logger.info("{}", retMessage.getMessage());
RetMessage retMessage1 = clusterController.updateCluster(clusterInfo);
Assert.assertEquals(RetMessage.FAIL_STATE, retMessage1.getState());
Assert.assertEquals(EXPECTED_MESSAGE, retMessage1.getMessage());
}
use of com.ctrip.xpipe.redis.console.controller.api.RetMessage in project x-pipe by ctripcorp.
the class MetaUpdateTest method testUpdateClusterWithNoClusterFound.
@Test
public void testUpdateClusterWithNoClusterFound() throws Exception {
String CLUSTER_NAME = "cluster-not-exist";
String EXPECTED_MESSAGE = String.format("cluster not found: %s", CLUSTER_NAME);
ClusterCreateInfo clusterCreateInfo = new ClusterCreateInfo();
clusterCreateInfo.setClusterName(CLUSTER_NAME);
RetMessage retMessage = clusterController.updateCluster(clusterCreateInfo);
logger.info("{}", retMessage.getMessage());
Assert.assertEquals(RetMessage.FAIL_STATE, retMessage.getState());
Assert.assertEquals(EXPECTED_MESSAGE, retMessage.getMessage());
}
Aggregations