Class MockCuratorFramework

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, org.apache.curator.framework.CuratorFramework

    public class MockCuratorFramework
    extends java.lang.Object
    implements org.apache.curator.framework.CuratorFramework
    A mock implementation ofCuratorFramework for testing purposes.
    Author:
    mpolden
    • Constructor Summary

      Constructors 
      Constructor Description
      MockCuratorFramework​(boolean stableOrdering, boolean shouldTimeoutOnEnter)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      java.util.Map<java.lang.String,​com.yahoo.vespa.curator.mock.MockCuratorFramework.MockAtomicCounter> atomicCounters()  
      void blockUntilConnected()  
      boolean blockUntilConnected​(int i, java.util.concurrent.TimeUnit timeUnit)  
      org.apache.curator.framework.api.ExistsBuilder checkExists()  
      void clearWatcherReferences​(org.apache.zookeeper.Watcher watcher)  
      void close()  
      org.apache.curator.framework.api.CreateBuilder create()  
      com.yahoo.vespa.curator.mock.MockCuratorFramework.MockAtomicCounter createAtomicCounter​(java.lang.String path)  
      Curator.CompletionWaiter createCompletionWaiter()  
      void createContainers​(java.lang.String s)  
      Curator.DirectoryCache createDirectoryCache​(java.lang.String path)  
      Curator.FileCache createFileCache​(java.lang.String path)  
      org.apache.curator.framework.recipes.locks.InterProcessLock createMutex​(java.lang.String path)  
      org.apache.curator.framework.api.DeleteBuilder delete()  
      com.yahoo.vespa.curator.mock.MemoryFileSystem fileSystem()  
      org.apache.curator.framework.api.GetACLBuilder getACL()  
      org.apache.curator.framework.api.GetChildrenBuilder getChildren()  
      org.apache.curator.framework.api.GetConfigBuilder getConfig()  
      org.apache.curator.framework.state.ConnectionStateErrorPolicy getConnectionStateErrorPolicy()  
      org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.state.ConnectionStateListener> getConnectionStateListenable()  
      org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.api.CuratorListener> getCuratorListenable()  
      org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()  
      org.apache.curator.framework.api.GetDataBuilder getData()  
      java.lang.String getNamespace()  
      org.apache.curator.framework.schema.SchemaSet getSchemaSet()  
      org.apache.curator.framework.imps.CuratorFrameworkState getState()  
      org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.api.UnhandledErrorListener> getUnhandledErrorListenable()  
      org.apache.curator.CuratorZookeeperClient getZookeeperClient()  
      org.apache.curator.framework.api.transaction.CuratorTransaction inTransaction()  
      boolean isStarted()
      Deprecated.
      org.apache.curator.utils.EnsurePath newNamespaceAwareEnsurePath​(java.lang.String path)
      Deprecated.
      org.apache.curator.framework.WatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework()  
      org.apache.curator.framework.CuratorFramework nonNamespaceView()
      Deprecated.
      java.util.concurrent.CompletableFuture<java.lang.Void> postSafeNotify​(java.lang.Object monitorHolder)  
      org.apache.curator.framework.api.ReconfigBuilder reconfig()  
      java.util.concurrent.CompletableFuture<java.lang.Void> runSafe​(java.lang.Runnable runnable)  
      org.apache.curator.framework.api.SetACLBuilder setACL()  
      org.apache.curator.framework.api.SetDataBuilder setData()  
      void start()  
      org.apache.curator.framework.api.SyncBuilder sync()  
      void sync​(java.lang.String path, java.lang.Object backgroundContextObject)
      Deprecated.
      org.apache.curator.framework.api.transaction.CuratorMultiTransaction transaction()  
      org.apache.curator.framework.api.transaction.TransactionOp transactionOp()  
      org.apache.curator.framework.CuratorFramework usingNamespace​(java.lang.String newNamespace)  
      static java.lang.String validatePath​(java.lang.String path)
      Validates a path using the same rules as ZooKeeper
      org.apache.curator.framework.api.WatchesBuilder watchers()  
      org.apache.curator.framework.api.RemoveWatchesBuilder watches()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MockCuratorFramework

        public MockCuratorFramework​(boolean stableOrdering,
                                    boolean shouldTimeoutOnEnter)
    • Method Detail

      • atomicCounters

        public java.util.Map<java.lang.String,​com.yahoo.vespa.curator.mock.MockCuratorFramework.MockAtomicCounter> atomicCounters()
      • fileSystem

        public com.yahoo.vespa.curator.mock.MemoryFileSystem fileSystem()
      • start

        public void start()
        Specified by:
        start in interface org.apache.curator.framework.CuratorFramework
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface org.apache.curator.framework.CuratorFramework
      • getState

        public org.apache.curator.framework.imps.CuratorFrameworkState getState()
        Specified by:
        getState in interface org.apache.curator.framework.CuratorFramework
      • isStarted

        @Deprecated
        public boolean isStarted()
        Deprecated.
        Specified by:
        isStarted in interface org.apache.curator.framework.CuratorFramework
      • create

        public org.apache.curator.framework.api.CreateBuilder create()
        Specified by:
        create in interface org.apache.curator.framework.CuratorFramework
      • delete

        public org.apache.curator.framework.api.DeleteBuilder delete()
        Specified by:
        delete in interface org.apache.curator.framework.CuratorFramework
      • checkExists

        public org.apache.curator.framework.api.ExistsBuilder checkExists()
        Specified by:
        checkExists in interface org.apache.curator.framework.CuratorFramework
      • getData

        public org.apache.curator.framework.api.GetDataBuilder getData()
        Specified by:
        getData in interface org.apache.curator.framework.CuratorFramework
      • setData

        public org.apache.curator.framework.api.SetDataBuilder setData()
        Specified by:
        setData in interface org.apache.curator.framework.CuratorFramework
      • getChildren

        public org.apache.curator.framework.api.GetChildrenBuilder getChildren()
        Specified by:
        getChildren in interface org.apache.curator.framework.CuratorFramework
      • getACL

        public org.apache.curator.framework.api.GetACLBuilder getACL()
        Specified by:
        getACL in interface org.apache.curator.framework.CuratorFramework
      • setACL

        public org.apache.curator.framework.api.SetACLBuilder setACL()
        Specified by:
        setACL in interface org.apache.curator.framework.CuratorFramework
      • reconfig

        public org.apache.curator.framework.api.ReconfigBuilder reconfig()
        Specified by:
        reconfig in interface org.apache.curator.framework.CuratorFramework
      • getConfig

        public org.apache.curator.framework.api.GetConfigBuilder getConfig()
        Specified by:
        getConfig in interface org.apache.curator.framework.CuratorFramework
      • inTransaction

        public org.apache.curator.framework.api.transaction.CuratorTransaction inTransaction()
        Specified by:
        inTransaction in interface org.apache.curator.framework.CuratorFramework
      • transaction

        public org.apache.curator.framework.api.transaction.CuratorMultiTransaction transaction()
        Specified by:
        transaction in interface org.apache.curator.framework.CuratorFramework
      • transactionOp

        public org.apache.curator.framework.api.transaction.TransactionOp transactionOp()
        Specified by:
        transactionOp in interface org.apache.curator.framework.CuratorFramework
      • watches

        public org.apache.curator.framework.api.RemoveWatchesBuilder watches()
        Specified by:
        watches in interface org.apache.curator.framework.CuratorFramework
      • watchers

        public org.apache.curator.framework.api.WatchesBuilder watchers()
        Specified by:
        watchers in interface org.apache.curator.framework.CuratorFramework
      • newWatcherRemoveCuratorFramework

        public org.apache.curator.framework.WatcherRemoveCuratorFramework newWatcherRemoveCuratorFramework()
        Specified by:
        newWatcherRemoveCuratorFramework in interface org.apache.curator.framework.CuratorFramework
      • getConnectionStateErrorPolicy

        public org.apache.curator.framework.state.ConnectionStateErrorPolicy getConnectionStateErrorPolicy()
        Specified by:
        getConnectionStateErrorPolicy in interface org.apache.curator.framework.CuratorFramework
      • getCurrentConfig

        public org.apache.zookeeper.server.quorum.flexible.QuorumVerifier getCurrentConfig()
        Specified by:
        getCurrentConfig in interface org.apache.curator.framework.CuratorFramework
      • getSchemaSet

        public org.apache.curator.framework.schema.SchemaSet getSchemaSet()
        Specified by:
        getSchemaSet in interface org.apache.curator.framework.CuratorFramework
      • postSafeNotify

        public java.util.concurrent.CompletableFuture<java.lang.Void> postSafeNotify​(java.lang.Object monitorHolder)
        Specified by:
        postSafeNotify in interface org.apache.curator.framework.CuratorFramework
      • runSafe

        public java.util.concurrent.CompletableFuture<java.lang.Void> runSafe​(java.lang.Runnable runnable)
        Specified by:
        runSafe in interface org.apache.curator.framework.CuratorFramework
      • sync

        @Deprecated
        public void sync​(java.lang.String path,
                         java.lang.Object backgroundContextObject)
        Deprecated.
        Specified by:
        sync in interface org.apache.curator.framework.CuratorFramework
      • createContainers

        public void createContainers​(java.lang.String s)
        Specified by:
        createContainers in interface org.apache.curator.framework.CuratorFramework
      • getConnectionStateListenable

        public org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.state.ConnectionStateListener> getConnectionStateListenable()
        Specified by:
        getConnectionStateListenable in interface org.apache.curator.framework.CuratorFramework
      • getCuratorListenable

        public org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.api.CuratorListener> getCuratorListenable()
        Specified by:
        getCuratorListenable in interface org.apache.curator.framework.CuratorFramework
      • getUnhandledErrorListenable

        public org.apache.curator.framework.listen.Listenable<org.apache.curator.framework.api.UnhandledErrorListener> getUnhandledErrorListenable()
        Specified by:
        getUnhandledErrorListenable in interface org.apache.curator.framework.CuratorFramework
      • nonNamespaceView

        @Deprecated
        public org.apache.curator.framework.CuratorFramework nonNamespaceView()
        Deprecated.
        Specified by:
        nonNamespaceView in interface org.apache.curator.framework.CuratorFramework
      • usingNamespace

        public org.apache.curator.framework.CuratorFramework usingNamespace​(java.lang.String newNamespace)
        Specified by:
        usingNamespace in interface org.apache.curator.framework.CuratorFramework
      • getNamespace

        public java.lang.String getNamespace()
        Specified by:
        getNamespace in interface org.apache.curator.framework.CuratorFramework
      • getZookeeperClient

        public org.apache.curator.CuratorZookeeperClient getZookeeperClient()
        Specified by:
        getZookeeperClient in interface org.apache.curator.framework.CuratorFramework
      • newNamespaceAwareEnsurePath

        @Deprecated
        public org.apache.curator.utils.EnsurePath newNamespaceAwareEnsurePath​(java.lang.String path)
        Deprecated.
        Specified by:
        newNamespaceAwareEnsurePath in interface org.apache.curator.framework.CuratorFramework
      • clearWatcherReferences

        public void clearWatcherReferences​(org.apache.zookeeper.Watcher watcher)
        Specified by:
        clearWatcherReferences in interface org.apache.curator.framework.CuratorFramework
      • blockUntilConnected

        public boolean blockUntilConnected​(int i,
                                           java.util.concurrent.TimeUnit timeUnit)
        Specified by:
        blockUntilConnected in interface org.apache.curator.framework.CuratorFramework
      • blockUntilConnected

        public void blockUntilConnected()
        Specified by:
        blockUntilConnected in interface org.apache.curator.framework.CuratorFramework
      • sync

        public org.apache.curator.framework.api.SyncBuilder sync()
        Specified by:
        sync in interface org.apache.curator.framework.CuratorFramework
      • createMutex

        public org.apache.curator.framework.recipes.locks.InterProcessLock createMutex​(java.lang.String path)
      • createAtomicCounter

        public com.yahoo.vespa.curator.mock.MockCuratorFramework.MockAtomicCounter createAtomicCounter​(java.lang.String path)
      • createFileCache

        public Curator.FileCache createFileCache​(java.lang.String path)
      • validatePath

        public static java.lang.String validatePath​(java.lang.String path)
                                             throws java.lang.IllegalArgumentException
        Validates a path using the same rules as ZooKeeper
        Throws:
        java.lang.IllegalArgumentException