Search in sources :

Example 1 with PeerStruct

use of org.apache.zookeeper.test.QuorumUtil.PeerStruct in project zookeeper by apache.

the class ZxidRolloverTest method shutdown.

private void shutdown(int idx) throws Exception {
    qu.shutdown(idx);
    // leader will shutdown, remaining followers will elect a new leader
    PeerStruct peer = qu.getPeer(idx);
    Assert.assertTrue("Waiting for server down", ClientBase.waitForServerDown("127.0.0.1:" + peer.clientPort, ClientBase.CONNECTION_TIMEOUT));
    // disconnected
    if (idx == idxLeader) {
        checkClientDisconnected(idx);
        try {
            checkClientsDisconnected();
        } catch (AssertionError e) {
        // the clients may or may not have already reconnected
        // to the recovered cluster, force a check, but ignore
        }
    } else {
        checkClientDisconnected(idx);
    }
}
Also used : PeerStruct(org.apache.zookeeper.test.QuorumUtil.PeerStruct)

Example 2 with PeerStruct

use of org.apache.zookeeper.test.QuorumUtil.PeerStruct in project zookeeper by apache.

the class ZxidRolloverTest method setUp.

@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();
}
Also used : ZooKeeper(org.apache.zookeeper.ZooKeeper) CountdownWatcher(org.apache.zookeeper.test.ClientBase.CountdownWatcher) QuorumUtil(org.apache.zookeeper.test.QuorumUtil) PeerStruct(org.apache.zookeeper.test.QuorumUtil.PeerStruct) Before(org.junit.Before)

Aggregations

PeerStruct (org.apache.zookeeper.test.QuorumUtil.PeerStruct)2 ZooKeeper (org.apache.zookeeper.ZooKeeper)1 CountdownWatcher (org.apache.zookeeper.test.ClientBase.CountdownWatcher)1 QuorumUtil (org.apache.zookeeper.test.QuorumUtil)1 Before (org.junit.Before)1