Java 类org.apache.zookeeper.server.quorum.QuorumStats 实例源码

项目:fuck_zookeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:https-github.com-apache-zookeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:ZooKeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:StreamProcessingInfrastructure    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:bigstreams    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:zookeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:SecureKeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:SecureKeeper    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:StreamBench    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:LoadBalanced_zk    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:LoadBalanced_zk    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}
项目:zookeeper-pkg    文件:ObserverLETest.java   
/**
 * See ZOOKEEPER-1294. Confirms that an observer will not support the quorum
 * of a leader by forming a 5-node, 2-observer ensemble (so quorum size is 2).
 * When all but the leader and one observer are shut down, the leader should
 * enter the 'looking' state, not stay in the 'leading' state.
 */
@Test
public void testLEWithObserver() throws Exception {
    QuorumPeer leader = null;
    for (QuorumPeer server : Arrays.asList(qb.s1, qb.s2, qb.s3)) {
        if (server.getServerState().equals(
                QuorumStats.Provider.FOLLOWING_STATE)) {
            server.shutdown();
            assertTrue("Waiting for server down", ClientBase
                    .waitForServerDown("127.0.0.1:"
                            + server.getClientPort(),
                            ClientBase.CONNECTION_TIMEOUT));
        } else {
            assertNull("More than one leader found", leader);
            leader = server;
        }
    }
    assertTrue("Leader is not in Looking state", ClientBase
            .waitForServerState(leader, ClientBase.CONNECTION_TIMEOUT,
                    QuorumStats.Provider.LOOKING_STATE));
}