public class ZooKeeperTestingServerManager extends Object implements ZooKeeperTestManager
TestingServer
to run an in-process ZooKeeper instance.| Modifier and Type | Field and Description |
|---|---|
TemporaryPorts |
temporaryPorts |
| Constructor and Description |
|---|
ZooKeeperTestingServerManager() |
ZooKeeperTestingServerManager(String namespace) |
| Modifier and Type | Method and Description |
|---|---|
void |
awaitDown(int timeout,
TimeUnit timeunit)
Await zookeeper not able to serve requests.
|
void |
awaitUp(long timeout,
TimeUnit timeunit)
Await zookeeper successfully serving requests.
|
void |
backup(Path destination) |
void |
close()
Tear down zookeeper.
|
String |
connectString()
Get a connection string for this zk cluster.
|
org.apache.curator.framework.CuratorFramework |
curator()
Get a curator client connected to this cluster.
|
void |
ensure(String path)
Ensure a path.
|
void |
reset() |
void |
restore(Path source) |
void |
start()
Start zookeeper.
|
void |
stop()
Stop zookeeper.
|
public final TemporaryPorts temporaryPorts
public ZooKeeperTestingServerManager()
public ZooKeeperTestingServerManager(String namespace)
public void ensure(String path) throws Exception
ZooKeeperTestManagerensure in interface ZooKeeperTestManagerpath - The path to ensure.Exception - If an unexpected exception occurs.public void close()
throws InterruptedException
ZooKeeperTestManagerclose in interface ZooKeeperTestManagerInterruptedException - If the thread is interrupted.public String connectString()
ZooKeeperTestManagerconnectString in interface ZooKeeperTestManagerpublic org.apache.curator.framework.CuratorFramework curator()
ZooKeeperTestManagercurator in interface ZooKeeperTestManagerpublic void awaitUp(long timeout,
TimeUnit timeunit)
throws TimeoutException
ZooKeeperTestManagerawaitUp in interface ZooKeeperTestManagertimeout - The timeout value.timeunit - The time unit.TimeoutException - If the operation times out.public void awaitDown(int timeout,
TimeUnit timeunit)
throws TimeoutException
ZooKeeperTestManagerawaitDown in interface ZooKeeperTestManagertimeout - The timeout value.timeunit - The timeout unit.TimeoutException - If the operation times out.public void start()
ZooKeeperTestManagerstart in interface ZooKeeperTestManagerpublic void stop()
throws InterruptedException
ZooKeeperTestManagerstop in interface ZooKeeperTestManagerInterruptedException - If the thread is interrupted.public void backup(Path destination)
public void restore(Path source)
public void reset()
Copyright © 2015. All rights reserved.