Переглянути джерело

ZOOKEEPER-1648. Fix WatcherTest in JDK7 (Thawan Kooburat via phunt)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1447613 13f79535-47bb-0310-9956-ffa450edef68
Patrick D. Hunt 12 роки тому
батько
коміт
39783d6c86

+ 3 - 0
CHANGES.txt

@@ -328,6 +328,9 @@ BUGFIXES:
   ZOOKEEPER-1641. Using slope=positive results in a jagged ganglia
   graph of packets rcvd/sent (Ben Hartshorne via phunt)
 
+  ZOOKEEPER-1648. Fix WatcherTest in JDK7
+  (Thawan Kooburat via phunt)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports,

+ 9 - 0
src/java/test/org/apache/zookeeper/test/WatcherTest.java

@@ -38,6 +38,7 @@ import org.apache.zookeeper.Watcher.Event.EventType;
 import org.apache.zookeeper.ZooDefs.Ids;
 import org.apache.zookeeper.data.Stat;
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 
 public class WatcherTest extends ClientBase {
@@ -67,6 +68,14 @@ public class WatcherTest extends ClientBase {
         }
     }
 
+    @Before
+    public void setUp() throws Exception {
+        super.setUp();
+        // Reset to default value since some test cases set this to true.
+        // Needed for JDK7 since unit test can run is random order
+        ClientCnxn.setDisableAutoResetWatch(false);
+    }
+
     /**
      * Verify that we get all of the events we expect to get. This particular
      * case verifies that we see all of the data events on a particular node.