final ServerConfiguration conf = new ServerConfiguration()
.setZkServers(null).setJournalDirName(tmpDir.getPath())
.setLedgerDirNames(new String[] { tmpDir.getPath() });
// simulating ZooKeeper exception by assigning a closed zk client to bk
BookieServer bkServer = new BookieServer(conf) {
protected Bookie newBookie(ServerConfiguration conf)
throws IOException, KeeperException, InterruptedException,
BookieException {
MockBookie bookie = new MockBookie(conf);
bookie.zk = zkc;
zkc.close();
return bookie;
};
};
bkServer.start();
bkServer.join();
Assert.assertEquals("Failed to return ExitCode.ZK_REG_FAIL",
ExitCode.ZK_REG_FAIL, bkServer.getExitCode());
}