Package org.apache.zookeeper
Class MockZooKeeper
java.lang.Object
org.apache.zookeeper.ZooKeeper
org.apache.zookeeper.MockZooKeeper
- All Implemented Interfaces:
AutoCloseable
public class MockZooKeeper
extends org.apache.zookeeper.ZooKeeper
-
Nested Class Summary
Nested ClassesNested 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
Modifier and TypeMethodDescriptionvoidaddWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode) voidaddWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx) voidclose()create(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode) voidcreate(String path, byte[] data, List<org.apache.zookeeper.data.ACL> acl, org.apache.zookeeper.CreateMode createMode, org.apache.zookeeper.AsyncCallback.StringCallback cb, Object ctx) voidvoidorg.apache.zookeeper.data.Statvoidorg.apache.zookeeper.data.Statvoidexists(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx) voidfailConditional(org.apache.zookeeper.KeeperException.Code rc, BiPredicate<MockZooKeeper.Op, String> predicate) getChildren(String path, boolean watch) voidgetChildren(String path, boolean watcher, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object ctx) getChildren(String path, org.apache.zookeeper.Watcher watcher) voidgetChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object ctx) voidvoidgetData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object ctx) byte[]protected longlongintorg.apache.zookeeper.ZooKeeper.StatesgetState()List<org.apache.zookeeper.OpResult>voidmulti(Iterable<org.apache.zookeeper.Op> ops, org.apache.zookeeper.AsyncCallback.MultiCallback cb, Object ctx) static MockZooKeeperstatic MockZooKeepernewInstance(ExecutorService executor) static MockZooKeepernewInstance(ExecutorService executor, int readOpDelayMs) static MockZooKeepernewInstanceForGlobalZK(ExecutorService executor) static MockZooKeepernewInstanceForGlobalZK(ExecutorService executor, int readOpDelayMs) voidoverrideEpheralOwner(long epheralOwner) voidregister(org.apache.zookeeper.Watcher watcher) voidvoidsetAlwaysFail(org.apache.zookeeper.KeeperException.Code rc) org.apache.zookeeper.data.StatvoidsetData(String path, byte[] data, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx) voidsetSessionId(long id) voidshutdown()voidtoString()voidMethods inherited from class org.apache.zookeeper.ZooKeeper
addAuthInfo, addWatch, addWatch, 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 Details
-
newInstance
-
newInstance
-
newInstanceForGlobalZK
-
newInstanceForGlobalZK
-
newInstance
-
getSessionTimeout
public int getSessionTimeout()- Overrides:
getSessionTimeoutin classorg.apache.zookeeper.ZooKeeper
-
getState
public org.apache.zookeeper.ZooKeeper.States getState()- Overrides:
getStatein classorg.apache.zookeeper.ZooKeeper
-
register
public void register(org.apache.zookeeper.Watcher watcher) - Overrides:
registerin classorg.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:
createin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
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:
createin classorg.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:
getDatain classorg.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:
getDatain classorg.apache.zookeeper.ZooKeeper
-
getData
public void getData(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.DataCallback cb, Object ctx) - Overrides:
getDatain classorg.apache.zookeeper.ZooKeeper
-
getChildren
public void getChildren(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.ChildrenCallback cb, Object ctx) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-
getChildren
public List<String> getChildren(String path, org.apache.zookeeper.Watcher watcher) throws org.apache.zookeeper.KeeperException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperException
-
getChildren
public List<String> getChildren(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
getChildren
public void getChildren(String path, boolean watcher, org.apache.zookeeper.AsyncCallback.Children2Callback cb, Object ctx) - Overrides:
getChildrenin classorg.apache.zookeeper.ZooKeeper
-
exists
public org.apache.zookeeper.data.Stat exists(String path, boolean watch) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
exists
public org.apache.zookeeper.data.Stat exists(String path, org.apache.zookeeper.Watcher watcher) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
exists
public void exists(String path, boolean watch, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx) - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper
-
exists
public void exists(String path, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx) - Overrides:
existsin classorg.apache.zookeeper.ZooKeeper
-
sync
- Overrides:
syncin classorg.apache.zookeeper.ZooKeeper
-
setData
public org.apache.zookeeper.data.Stat setData(String path, byte[] data, int version) throws org.apache.zookeeper.KeeperException, InterruptedException - Overrides:
setDatain classorg.apache.zookeeper.ZooKeeper- Throws:
org.apache.zookeeper.KeeperExceptionInterruptedException
-
setData
public void setData(String path, byte[] data, int version, org.apache.zookeeper.AsyncCallback.StatCallback cb, Object ctx) - Overrides:
setDatain classorg.apache.zookeeper.ZooKeeper
-
delete
public void delete(String path, int version) throws InterruptedException, org.apache.zookeeper.KeeperException - Overrides:
deletein classorg.apache.zookeeper.ZooKeeper- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperException
-
delete
public void delete(String path, int version, org.apache.zookeeper.AsyncCallback.VoidCallback cb, Object ctx) - Overrides:
deletein classorg.apache.zookeeper.ZooKeeper
-
multi
public void multi(Iterable<org.apache.zookeeper.Op> ops, org.apache.zookeeper.AsyncCallback.MultiCallback cb, Object ctx) - Overrides:
multiin classorg.apache.zookeeper.ZooKeeper
-
multi
public List<org.apache.zookeeper.OpResult> multi(Iterable<org.apache.zookeeper.Op> ops) throws InterruptedException, org.apache.zookeeper.KeeperException - Overrides:
multiin classorg.apache.zookeeper.ZooKeeper- Throws:
InterruptedExceptionorg.apache.zookeeper.KeeperException
-
addWatch
public void addWatch(String basePath, org.apache.zookeeper.Watcher watcher, org.apache.zookeeper.AddWatchMode mode) - Overrides:
addWatchin classorg.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:
addWatchin classorg.apache.zookeeper.ZooKeeper
-
close
- Specified by:
closein interfaceAutoCloseable- Overrides:
closein classorg.apache.zookeeper.ZooKeeper- Throws:
InterruptedException
-
shutdown
- Throws:
InterruptedException
-
failConditional
public void failConditional(org.apache.zookeeper.KeeperException.Code rc, BiPredicate<MockZooKeeper.Op, String> predicate) -
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:
getSessionIdin classorg.apache.zookeeper.ZooKeeper
-
toString
- Overrides:
toStringin classorg.apache.zookeeper.ZooKeeper
-