use of com.ctrip.xpipe.zk.ZkTestServer in project x-pipe by ctripcorp.
the class AbstractTest method startZk.
protected ZkTestServer startZk(int zkPort) {
try {
logger.info(remarkableMessage("[startZK]{}"), zkPort);
ZkTestServer zkTestServer = new ZkTestServer(zkPort);
zkTestServer.initialize();
zkTestServer.start();
add(zkTestServer);
return zkTestServer;
} catch (Exception e) {
logger.error("[startZk]", e);
throw new IllegalStateException("[startZk]" + zkPort, e);
}
}
use of com.ctrip.xpipe.zk.ZkTestServer in project x-pipe by ctripcorp.
the class TestZkClientTest method test.
@Test
public void test() throws Exception {
ZkTestServer zkTestServer = startRandomZk();
TestZkClient testZkClient = new TestZkClient();
testZkClient.setZkAddress(String.format("127.0.0.1:%d", zkTestServer.getZkPort()));
Assert.assertNull(testZkClient.get());
testZkClient.initialize();
testZkClient.start();
Assert.assertNotNull(testZkClient.get());
testZkClient.stop();
Assert.assertNull(testZkClient.get());
}
use of com.ctrip.xpipe.zk.ZkTestServer in project x-pipe by ctripcorp.
the class TestProfile method getZkTestServer.
@Bean
public ZkTestServer getZkTestServer() throws Exception {
int zkPort = AbstractTest.randomPort();
ZkTestServer zkTestServer = new ZkTestServer(zkPort);
zkTestServer.initialize();
zkTestServer.start();
return zkTestServer;
}
Aggregations