use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class AbstractMetaServerClusterTest method createMetaServers.
protected void createMetaServers(int serverCount) throws Exception {
for (int i = 0; i < serverCount; i++) {
int port = portUsable(defaultMetaServerPort());
TestMetaServer testMetaServer = createMetaServer(i + 1, port, zkPort);
add(testMetaServer);
}
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class AbstractMetaServerClusterTest method createMetaServer.
protected TestMetaServer createMetaServer(int index, int port, int zkPort, String configFile) throws Exception {
TestMetaServer testMetaServer = new TestMetaServer(index, port, zkPort, configFile);
testMetaServer.initialize();
testMetaServer.start();
return testMetaServer;
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServersApiTest method testClusterChanged.
@Test
public void testClusterChanged() throws Exception {
createMetaServers(metaServerCount);
sleep(waitForMetaServerOkTime);
logger.info(remarkableMessage("[testClusterChanged][begin send cluster change message]"));
ClusterMeta clusterMeta = randomCluster();
for (TestMetaServer server : getServers()) {
String path = META_SERVER_SERVICE.CLUSTER_CHANGE.getRealPath(server.getAddress());
logger.info("[testClusterChanged]{}", path);
restTemplate.postForEntity(path, clusterMeta, String.class, clusterMeta.getId());
restTemplate.put(path, clusterMeta, String.class, clusterMeta.getId());
restTemplate.delete(path, clusterMeta.getId());
}
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServersApiTest method testMakeMasterReadOnly.
@Test
public void testMakeMasterReadOnly() throws Exception {
createMetaServers(metaServerCount);
sleep(waitForMetaServerOkTime);
logger.info(remarkableMessage("[testMakeMasterReadOnly][begin send make master read only message]"));
for (TestMetaServer server : getServers()) {
logger.info("[testChangePrimaryDcCheck]{}", server.getAddress());
MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService(server.getAddress());
MetaServerConsoleService.PreviousPrimaryDcMessage message = consoleService.makeMasterReadOnly(getClusterId(), getShardId(), true);
logger.info("[testMakeMasterReadOnly][true]{}", message);
message = consoleService.makeMasterReadOnly(getClusterId(), getShardId(), false);
logger.info("[testMakeMasterReadOnly][false]{}", message);
}
}
use of com.ctrip.xpipe.redis.meta.server.TestMetaServer in project x-pipe by ctripcorp.
the class ClusterServersApiTest method testDoChangePrimaryDc.
@Test
public void testDoChangePrimaryDc() throws Exception {
createMetaServers(metaServerCount);
sleep(waitForMetaServerOkTime);
logger.info(remarkableMessage("[testDoChangePrimaryDc][begin send change primary dc message]"));
for (TestMetaServer server : getServers()) {
logger.info(remarkableMessage("[testDoChangePrimaryDc][jq]"));
MetaServerConsoleService.PrimaryDcChangeRequest request = new MetaServerConsoleService.PrimaryDcChangeRequest();
request.setMasterInfo(new MasterInfo(RunidGenerator.DEFAULT.generateRunid(), 100L));
MetaServerConsoleService consoleService = new DefaultMetaServerConsoleService(server.getAddress());
PrimaryDcChangeMessage message = consoleService.doChangePrimaryDc(getClusterId(), getShardId(), "jq", request);
logger.info("{}", message);
logger.info(remarkableMessage("[testDoChangePrimaryDc][oy]"));
message = consoleService.doChangePrimaryDc(getClusterId(), getShardId(), "oy", request);
logger.info("{}", message);
}
}
Aggregations