};
ExhibitorEnsembleProvider provider = new ExhibitorEnsembleProvider(exhibitors, mockRestClient, "/foo", 10, new RetryOneTime(1));
provider.pollForInitialEnsemble();
Timing timing = new Timing().multiple(4);
final CuratorZookeeperClient client = new CuratorZookeeperClient(provider, timing.session(), timing.connection(), null, new RetryOneTime(2));
client.start();
try
{
RetryLoop.callWithRetry
(
client,
new Callable<Object>()
{
@Override
public Object call() throws Exception
{
client.getZooKeeper().create("/test", new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
return null;
}
}
);
connectionString.set(secondConnectionString);
semaphore.drainPermits();
semaphore.acquire();
server.stop(); // create situation where the current zookeeper gets a sys-disconnected
Stat stat = RetryLoop.callWithRetry
(
client,
new Callable<Stat>()
{
@Override
public Stat call() throws Exception
{
return client.getZooKeeper().exists("/test", false);
}
}
);
Assert.assertNull(stat); // it's a different server so should be null
}
finally
{
client.close();
}
}
finally
{
CloseableUtils.closeQuietly(secondServer);