You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2012/09/03 12:44:47 UTC

svn commit: r1380194 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java

Author: siren
Date: Mon Sep  3 10:44:46 2012
New Revision: 1380194

URL: http://svn.apache.org/viewvc?rev=1380194&view=rev
Log:
fix test so that it does not miss the 2nd event

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java?rev=1380194&r1=1380193&r2=1380194&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/ZkSolrClientTest.java Mon Sep  3 10:44:46 2012
@@ -18,6 +18,8 @@ package org.apache.solr.cloud;
  */
 
 import java.io.File;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import junit.framework.Assert;
@@ -172,6 +174,7 @@ public class ZkSolrClientTest extends Ab
     AbstractZkTestCase.makeSolrZkNode(server.getZkHost());
     final SolrZkClient zkClient = new SolrZkClient(server.getZkAddress(), AbstractZkTestCase.TIMEOUT);
     try {
+      final CountDownLatch latch = new CountDownLatch(1);
       zkClient.makePath("/collections", true);
 
       zkClient.getChildren("/collections", new Watcher() {
@@ -184,6 +187,7 @@ public class ZkSolrClientTest extends Ab
           // remake watch
           try {
             zkClient.getChildren("/collections", this, true);
+            latch.countDown();
           } catch (KeeperException e) {
             throw new RuntimeException(e);
           } catch (InterruptedException e) {
@@ -193,6 +197,7 @@ public class ZkSolrClientTest extends Ab
       }, true);
 
       zkClient.makePath("/collections/collection99/shards", true);
+      latch.await(); //wait until watch has been re-created
 
       zkClient.makePath("collections/collection99/config=collection1", true);