use of com.ctrip.xpipe.zk.impl.TestZkClient in project x-pipe by ctripcorp.
the class AbstractMetaServerContextTest method createZkClient.
public ZkClient createZkClient() throws Exception {
try {
TestZkClient zkClient = new TestZkClient();
zkClient.setZkAddress(zkAddress);
zkClient.initialize();
zkClient.start();
add(zkClient);
return zkClient;
} catch (Exception e) {
logger.info(e.getMessage());
return null;
}
}
use of com.ctrip.xpipe.zk.impl.TestZkClient 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.zk.impl.TestZkClient in project x-pipe by ctripcorp.
the class TestProfile method getZkClient.
@Bean
public ZkClient getZkClient() throws Exception {
TestZkClient zkClient = new TestZkClient();
zkClient.initialize();
zkClient.start();
return zkClient;
}
use of com.ctrip.xpipe.zk.impl.TestZkClient in project x-pipe by ctripcorp.
the class AbstractMetaServerContextTest method beforeAbstractMetaServerContextTest.
@Before
public void beforeAbstractMetaServerContextTest() throws Exception {
arrangeTaskStart(false);
int zkPort = getTestZkPort();
if (isStartZk()) {
startZk(zkPort);
}
zkAddress = String.format("localhost:%d", zkPort);
try {
TestZkClient client = getBean(TestZkClient.class);
client.setZkAddress(zkAddress);
} catch (IllegalStateException e) {
// not found, if not
}
}
use of com.ctrip.xpipe.zk.impl.TestZkClient in project x-pipe by ctripcorp.
the class TestProfile method getZkClient.
@Bean
public ZkClient getZkClient(ZkTestServer zkTestServer) throws Exception {
TestZkClient zkClient = new TestZkClient();
zkClient.setZkAddress(String.format("%s:%d", "localhost", zkTestServer.getZkPort()));
zkClient.initialize();
zkClient.start();
logger.info("[getZkClient][test]");
return zkClient;
}
Aggregations