Package org.apache.twill.internal.zookeeper

Examples of org.apache.twill.internal.zookeeper.InMemoryZKServer.stopAndWait()


      service.stop();

      Assert.assertTrue(stopLatch.await(2, TimeUnit.SECONDS));

    } finally {
      zkServer.stopAndWait();
    }
  }

  // Test controller listener receive first state change without state transition from service
  @Test
View Full Code Here


      service.stopAndWait();

      zkClientService.stopAndWait();
    } finally {
      zkServer.stopAndWait();
    }
  }

  private Service createService(ZKClient zkClient, RunId runId) {
    return new ZKServiceDecorator(
View Full Code Here

      } finally {
        client.stopAndWait();
      }
    } finally {
      zkServer.stopAndWait();
    }
  }
}
View Full Code Here

      } finally {
        client.stopAndWait();
      }
    } finally {
      zkServer.stopAndWait();
    }
  }

  @Test
  public void testCreateParent() throws ExecutionException, InterruptedException {
View Full Code Here

        Assert.assertTrue(Arrays.equals("testing".getBytes(), client.getData(path).get().getData()));
      } finally {
        client.stopAndWait();
      }
    } finally {
      zkServer.stopAndWait();
    }
  }

  @Test
  public void testGetChildren() throws ExecutionException, InterruptedException {
View Full Code Here

      } finally {
        client.stopAndWait();
      }
    } finally {
      zkServer.stopAndWait();
    }
  }

  @Test
  public void testSetData() throws ExecutionException, InterruptedException {
View Full Code Here

      client.setData("/test", "testing".getBytes()).get();
      Assert.assertTrue(Arrays.equals("testing".getBytes(), client.getData("/test").get().getData()));

    } finally {
      zkServer.stopAndWait();
    }
  }

  @Test
  public void testExpireRewatch() throws InterruptedException, IOException, ExecutionException {
View Full Code Here

        Assert.assertEquals(Watcher.Event.EventType.NodeDeleted, events.poll(4, TimeUnit.SECONDS));
      } finally {
        client.stopAndWait();
      }
    } finally {
      zkServer.stopAndWait();
    }
  }

  @Test
  public void testRetry() throws ExecutionException, InterruptedException, TimeoutException {
View Full Code Here

        }
      }
    }).build(), RetryStrategies.fixDelay(0, TimeUnit.SECONDS)));
    client.startAndWait();

    zkServer.stopAndWait();

    Assert.assertTrue(disconnectLatch.await(1, TimeUnit.SECONDS));

    final CountDownLatch createLatch = new CountDownLatch(1);
    Futures.addCallback(client.create("/testretry/test", null, CreateMode.PERSISTENT), new FutureCallback<String>() {
View Full Code Here

    zkServer.startAndWait();

    try {
      Assert.assertTrue(createLatch.await(5, TimeUnit.SECONDS));
    } finally {
      zkServer.stopAndWait();
    }
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.