kaisun2000 commented on a change in pull request #1332:
URL: https://github.com/apache/helix/pull/1332#discussion_r480388496



##########
File path: 
zookeeper-api/src/test/java/org/apache/helix/zookeeper/zkclient/TestPrefetchChangedData.java
##########
@@ -0,0 +1,109 @@
+package org.apache.helix.zookeeper.zkclient;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.helix.zookeeper.impl.TestHelper;
+import org.apache.helix.zookeeper.impl.ZkTestBase;
+import org.apache.helix.zookeeper.impl.client.ZkClient;
+import org.apache.helix.zookeeper.zkclient.annotation.PreFetchChangedData;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class TestPrefetchChangedData extends ZkTestBase {
+  @Test
+  public void testPrefetchChangedDataEnabled() throws InterruptedException {
+    String path = "/" + TestHelper.getTestMethodName();
+    ZkClient zkClient = new ZkClient(ZkTestBase.ZK_ADDR);
+
+    try {
+      zkClient.createPersistent(path, "v1");
+
+      CountDownLatch countDownLatch = new CountDownLatch(1);
+      PreFetchZkDataListener dataListener = new 
PreFetchZkDataListener(countDownLatch);
+      zkClient.subscribeDataChanges(path, dataListener);
+      zkClient.writeData(path, "v2");
+
+      Assert.assertTrue(countDownLatch.await(3L, TimeUnit.SECONDS));

Review comment:
       Cool. Due to recent fixing unstable test, this is getting to be a habit 
to look for unstableness.
   
   Let us define a constant of this waiting for both test cases. Otherwise, 
looks good to me.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to