fix test so that it does not miss the 2nd event

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1380194 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sami Siren 2012-09-03 10:44:46 +00:00
parent 362d518c19
commit fe0340cf60
1 changed files with 5 additions and 0 deletions

View File

@ -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 AbstractSolrTestCase {
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 AbstractSolrTestCase {
// 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 AbstractSolrTestCase {
}, true);
zkClient.makePath("/collections/collection99/shards", true);
latch.await(); //wait until watch has been re-created
zkClient.makePath("collections/collection99/config=collection1", true);