Package org.robotninjas.barge.utils

Examples of org.robotninjas.barge.utils.Prober


   * @param increments value expected for counter.
   * @param timeout    timeout in ms.
   * @throws IllegalStateException if {@code expected} is not reached at end of timeout.
   */
  public void waitForValue(final int increments, long timeout) {
    new Prober(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
          return increments == counter;
        }
      }).probe(timeout);
View Full Code Here


      counter.waitForValue(target, timeout);
    }
  }

  void waitForLeaderElection() throws InterruptedException {
    new Prober(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
          return thereIsOneLeader();
        }
      }).probe(10000);
View Full Code Here

    client.target(uris[0]).path("/raft/init").request().post(Entity.json(""));
    client.target(uris[1]).path("/raft/init").request().post(Entity.json(""));
    client.target(uris[2]).path("/raft/init").request().post(Entity.json(""));

    new Prober(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
          return isLeader(client, uris[0]) || isLeader(client, uris[1]) || isLeader(client, uris[2]);
        }
      }).probe(10000);
View Full Code Here

    ClientUpgradeRequest request = new ClientUpgradeRequest();
    wsClient.connect(socket, wsEvents, request);

    client.target(uri).path("/raft/init").request().post(Entity.json(""));

    new Prober(new Callable<Boolean>() {
        @Override
        public Boolean call() throws Exception {
          return Iterables.any(socket.messages, Predicates.contains(Pattern.compile(".*FOLLOWER.*")));
        }
      }).probe(10000);
View Full Code Here

TOP

Related Classes of org.robotninjas.barge.utils.Prober

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.