本文整理了Java中pl.allegro.tech.hermes.test.helper.zookeeper.ZookeeperWaiter
类的一些代码示例,展示了ZookeeperWaiter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperWaiter
类的具体详情如下:
包路径:pl.allegro.tech.hermes.test.helper.zookeeper.ZookeeperWaiter
类名称:ZookeeperWaiter
暂无
代码示例来源:origin: allegro/hermes
public void untilZookeeperPathIsCreated(String... path) {
untilZookeeperPathIsCreated(stream(path).collect(joining("/")));
}
代码示例来源:origin: allegro/hermes
public void untilZookeeperPathNotExists(String... path) {
untilZookeeperPathNotExists(stream(path).collect(joining("/")));
}
代码示例来源:origin: allegro/hermes
public void untilZookeeperClientStarted() {
this.untilZookeeperClientStarted(zookeeper);
}
代码示例来源:origin: allegro/hermes
@Test
public void shouldRemoveInactiveConsumerEntries() throws Exception {
// given
ConsumerInstance consumer1 = consumer("consumer1");
ConsumerInstance consumer2 = consumer("consumer2");
maxRateRegistry.ensureCorrectAssignments(subscription, Sets.newHashSet("consumer1", "consumer2"));
maxRateRegistry.update(subscription, ImmutableMap.of(
"consumer1", new MaxRate(350.0),
"consumer2", new MaxRate(0.5)
));
wait.untilZookeeperPathIsCreated(
zookeeperPaths.consumersMaxRatePath(cluster, consumer1.getSubscription(), consumer1.getConsumerId()));
wait.untilZookeeperPathIsCreated(
zookeeperPaths.consumersMaxRatePath(cluster, consumer2.getSubscription(), consumer2.getConsumerId()));
// when
maxRateRegistry.ensureCorrectAssignments(subscription, Sets.newHashSet("consumer1", "consumer3"));
wait.untilZookeeperPathNotExists(
zookeeperPaths.consumersRatePath(cluster, consumer2.getSubscription(), consumer2.getConsumerId()));
// then
assertEquals(Optional.empty(), maxRateRegistry.getMaxRate(consumer2));
}
代码示例来源:origin: allegro/hermes
@BeforeClass
public static void beforeZookeeperClass() throws Exception {
zookeeperServer = new TestingServer(45678);
zookeeperClient = CuratorFrameworkFactory.builder()
.connectString(zookeeperServer.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
.build();
zookeeperClient.start();
wait = new ZookeeperWaiter(zookeeperClient);
wait.untilZookeeperClientStarted();
ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
zookeeperServer.getConnectString(), 60 * 1000, 15 * 1000,
10, Time.SYSTEM, "zookeeper-test", "zookeeper-test");
zooKeeperClient.waitUntilConnected();
kafkaZkClient = new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
}
代码示例来源:origin: allegro/hermes
public void untilZookeeperPathIsEmpty(String... path) {
untilZookeeperPathIsEmpty(stream(path).collect(joining("/")));
}
}
代码示例来源:origin: allegro/hermes
public void untilZookeeperClientStopped() {
this.untilZookeeperClientStopped(zookeeper);
}
代码示例来源:origin: allegro/hermes
@Test
public void shouldApplyAssignmentChangesByRemovingSubscriptionNode() {
// given
Subscription s1 = anySubscription();
SubscriptionAssignmentView view = stateWithSingleAssignment(s1);
workTracker.apply(subscriptionAssignmentRegistry.createSnapshot(), view);
wait.untilZookeeperPathIsCreated(basePath, s1.getQualifiedName().toString(), supervisorId);
// when
workTracker.apply(subscriptionAssignmentRegistry.createSnapshot(), stateWithNoAssignments());
// then
wait.untilZookeeperPathNotExists(basePath, s1.getQualifiedName().toString());
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
@BeforeClass
public static void beforeZookeeperClass() throws Exception {
zookeeperServer = new TestingServer(45678);
zookeeperClient = CuratorFrameworkFactory.builder()
.connectString(zookeeperServer.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
.build();
zookeeperClient.start();
wait = new ZookeeperWaiter(zookeeperClient);
wait.untilZookeeperClientStarted();
ZooKeeperClient zooKeeperClient = new ZooKeeperClient(
zookeeperServer.getConnectString(), 60 * 1000, 15 * 1000,
10, Time.SYSTEM, "zookeeper-test", "zookeeper-test");
zooKeeperClient.waitUntilConnected();
kafkaZkClient = new KafkaZkClient(zooKeeperClient, false, Time.SYSTEM);
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
public void untilZookeeperPathIsEmpty(String... path) {
untilZookeeperPathIsEmpty(stream(path).collect(joining("/")));
}
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
public void untilZookeeperClientStopped() {
this.untilZookeeperClientStopped(zookeeper);
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
public void untilZookeeperPathIsCreated(String... path) {
untilZookeeperPathIsCreated(stream(path).collect(joining("/")));
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
public void untilZookeeperPathNotExists(String... path) {
untilZookeeperPathNotExists(stream(path).collect(joining("/")));
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
public void untilZookeeperClientStarted() {
this.untilZookeeperClientStarted(zookeeper);
}
代码示例来源:origin: allegro/hermes
@Test
public void shouldIncrementAndRetrieveCounterValue() {
// given when
counter.increment("/increment/host/metric", 10);
wait.untilZookeeperPathIsCreated("/increment/host/metric");
// then
assertThat(counter.getValue("/increment", "/metric")).isEqualTo(10);
assertThat(counter.countOccurrences("/increment", "/metric")).isEqualTo(1);
}
代码示例来源:origin: allegro/hermes
private Subscription dropAssignment(Subscription sub) {
workTracker.dropAssignment(sub);
wait.untilZookeeperPathNotExists(basePath, sub.getQualifiedName().toString(), supervisorId);
return sub;
}
}
代码示例来源:origin: allegro/hermes
protected static CuratorFramework newClient() {
CuratorFramework newClient = CuratorFrameworkFactory.builder()
.connectString(zookeeperServer.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
.build();
newClient.start();
wait.untilZookeeperClientStarted(newClient);
return newClient;
}
代码示例来源:origin: allegro/hermes
@Test
public void shouldIncrementAndRetrieveCounterForGivenPath() {
// given when
counter.increment("/increment", 10);
wait.untilZookeeperPathIsCreated("/increment");
// then
assertThat(counter.getValue("/increment")).isEqualTo(10);
}
代码示例来源:origin: allegro/hermes
@Test
public void shouldDropAssignmentAndEmptySubscriptionNode() {
// given
Subscription sub = forceAssignment(anySubscription());
// when
workTracker.dropAssignment(sub);
wait.untilZookeeperPathNotExists(basePath, sub.getQualifiedName().toString());
// then
assertThat(workTracker.isAssignedTo(sub.getQualifiedName(), supervisorId)).isFalse();
}
代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper
protected static CuratorFramework newClient() {
CuratorFramework newClient = CuratorFrameworkFactory.builder()
.connectString(zookeeperServer.getConnectString())
.retryPolicy(new ExponentialBackoffRetry(1000, 3))
.build();
newClient.start();
wait.untilZookeeperClientStarted(newClient);
return newClient;
}
内容来源于网络,如有侵权,请联系作者删除!