public static MiniBookKeeperCluster createAndStartBookKeeperCluster() throws IOException { zkQuorum = "127.0.0.1:" + MiniAvatarCluster.zkClientPort; bookKeeperCluster = new MiniBookKeeperCluster(zkQuorum, BOOKIES, ZK_TIMEOUT_MS, ZK_TIMEOUT_MS); bookKeeperCluster.start(); assertTrue(bookKeeperCluster.getNumBookiesAvailable(BOOKIES, 10) >= BOOKIES); return bookKeeperCluster; }
@BeforeClass public static void setUpStatic() throws Exception { MiniAvatarCluster.createAndStartZooKeeper(); createAndStartBookKeeperCluster(); zooKeeperClient = bookKeeperCluster.initZK(); bookKeeperClient = new BookKeeper(new ClientConfiguration(), zooKeeperClient); recoveringZooKeeperClient = new RecoveringZooKeeper(new BasicZooKeeper(zooKeeperClient), MAX_ZK_RETRIES, ZK_RETRY_MS); }
@AfterClass public static void shutDownStatic() throws Exception { try { if (bookKeeperClient != null) { bookKeeperClient.close(); } } finally { if (bookKeeperCluster != null) { bookKeeperCluster.shutdown(); } MiniAvatarCluster.shutDownZooKeeper(); } }