use of com.ctrip.xpipe.redis.meta.server.cluster.CurrentClusterServer in project x-pipe by ctripcorp.
the class DefaultClusterServersTest method testStartServerWithSameConfig.
@SuppressWarnings("unused")
@Test
public void testStartServerWithSameConfig() throws Exception {
Assert.assertEquals(1, servers.allClusterServers().size());
logger.info(remarkableMessage("[testServers][start server2]"));
UnitTestServerConfig config2 = new UnitTestServerConfig(2, randomPort());
CurrentClusterServer current2 = createAndStart(config2);
sleep(500);
Assert.assertEquals(2, servers.allClusterServers().size());
try {
logger.info(remarkableMessage("[testServers][start server2 again]"));
CurrentClusterServer current2Copy = createAndStart(config2);
Assert.fail();
} catch (IllegalStateException e) {
}
sleep(500);
Assert.assertEquals(2, servers.allClusterServers().size());
}
use of com.ctrip.xpipe.redis.meta.server.cluster.CurrentClusterServer in project x-pipe by ctripcorp.
the class DefaultClusterServersTest method testStartServerWithDifferentConfig.
@Test
public void testStartServerWithDifferentConfig() throws Exception {
Assert.assertEquals(1, servers.allClusterServers().size());
UnitTestServerConfig config20 = new UnitTestServerConfig(2, randomPort());
logger.info(remarkableMessage("[testServers][start server2]{}"), config20);
@SuppressWarnings("unused") CurrentClusterServer current20 = createAndStart(config20);
sleep(500);
Assert.assertEquals(2, servers.allClusterServers().size());
UnitTestServerConfig config21 = new UnitTestServerConfig(2, config20.getMetaServerPort() + 1);
try {
logger.info(remarkableMessage("[testServers][start server2 with another port again]{}"), config21);
@SuppressWarnings("unused") CurrentClusterServer current21 = createAndStart(config21);
Assert.fail();
} catch (IllegalStateException e) {
// pass
}
}
use of com.ctrip.xpipe.redis.meta.server.cluster.CurrentClusterServer in project x-pipe by ctripcorp.
the class DefaultClusterServersTest method testRestart.
@Test
public void testRestart() throws Exception {
CurrentClusterServer currentClusterServer = getCurrentClusterServer();
Assert.assertEquals(1, servers.allClusterServers().size());
logger.info("[testRestart][stop]");
currentClusterServer.stop();
sleep(300);
Assert.assertEquals(0, servers.allClusterServers().size());
logger.info("[testRestart][start again]");
currentClusterServer.start();
sleep(300);
Assert.assertEquals(1, servers.allClusterServers().size());
}
Aggregations