public class PulsarMockBookKeeper
extends org.apache.bookkeeper.client.BookKeeper
This mocked client is meant to be used in unit tests for applications using the BookKeeper API.
| Constructor and Description |
|---|
PulsarMockBookKeeper(org.apache.zookeeper.ZooKeeper zkc,
ExecutorService executor) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEntryDelay(long delay,
TimeUnit unit) |
void |
asyncCreateLedger(int ensSize,
int qSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb,
Object ctx) |
void |
asyncCreateLedger(int ensSize,
int writeQuorumSize,
int ackQuorumSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb,
Object ctx,
Map<String,byte[]> properties) |
void |
asyncDeleteLedger(long lId,
org.apache.bookkeeper.client.AsyncCallback.DeleteCallback cb,
Object ctx) |
void |
asyncOpenLedger(long lId,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.OpenCallback cb,
Object ctx) |
void |
asyncOpenLedgerNoRecovery(long lId,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.OpenCallback cb,
Object ctx) |
void |
close() |
org.apache.bookkeeper.client.LedgerHandle |
createLedger(org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd) |
org.apache.bookkeeper.client.LedgerHandle |
createLedger(int ensSize,
int qSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd) |
org.apache.bookkeeper.client.LedgerHandle |
createLedger(int ensSize,
int writeQuorumSize,
int ackQuorumSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd) |
void |
deleteLedger(long lId) |
void |
failAfter(int steps,
int rc) |
void |
failNow(int rc) |
org.apache.bookkeeper.conf.ClientConfiguration |
getConf() |
Map<Long,PulsarMockLedgerHandle> |
getLedgerMap() |
Set<Long> |
getLedgers() |
org.apache.bookkeeper.meta.MetadataClientDriver |
getMetadataClientDriver() |
static Collection<org.apache.bookkeeper.net.BookieId> |
getMockEnsemble() |
org.apache.zookeeper.ZooKeeper |
getZkHandle() |
org.apache.bookkeeper.client.api.DeleteBuilder |
newDeleteLedgerOp() |
org.apache.bookkeeper.client.api.OpenBuilder |
newOpenLedgerOp() |
CompletableFuture<Void> |
promiseAfter(int steps) |
void |
returnEmptyLedgerAfter(int steps)
After N times, make a ledger to appear to be empty
|
void |
shutdown() |
asyncCreateLedgerAdv, asyncCreateLedgerAdv, asyncIsClosed, createLedger, createLedgerAdv, createLedgerAdv, createLedgerAdv, forConfig, getBookieAddressResolver, getBookieInfo, getLedgerManager, getLedgerMetadata, getMainWorkerPool, isClosed, newCreateLedgerOp, newListLedgersOp, openLedger, openLedgerNoRecoverypublic PulsarMockBookKeeper(org.apache.zookeeper.ZooKeeper zkc,
ExecutorService executor)
throws Exception
Exceptionpublic org.apache.zookeeper.ZooKeeper getZkHandle()
getZkHandle in class org.apache.bookkeeper.client.BookKeeperpublic org.apache.bookkeeper.conf.ClientConfiguration getConf()
getConf in class org.apache.bookkeeper.client.BookKeeperpublic static Collection<org.apache.bookkeeper.net.BookieId> getMockEnsemble()
public org.apache.bookkeeper.client.LedgerHandle createLedger(org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd)
throws org.apache.bookkeeper.client.BKException,
InterruptedException
createLedger in class org.apache.bookkeeper.client.BookKeeperorg.apache.bookkeeper.client.BKExceptionInterruptedExceptionpublic org.apache.bookkeeper.client.LedgerHandle createLedger(int ensSize,
int qSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd)
throws org.apache.bookkeeper.client.BKException,
InterruptedException
createLedger in class org.apache.bookkeeper.client.BookKeeperorg.apache.bookkeeper.client.BKExceptionInterruptedExceptionpublic void asyncCreateLedger(int ensSize,
int writeQuorumSize,
int ackQuorumSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb,
Object ctx,
Map<String,byte[]> properties)
asyncCreateLedger in class org.apache.bookkeeper.client.BookKeeperpublic org.apache.bookkeeper.client.LedgerHandle createLedger(int ensSize,
int writeQuorumSize,
int ackQuorumSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd)
throws org.apache.bookkeeper.client.BKException,
InterruptedException
createLedger in class org.apache.bookkeeper.client.BookKeeperorg.apache.bookkeeper.client.BKExceptionInterruptedExceptionpublic void asyncCreateLedger(int ensSize,
int qSize,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.CreateCallback cb,
Object ctx)
asyncCreateLedger in class org.apache.bookkeeper.client.BookKeeperpublic void asyncOpenLedger(long lId,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.OpenCallback cb,
Object ctx)
asyncOpenLedger in class org.apache.bookkeeper.client.BookKeeperpublic void asyncOpenLedgerNoRecovery(long lId,
org.apache.bookkeeper.client.BookKeeper.DigestType digestType,
byte[] passwd,
org.apache.bookkeeper.client.AsyncCallback.OpenCallback cb,
Object ctx)
asyncOpenLedgerNoRecovery in class org.apache.bookkeeper.client.BookKeeperpublic void asyncDeleteLedger(long lId,
org.apache.bookkeeper.client.AsyncCallback.DeleteCallback cb,
Object ctx)
asyncDeleteLedger in class org.apache.bookkeeper.client.BookKeeperpublic void deleteLedger(long lId)
throws InterruptedException,
org.apache.bookkeeper.client.BKException
deleteLedger in class org.apache.bookkeeper.client.BookKeeperInterruptedExceptionorg.apache.bookkeeper.client.BKExceptionpublic void close()
throws InterruptedException,
org.apache.bookkeeper.client.BKException
close in interface AutoCloseableclose in interface org.apache.bookkeeper.client.api.BookKeeperclose in class org.apache.bookkeeper.client.BookKeeperInterruptedExceptionorg.apache.bookkeeper.client.BKExceptionpublic org.apache.bookkeeper.client.api.OpenBuilder newOpenLedgerOp()
newOpenLedgerOp in interface org.apache.bookkeeper.client.api.BookKeepernewOpenLedgerOp in class org.apache.bookkeeper.client.BookKeeperpublic org.apache.bookkeeper.client.api.DeleteBuilder newDeleteLedgerOp()
newDeleteLedgerOp in interface org.apache.bookkeeper.client.api.BookKeepernewDeleteLedgerOp in class org.apache.bookkeeper.client.BookKeeperpublic void shutdown()
public Map<Long,PulsarMockLedgerHandle> getLedgerMap()
public void failNow(int rc)
public void failAfter(int steps,
int rc)
public void returnEmptyLedgerAfter(int steps)
public CompletableFuture<Void> promiseAfter(int steps)
public void addEntryDelay(long delay,
TimeUnit unit)
public org.apache.bookkeeper.meta.MetadataClientDriver getMetadataClientDriver()
getMetadataClientDriver in class org.apache.bookkeeper.client.BookKeeperCopyright © 2017–2021 Apache Software Foundation. All rights reserved.