Source:
public void startSingleServerTest() throws Exception { setUpData(); startServer(leaderId, serverStrings.get(leaderId) + "\n"); ReconfigTest.testServerHasConfig(zkHandles[leaderId], null, null); LOG.info("Initial Configuration:\n" + new String(zkHandles[leaderId].getConfig(this, new Stat()))); startFollowers(); testReconfig(leaderId, true, reconfigServers); LOG.info("Configuration after adding 2 followers:\n" + new String(zkHandles[leaderId].getConfig(this, new Stat()))); shutDownServer(leaderId); ReconfigTest.testNormalOperation(zkHandles[follower1], zkHandles[follower2]); reconfigServers.clear(); reconfigServers.add(Integer.toString(follower2)); try { ReconfigTest.reconfig(zkAdminHandles[follower1], null, reconfigServers, null, -1); Assert.fail("reconfig completed successfully even though there is no quorum up in new config!"); } catch (KeeperException.NewConfigNoQuorum e) { } reconfigServers.clear(); reconfigServers.add(Integer.toString(leaderId)); reconfigServers.add(Integer.toString(follower1)); testReconfig(follower2, false, reconfigServers); LOG.info("Configuration after removing leader and follower 1:\n" + new String(zkHandles[follower2].getConfig(this, new Stat()))); reconfigServers.clear(); reconfigServers.add(Integer.toString(follower2)); try { zkAdminHandles[follower2].reconfigure(null, reconfigServers, null, -1, new Stat()); Assert.fail("reconfig completed successfully even though there is no quorum up in new config!"); } catch (KeeperException.BadArgumentsException e) { } catch (Exception e) { Assert.fail("Should have been BadArgumentsException!"); } shutDownServer(1); ArrayList<String> observerStrings = new ArrayList<String>(); startObservers(observerStrings); testReconfig(follower2, true, reconfigServers); testReconfig(follower2, true, observerStrings); LOG.info("Configuration after adding two observers:\n" + new String(zkHandles[follower2].getConfig(this, new Stat()))); shutDownData(); }

Target:
public void startSingleServerTest() throws Exception { setUpData(); startServer(leaderId, serverStrings.get(leaderId) + "\n"); ReconfigTest.testServerHasConfig(zkHandles[leaderId], null, null); LOG.info("Initial Configuration:\n" + new String(zkHandles[leaderId].getConfig(this, new Stat()))); startFollowers(); testReconfig(leaderId, true, reconfigServers); LOG.info("Configuration after adding 2 followers:\n" + new String(zkHandles[leaderId].getConfig(this, new Stat()))); shutDownServer(leaderId); ReconfigTest.testNormalOperation(zkHandles[follower1], zkHandles[follower2]); reconfigServers.clear(); reconfigServers.add(Integer.toString(follower2)); try { ReconfigTest.reconfig(zkAdminHandles[follower1], null, reconfigServers, null, -1); Assert.fail("reconfig completed successfully even though there is no quorum up in new config!"); } catch (KeeperException.NewConfigNoQuorum e) { } reconfigServers.clear(); reconfigServers.add(Integer.toString(leaderId)); reconfigServers.add(Integer.toString(follower1)); testReconfig(follower2, false, reconfigServers); LOG.info("Configuration after removing leader and follower 1:\n" + new String(zkHandles[follower2].getConfig(this, new Stat()))); shutDownServer(follower1); reconfigServers.clear(); reconfigServers.add(Integer.toString(follower2)); try { zkAdminHandles[follower2].reconfigure(null, reconfigServers, null, -1, new Stat()); Assert.fail("reconfig completed successfully even though there is no quorum up in new config!"); } catch (KeeperException.BadArgumentsException e) { } catch (Exception e) { Assert.fail("Should have been BadArgumentsException!"); } ArrayList<String> observerStrings = new ArrayList<String>(); startObservers(observerStrings); testReconfig(follower2, true, reconfigServers); testReconfig(follower2, true, observerStrings); LOG.info("Configuration after adding two observers:\n" + new String(zkHandles[follower2].getConfig(this, new Stat()))); shutDownData(); }