@Override protected void setUp() throws Exception { LOG.info("STARTING " + getName()); // set the snap count to something low so that we force log rollover // and verify that is working as part of the epoch rollover. SyncRequestProcessor.setSnapCount(7); qu = new QuorumUtil(1); startAll(); for (int i = 0; i < zkClients.length; i++) { zkClientWatchers[i] = new CountdownWatcher(); PeerStruct peer = qu.getPeer(i + 1); zkClients[i] = new ZooKeeper( "127.0.0.1:" + peer.clientPort, ClientTest.CONNECTION_TIMEOUT, zkClientWatchers[i]); } waitForClientsConnected(); }
@Before public void setUp() throws Exception { System.setProperty("zookeeper.admin.enableServer", "false"); // set the snap count to something low so that we force log rollover // and verify that is working as part of the epoch rollover. SyncRequestProcessor.setSnapCount(7); qu = new QuorumUtil(1); startAll(); for (int i = 0; i < zkClients.length; i++) { zkClientWatchers[i] = new CountdownWatcher(); PeerStruct peer = qu.getPeer(i + 1); zkClients[i] = new ZooKeeper( "127.0.0.1:" + peer.clientPort, ClientTest.CONNECTION_TIMEOUT, zkClientWatchers[i]); } waitForClientsConnected(); }
@Override protected void setUp() throws Exception { LOG.info("STARTING " + getName()); // set the snap count to something low so that we force log rollover // and verify that is working as part of the epoch rollover. SyncRequestProcessor.setSnapCount(7); qu = new QuorumUtil(1); startAll(); for (int i = 0; i < zkClients.length; i++) { zkClientWatchers[i] = new CountdownWatcher(); int followerPort = qu.getPeer(i+1).peer.getClientPort(); zkClients[i] = new ZooKeeper( "127.0.0.1:" + followerPort, ClientTest.CONNECTION_TIMEOUT, zkClientWatchers[i]); } waitForClients(); }
private void start(int idx) throws Exception { qu.start(idx); for (String hp : qu.getConnString().split(",")) { Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp(hp, ClientTest.CONNECTION_TIMEOUT)); } checkLeader(); // all clients should be connected checkClientsConnected(); }
private void restartServer(Map<String, String> authConfigs, int index, ZooKeeper zk, CountdownWatcher watcher) throws IOException, KeeperException, InterruptedException, TimeoutException { LOG.info("Restarting server myid=" + index); MainThread m = shutdown(index); startServer(m, authConfigs); Assert.assertTrue("waiting for server" + index + "being up", ClientBase.waitForServerUp("127.0.0.1:" + m.getClientPort(), ClientBase.CONNECTION_TIMEOUT)); watcher.waitForConnected(ClientTest.CONNECTION_TIMEOUT); zk.create("/foo", new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT_SEQUENTIAL); }
private void start(int idx) throws IOException { qu.start(idx); for (String hp : qu.getConnString().split(",")) { Assert.assertTrue("waiting for server up", ClientBase.waitForServerUp(hp, ClientTest.CONNECTION_TIMEOUT)); } checkLeader(); }
private void waitForClientsConnected() throws Exception { for (int i = 0; i < zkClients.length; i++) { zkClientWatchers[i].waitForConnected(ClientTest.CONNECTION_TIMEOUT); zkClientWatchers[i].reset(); } }
private void waitForClients() throws Exception { for (int i = 0; i < zkClients.length; i++) { zkClientWatchers[i].waitForConnected(ClientTest.CONNECTION_TIMEOUT); zkClientWatchers[i].reset(); } }