Ejemplo n.º 1
0
  @Test
  public void test() throws Exception {
    final DefaultZooKeeperClient client = new DefaultZooKeeperClient(zk.curatorWithSuperAuth());
    client.ensurePath("/foo/bar");
    final ZooKeeperHealthChecker hc =
        new ZooKeeperHealthChecker(client, "/foo", riemannClient.facade(), MILLISECONDS, 1);
    hc.start();

    // Start in our garden of eden where everything travaileth together in harmony....
    awaitHealthy(hc, 1, MINUTES);

    // Alas!  Behold!  Our zookeeper hath been slain with the sword of the wrath of the random!
    zk.stop();
    awaitState("critical", 1, MINUTES);

    // And lo, our zookeeper hath been resurrected and our foe vanquished!
    zk.start();
    awaitState("ok", 1, MINUTES);
    awaitHealthy(hc, 1, MINUTES);

    // And they lived happily ever after
  }
Ejemplo n.º 2
0
 @After
 public void tearDown() throws Exception {
   if (zk != null) {
     zk.stop();
   }
 }