Bug 4651: Implement handling of ClusteredDOMDataTreeChangeListener in CDS
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / ShardTestKit.java
index 281a190e941998c68a597da2ac6d511abc3f9e90..ae607b9b3da214094d44833de1aea900ecb36d69 100644 (file)
@@ -46,14 +46,14 @@ public class ShardTestKit extends JavaTestKit {
 
     }
 
-    public void waitUntilLeader(ActorRef shard) {
+    public String waitUntilLeader(ActorRef shard) {
         FiniteDuration duration = Duration.create(100, TimeUnit.MILLISECONDS);
         for(int i = 0; i < 20 * 5; i++) {
             Future<Object> future = Patterns.ask(shard, new FindLeader(), new Timeout(duration));
             try {
                 FindLeaderReply resp = (FindLeaderReply)Await.result(future, duration);
                 if(resp.getLeaderActor() != null) {
-                    return;
+                    return resp.getLeaderActor();
                 }
             } catch(TimeoutException e) {
             } catch(Exception e) {
@@ -66,6 +66,7 @@ public class ShardTestKit extends JavaTestKit {
         }
 
         Assert.fail("Leader not found for shard " + shard.path());
+        return null;
     }
 
     public void waitUntilNoLeader(ActorRef shard) {