Class MockZooKeeperSession

  • All Implemented Interfaces:
    AutoCloseable

    public class MockZooKeeperSession
    extends org.apache.zookeeper.ZooKeeper
    mock zookeeper with different session based on MockZooKeeper
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.apache.zookeeper.ZooKeeper

        org.apache.zookeeper.ZooKeeper.States, org.apache.zookeeper.ZooKeeper.WatchRegistration
    • Field Summary

      • Fields inherited from class org.apache.zookeeper.ZooKeeper

        cnxn, hostProvider, SECURE_CLIENT, watchManager, ZOOKEEPER_CLIENT_CNXN_SOCKET
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addWatch​(String basePath, org.apache.zookeeper.AddWatchMode mode)  
      void addWatch​(String basePath, org.apache.zookeeper.AddWatchMode mode, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx)  
      void addWatch​(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode)  
      void addWatch​(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx)  
      void close()  
      String create​(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode)  
      void create​(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.AsyncCallback.StringCallback cb, Object ctx)  
      void delete​(String path, int version)  
      void delete​(String path, int version, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx)  
      org.apache.zookeeper.data.Stat exists​(String path, boolean watch)  
      void exists​(String path, boolean watch, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx)  
      org.apache.zookeeper.data.Stat exists​(String path, org.apache.zookeeper.Watcher watcher)  
      void exists​(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx)  
      void failConditional​(org.apache.zookeeper.KeeperException.Code rc, BiPredicate<MockZooKeeper.Op,​String> predicate)  
      List<String> getChildren​(String path, boolean watch)  
      void getChildren​(String path, boolean watcher, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object ctx)  
      List<String> getChildren​(String path, org.apache.zookeeper.Watcher watcher)  
      void getChildren​(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object ctx)  
      void getData​(String path, boolean watch, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object ctx)  
      void getData​(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object ctx)  
      byte[] getData​(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.data.Stat stat)  
      long getSessionId()  
      int getSessionTimeout()  
      org.apache.zookeeper.ZooKeeper.States getState()  
      List<org.apache.zookeeper.OpResult> multi​(Iterable<org.apache.zookeeper.Op> ops)  
      void multi​(Iterable<org.apache.zookeeper.Op> ops, org.apache.zookeeper.AsyncCallback.MultiCallback cb, Object ctx)  
      static MockZooKeeperSession newInstance​(MockZooKeeper mockZooKeeper)  
      void register​(org.apache.zookeeper.Watcher watcher)  
      void setAlwaysFail​(org.apache.zookeeper.KeeperException.Code rc)  
      org.apache.zookeeper.data.Stat setData​(String path, byte[] data, int version)  
      void setData​(String path, byte[] data, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx)  
      void setSessionId​(long id)  
      void shutdown()  
      void sync​(String path, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx)  
      String toString()  
      void unsetAlwaysFail()  
      • Methods inherited from class org.apache.zookeeper.ZooKeeper

        addAuthInfo, close, create, create, create, create, createConnection, defaultWatchManager, getACL, getACL, getAllChildrenNumber, getAllChildrenNumber, getChildren, getChildren, getChildren, getChildren, getChildWatches, getClientConfig, getConfig, getConfig, getConfig, getConfig, getData, getDataWatches, getEphemerals, getEphemerals, getEphemerals, getEphemerals, getExistWatches, getPersistentRecursiveWatches, getPersistentWatches, getSaslClient, getSessionPasswd, getTestable, multiInternal, multiInternal, removeAllWatches, removeAllWatches, removeWatches, removeWatches, setACL, setACL, testableLocalSocketAddress, testableRemoteSocketAddress, testableWaitForShutdown, transaction, updateServerList
    • Method Detail

      • getSessionTimeout

        public int getSessionTimeout()
        Overrides:
        getSessionTimeout in class org.apache.zookeeper.ZooKeeper
      • getState

        public org.apache.zookeeper.ZooKeeper.States getState()
        Overrides:
        getState in class org.apache.zookeeper.ZooKeeper
      • register

        public void register​(org.apache.zookeeper.Watcher watcher)
        Overrides:
        register in class org.apache.zookeeper.ZooKeeper
      • create

        public String create​(String path,
                             byte[] data,
                             List<org.apache.zookeeper.data.ACL> acl,
                             org.apache.zookeeper.CreateMode createMode)
                      throws org.apache.zookeeper.KeeperException,
                             InterruptedException
        Overrides:
        create in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • create

        public void create​(String path,
                           byte[] data,
                           List<org.apache.zookeeper.data.ACL> acl,
                           org.apache.zookeeper.CreateMode createMode,
                           org.apache.zookeeper.AsyncCallback.StringCallback cb,
                           Object ctx)
        Overrides:
        create in class org.apache.zookeeper.ZooKeeper
      • getData

        public byte[] getData​(String path,
                              org.apache.zookeeper.Watcher watcher,
                              org.apache.zookeeper.data.Stat stat)
                       throws org.apache.zookeeper.KeeperException
        Overrides:
        getData in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
      • getData

        public void getData​(String path,
                            boolean watch,
                            org.apache.zookeeper.AsyncCallback.DataCallback cb,
                            Object ctx)
        Overrides:
        getData in class org.apache.zookeeper.ZooKeeper
      • getData

        public void getData​(String path,
                            org.apache.zookeeper.Watcher watcher,
                            org.apache.zookeeper.AsyncCallback.DataCallback cb,
                            Object ctx)
        Overrides:
        getData in class org.apache.zookeeper.ZooKeeper
      • getChildren

        public void getChildren​(String path,
                                org.apache.zookeeper.Watcher watcher,
                                org.apache.zookeeper.AsyncCallback.ChildrenCallback cb,
                                Object ctx)
        Overrides:
        getChildren in class org.apache.zookeeper.ZooKeeper
      • getChildren

        public List<String> getChildren​(String path,
                                        org.apache.zookeeper.Watcher watcher)
                                 throws org.apache.zookeeper.KeeperException
        Overrides:
        getChildren in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
      • getChildren

        public void getChildren​(String path,
                                boolean watcher,
                                org.apache.zookeeper.AsyncCallback.Children2Callback cb,
                                Object ctx)
        Overrides:
        getChildren in class org.apache.zookeeper.ZooKeeper
      • exists

        public org.apache.zookeeper.data.Stat exists​(String path,
                                                     boolean watch)
                                              throws org.apache.zookeeper.KeeperException,
                                                     InterruptedException
        Overrides:
        exists in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • exists

        public org.apache.zookeeper.data.Stat exists​(String path,
                                                     org.apache.zookeeper.Watcher watcher)
                                              throws org.apache.zookeeper.KeeperException,
                                                     InterruptedException
        Overrides:
        exists in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • exists

        public void exists​(String path,
                           boolean watch,
                           org.apache.zookeeper.AsyncCallback.StatCallback cb,
                           Object ctx)
        Overrides:
        exists in class org.apache.zookeeper.ZooKeeper
      • exists

        public void exists​(String path,
                           org.apache.zookeeper.Watcher watcher,
                           org.apache.zookeeper.AsyncCallback.StatCallback cb,
                           Object ctx)
        Overrides:
        exists in class org.apache.zookeeper.ZooKeeper
      • sync

        public void sync​(String path,
                         org.apache.zookeeper.AsyncCallback.VoidCallback cb,
                         Object ctx)
        Overrides:
        sync in class org.apache.zookeeper.ZooKeeper
      • setData

        public org.apache.zookeeper.data.Stat setData​(String path,
                                                      byte[] data,
                                                      int version)
                                               throws org.apache.zookeeper.KeeperException,
                                                      InterruptedException
        Overrides:
        setData in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • setData

        public void setData​(String path,
                            byte[] data,
                            int version,
                            org.apache.zookeeper.AsyncCallback.StatCallback cb,
                            Object ctx)
        Overrides:
        setData in class org.apache.zookeeper.ZooKeeper
      • delete

        public void delete​(String path,
                           int version)
                    throws InterruptedException,
                           org.apache.zookeeper.KeeperException
        Overrides:
        delete in class org.apache.zookeeper.ZooKeeper
        Throws:
        InterruptedException
        org.apache.zookeeper.KeeperException
      • delete

        public void delete​(String path,
                           int version,
                           org.apache.zookeeper.AsyncCallback.VoidCallback cb,
                           Object ctx)
        Overrides:
        delete in class org.apache.zookeeper.ZooKeeper
      • multi

        public void multi​(Iterable<org.apache.zookeeper.Op> ops,
                          org.apache.zookeeper.AsyncCallback.MultiCallback cb,
                          Object ctx)
        Overrides:
        multi in class org.apache.zookeeper.ZooKeeper
      • multi

        public List<org.apache.zookeeper.OpResult> multi​(Iterable<org.apache.zookeeper.Op> ops)
                                                  throws InterruptedException,
                                                         org.apache.zookeeper.KeeperException
        Overrides:
        multi in class org.apache.zookeeper.ZooKeeper
        Throws:
        InterruptedException
        org.apache.zookeeper.KeeperException
      • addWatch

        public void addWatch​(String basePath,
                             org.apache.zookeeper.Watcher watcher,
                             org.apache.zookeeper.AddWatchMode mode,
                             org.apache.zookeeper.AsyncCallback.VoidCallback cb,
                             Object ctx)
        Overrides:
        addWatch in class org.apache.zookeeper.ZooKeeper
      • addWatch

        public void addWatch​(String basePath,
                             org.apache.zookeeper.Watcher watcher,
                             org.apache.zookeeper.AddWatchMode mode)
                      throws org.apache.zookeeper.KeeperException,
                             InterruptedException
        Overrides:
        addWatch in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • addWatch

        public void addWatch​(String basePath,
                             org.apache.zookeeper.AddWatchMode mode)
                      throws org.apache.zookeeper.KeeperException,
                             InterruptedException
        Overrides:
        addWatch in class org.apache.zookeeper.ZooKeeper
        Throws:
        org.apache.zookeeper.KeeperException
        InterruptedException
      • addWatch

        public void addWatch​(String basePath,
                             org.apache.zookeeper.AddWatchMode mode,
                             org.apache.zookeeper.AsyncCallback.VoidCallback cb,
                             Object ctx)
        Overrides:
        addWatch in class org.apache.zookeeper.ZooKeeper
      • setAlwaysFail

        public void setAlwaysFail​(org.apache.zookeeper.KeeperException.Code rc)
      • unsetAlwaysFail

        public void unsetAlwaysFail()
      • setSessionId

        public void setSessionId​(long id)
      • getSessionId

        public long getSessionId()
        Overrides:
        getSessionId in class org.apache.zookeeper.ZooKeeper
      • toString

        public String toString()
        Overrides:
        toString in class org.apache.zookeeper.ZooKeeper