|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.curator.test.TestingCluster
public class TestingCluster
manages an internally running ensemble of ZooKeeper servers. FOR TESTING PURPOSES ONLY
| Constructor Summary | |
|---|---|
TestingCluster(Collection<InstanceSpec> specs)
Creates an ensemble using the given server specs |
|
TestingCluster(InstanceSpec... specs)
Creates an ensemble using the given server specs |
|
TestingCluster(int instanceQty)
Creates an ensemble comprised of n servers. |
|
TestingCluster(Map<InstanceSpec,Collection<InstanceSpec>> specs)
Creates an ensemble using the given server specs |
|
| Method Summary | |
|---|---|
void |
close()
Shutdown the ensemble, free resources, etc. |
InstanceSpec |
findConnectionInstance(org.apache.zookeeper.ZooKeeper client)
Given a ZooKeeper instance, returns which server it is connected to |
String |
getConnectString()
Returns the connection string to pass to the ZooKeeper constructor |
Collection<InstanceSpec> |
getInstances()
Returns the set of servers in the ensemble |
List<TestingZooKeeperServer> |
getServers()
|
boolean |
killServer(InstanceSpec instance)
Kills the given server. |
boolean |
restartServer(InstanceSpec instance)
Restart the given server of the cluster |
void |
start()
Start the ensemble. |
void |
stop()
Shutdown the ensemble WITHOUT freeing resources, etc. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TestingCluster(int instanceQty)
n servers. Each server will use
a temp directory and random ports
instanceQty - number of servers to create in the ensemblepublic TestingCluster(InstanceSpec... specs)
specs - the server specspublic TestingCluster(Collection<InstanceSpec> specs)
specs - the server specspublic TestingCluster(Map<InstanceSpec,Collection<InstanceSpec>> specs)
specs - map of an instance spec to its set of quorum instances. Allows simulation of an ensemble with instances
having different config peers| Method Detail |
|---|
public Collection<InstanceSpec> getInstances()
public List<TestingZooKeeperServer> getServers()
public String getConnectString()
public void start()
throws Exception
Exception - errors
public void stop()
throws IOException
IOException
public void close()
throws IOException
finally block.
close in interface CloseableIOException - errors
public boolean killServer(InstanceSpec instance)
throws Exception
instance - server to kill
Exception - errors
public boolean restartServer(InstanceSpec instance)
throws Exception
instance - server instance
Exception - errors
public InstanceSpec findConnectionInstance(org.apache.zookeeper.ZooKeeper client)
throws Exception
client - ZK instance
Exception - errors
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||