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

ZOOKEEPER-2245: SimpleSysTest test cases fails
(Arshad Mohammad via rgs)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1697227 13f79535-47bb-0310-9956-ffa450edef68

Raúl Gutiérrez Segalés 10 роки тому
батько
коміт
1c715735d4

+ 3 - 0
CHANGES.txt

@@ -154,6 +154,9 @@ BUGFIXES:
   ZOOKEEPER-2239: JMX State from LocalPeerBean incorrect
   (Kevin Lee via rgs)
 
+  ZOOKEEPER-2245: SimpleSysTest test cases fails
+  (Arshad Mohammad via rgs)
+
 IMPROVEMENTS:
   ZOOKEEPER-1660 Documentation for Dynamic Reconfiguration (Reed Wanderman-Milne via shralex)  
 

+ 11 - 2
src/java/systest/org/apache/zookeeper/test/system/BaseSysTest.java

@@ -61,7 +61,9 @@ public class BaseSysTest {
     }
     @After
     public void tearDown() throws Exception {
-        im.close();
+        if (null != im) {
+            im.close();
+        }
     }
 
     int serverCount = defaultServerCount;
@@ -148,10 +150,17 @@ public class BaseSysTest {
         qps = new QuorumPeer[count];
         qpsDirs = new File[count];
         for(int i = 1; i <= count; i++) {
-            peers.put(Long.valueOf(i), new QuorumServer(i, new InetSocketAddress("127.0.0.1", fakeBasePort + i)));
+            InetSocketAddress peerAddress = new InetSocketAddress("127.0.0.1",
+                    fakeBasePort + i);
+            InetSocketAddress electionAddr = new InetSocketAddress("127.0.0.1",
+                    serverCount + fakeBasePort + i);
+            peers.put(Long.valueOf(i), new QuorumServer(i, peerAddress,
+                    electionAddr));
         }
         StringBuilder sb = new StringBuilder();
         for(int i = 0; i < count; i++) {
+            //make that testData exists otherwise it fails on windows
+            testData.mkdirs();
             qpsDirs[i] = File.createTempFile("sysTest", ".tmp", testData);
             qpsDirs[i].delete();
             qpsDirs[i].mkdir();

+ 3 - 1
src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java

@@ -51,7 +51,9 @@ public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallba
         try {
             zk = new ZooKeeper(hostPort, 15000, this);
             zk.getData("/simpleCase", true, this, null);
-            r.report("Client " + index + " connecting to " + hostPort); 
+            if (null != r) {
+                r.report("Client " + index + " connecting to " + hostPort);
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }