Class MockZooKeeper

  • All Implemented Interfaces:
    AutoCloseable

    public class MockZooKeeper
    extends org.apache.zookeeper.ZooKeeper
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  MockZooKeeper.Op  
      • 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 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
      • getEphemeralOwner

        protected long getEphemeralOwner()
      • overrideEpheralOwner

        public void overrideEpheralOwner​(long epheralOwner)
      • removeEpheralOwnerOverride

        public void removeEpheralOwnerOverride()
      • 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)
        Overrides:
        addWatch in class org.apache.zookeeper.ZooKeeper
      • 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
      • 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