- Added TestCluster#getInstances(Class) method.

This commit is contained in:
Martijn van Groningen 2013-09-20 15:08:49 +02:00
parent f6c2d9caf3
commit 846b833539
1 changed files with 9 additions and 1 deletions

View File

@ -475,6 +475,14 @@ public class TestCluster implements Closeable, Iterable<Client> {
return getInstance(ClusterService.class);
}
public synchronized <T> Iterable<T> getInstances(Class<T> clazz) {
List<T> instances = new ArrayList<T>(nodes.size());
for (NodeAndClient nodeAndClient : nodes.values()) {
instances.add(getInstanceFromNode(clazz, nodeAndClient.node));
}
return instances;
}
public synchronized <T> T getInstance(Class<T> clazz, final String node) {
final Predicate<TestCluster.NodeAndClient> predicate;
if (node != null) {