use of com.ctrip.xpipe.redis.meta.server.config.UnitTestServerConfig 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.config.UnitTestServerConfig 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.config.UnitTestServerConfig in project x-pipe by ctripcorp.
the class TestMetaServer method doStart.
@Override
public void doStart() throws Exception {
System.setProperty(DefaultDcMetaCache.MEMORY_META_SERVER_DAO_KEY, configFile);
System.setProperty("TOTAL_SLOTS", String.valueOf(total_slots));
SpringApplication application = new SpringApplication(TestMetaServer.class);
application.setBannerMode(Mode.OFF);
application.setEnvironment(createEnvironment());
context = application.run(new String[] {});
TestZkClient client = context.getBean(TestZkClient.class);
DefaultZkConfig zkConfig = new DefaultZkConfig();
zkConfig.setZkSessionTimeoutMillis(zkSessionTimeoutMillis);
client.setZkConfig(zkConfig);
client.setZkAddress(zkConnectionStr);
UnitTestServerConfig config = context.getBean(UnitTestServerConfig.class);
config.setZkAddress(zkConnectionStr);
config.setMetaServerId(serverId);
config.setMetaServerPort(serverPort);
ArrangeTaskTrigger arrangeTaskTrigger = context.getBean(ArrangeTaskTrigger.class);
arrangeTaskTrigger.setWaitForRestartTimeMills(waitForRestartTimeMills);
manager = context.getBean(SpringComponentRegistry.class);
manager.initialize();
manager.start();
}
use of com.ctrip.xpipe.redis.meta.server.config.UnitTestServerConfig in project x-pipe by ctripcorp.
the class DefaultOffsetwaiterTest method beforeDefaultOffsetwaiterTest.
@Before
public void beforeDefaultOffsetwaiterTest() throws Exception {
offsetwaiter = new DefaultOffsetwaiter();
offsetwaiter.setKeyedObjectPool(getXpipeNettyClientKeyedObjectPool());
offsetwaiter.setMetaServerConfig(new UnitTestServerConfig().setWaitforOffsetMilli(waitforOffsetMilli));
offsetwaiter.setScheduled(scheduled);
executionLog = new ExecutionLog(currentTestName());
host = "127.0.0.1";
port = randomPort();
}
Aggregations