athanatos commented on a change in pull request #787: ZOOKEEPER-3253: client 
should not send requests with cxid=-4, -2, or -1
URL: https://github.com/apache/zookeeper/pull/787#discussion_r251152973
 
 

 ##########
 File path: 
zookeeper-server/src/test/java/org/apache/zookeeper/TestableZooKeeper.java
 ##########
 @@ -35,6 +36,39 @@ public TestableZooKeeper(String host, int sessionTimeout,
             Watcher watcher) throws IOException {
         super(host, sessionTimeout, watcher);
     }
+
+    class TestableClientCnxn extends ClientCnxn {
+        TestableClientCnxn(String chrootPath, HostProvider hostProvider, int 
sessionTimeout, ZooKeeper zooKeeper,
+            ClientWatchManager watcher, ClientCnxnSocket clientCnxnSocket, 
boolean canBeReadOnly)
+                throws IOException {
+            super(chrootPath, hostProvider, sessionTimeout, zooKeeper, watcher,
+                clientCnxnSocket, 0, new byte[16], canBeReadOnly);
+        }
+
+        void setXid(int newXid) {
+            xid = newXid;
+        }
+
+        int checkXid() {
+            return xid;
+        }
+    }
+
+    protected ClientCnxn createConnection(String chrootPath,
 
 Review comment:
   I figured that the xid manipulation methods might be generally useful.  
Also, createClient test helper method explicitly creates a TestableZooKeeper, 
so I'd have to create another version of that, I think.  Doesn't seem 
worthwhile.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to