Source:
<code>public void testAcceptedEpochWriteFailure() throws Exception { StringBuilder sb = new StringBuilder(); sb.append("admin.enableServer=false"); sb.append("\n"); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); server = "server." + i + "=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;127.0.0.1:" + clientPorts[i]; sb.append(server); sb.append("\n"); } String currentQuorumCfgSection = sb.toString(); for (int i = 0; i < SERVER_COUNT - 1; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); mt[i].start(); } for (int i = 0; i < SERVER_COUNT - 1; i++) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } CountdownWatcher watch1 = new CountdownWatcher(); zk = new ZooKeeper("127.0.0.1:" + clientPorts[0], ClientBase.CONNECTION_TIMEOUT, watch1); watch1.waitForConnected(ClientBase.CONNECTION_TIMEOUT); String data = "originalData"; zk.create("/epochIssue", data.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); mt[2] = new MainThread(2, clientPorts[2], currentQuorumCfgSection, false) { @Override public TestQPMain getTestQPMain() { return new MockTestQPMain(); } }; mt[2].start(); Assert.assertFalse("verify server 2 not started", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[2], CONNECTION_TIMEOUT / 2)); QuorumPeer quorumPeer = mt[2].getQuorumPeer(); Assert.assertEquals("acceptedEpoch must not have changed", 0, quorumPeer.getAcceptedEpoch()); <START> } <END></code><technical_language>need assert currentEpoch here</technical_language>

Target:
public void testAcceptedEpochWriteFailure() throws Exception { StringBuilder sb = new StringBuilder(); sb.append("admin.enableServer=false"); sb.append("\n"); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); server = "server." + i + "=127.0.0.1:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;127.0.0.1:" + clientPorts[i]; sb.append(server); sb.append("\n"); } String currentQuorumCfgSection = sb.toString(); for (int i = 0; i < SERVER_COUNT - 1; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); mt[i].start(); } for (int i = 0; i < SERVER_COUNT - 1; i++) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); } CountdownWatcher watch1 = new CountdownWatcher(); zk = new ZooKeeper("127.0.0.1:" + clientPorts[0], ClientBase.CONNECTION_TIMEOUT, watch1); watch1.waitForConnected(ClientBase.CONNECTION_TIMEOUT); String data = "originalData"; zk.create("/epochIssue", data.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); mt[2] = new MainThread(2, clientPorts[2], currentQuorumCfgSection, false) { @Override public TestQPMain getTestQPMain() { return new MockTestQPMain(); } }; mt[2].start(); Assert.assertFalse("verify server 2 not started", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[2], CONNECTION_TIMEOUT / 2)); QuorumPeer quorumPeer = mt[2].getQuorumPeer(); Assert.assertEquals("acceptedEpoch must not have changed", 0, quorumPeer.getAcceptedEpoch()); Assert.assertEquals("currentEpoch must not have changed", 0, quorumPeer.getCurrentEpoch()); }