public class ZooKeeperTestingClusterManager extends Object implements ZooKeeperTestManager
TestingServer
to run an in-process ZooKeeper cluster.| Modifier and Type | Field and Description |
|---|---|
TemporaryPorts |
temporaryPorts |
| Constructor and Description |
|---|
ZooKeeperTestingClusterManager() |
| 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 |
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.
|
org.apache.curator.framework.CuratorFramework |
peerCurator(int id)
Get a
CuratorFramework client connected to only one of the peers. |
void |
resetPeer(int id) |
void |
start()
Start zookeeper.
|
void |
startPeer(int id) |
void |
stop()
Stop zookeeper.
|
void |
stopPeer(int id) |
public final TemporaryPorts temporaryPorts
public void ensure(String path) throws Exception
ZooKeeperTestManagerensure in interface ZooKeeperTestManagerpath - The path to ensure.Exception - If an unexpected exception occurs.public void close()
ZooKeeperTestManagerclose in interface ZooKeeperTestManagerpublic 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()
ZooKeeperTestManagerstop in interface ZooKeeperTestManagerpublic void startPeer(int id)
public void stopPeer(int id)
public void resetPeer(int id)
public org.apache.curator.framework.CuratorFramework peerCurator(int id)
CuratorFramework client connected to only one of the peers.id - The curator ID.Copyright © 2015. All rights reserved.