This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 0b0eef905c3 [improve][test] Clarify method signatures in Bookkeeper
mock client (#23598)
0b0eef905c3 is described below
commit 0b0eef905c3a6ebe8a6fbb284743d98c8e97d5b8
Author: Zhengke Zhou <[email protected]>
AuthorDate: Thu Nov 14 18:27:10 2024 +0800
[improve][test] Clarify method signatures in Bookkeeper mock client (#23598)
---
.../bookkeeper/client/BookKeeperTestClient.java | 26 +++++++++++-----------
.../bookkeeper/client/PulsarMockBookKeeper.java | 4 ++--
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git
a/testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
b/testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
index dd33c2c4532..6aa949d7524 100644
---
a/testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
+++
b/testmocks/src/main/java/org/apache/bookkeeper/client/BookKeeperTestClient.java
@@ -71,14 +71,14 @@ public class BookKeeperTestClient extends BookKeeper {
return bookieClient;
}
- public Future<?> waitForReadOnlyBookie(BookieId b)
+ public Future<?> waitForReadOnlyBookie(BookieId id)
throws Exception {
- return waitForBookieInSet(b, false);
+ return waitForBookieInSet(id, false);
}
- public Future<?> waitForWritableBookie(BookieId b)
+ public Future<?> waitForWritableBookie(BookieId id)
throws Exception {
- return waitForBookieInSet(b, true);
+ return waitForBookieInSet(id, true);
}
/**
@@ -86,23 +86,23 @@ public class BookKeeperTestClient extends BookKeeper {
* or the read only set of bookies. Also ensure that it doesn't exist
* in the other set before completing.
*/
- private Future<?> waitForBookieInSet(BookieId b,
+ private Future<?> waitForBookieInSet(BookieId id,
boolean writable) throws Exception {
log.info("Wait for {} to become {}",
- b, writable ? "writable" : "readonly");
+ id, writable ? "writable" : "readonly");
CompletableFuture<Void> readOnlyFuture = new CompletableFuture<>();
CompletableFuture<Void> writableFuture = new CompletableFuture<>();
RegistrationListener readOnlyListener = (bookies) -> {
- boolean contains = bookies.getValue().contains(b);
- if ((!writable && contains) || (writable && !contains)) {
+ boolean containsId = bookies.getValue().contains(id);
+ if ((!writable && containsId) || (writable && !containsId)) {
readOnlyFuture.complete(null);
}
};
RegistrationListener writableListener = (bookies) -> {
- boolean contains = bookies.getValue().contains(b);
- if ((writable && contains) || (!writable && !contains)) {
+ boolean containsId = bookies.getValue().contains(id);
+ if ((writable && containsId) || (!writable && !containsId)) {
writableFuture.complete(null);
}
};
@@ -114,7 +114,7 @@ public class BookKeeperTestClient extends BookKeeper {
return writableFuture
.thenCompose(ignored ->
getMetadataClientDriver().getRegistrationClient().getReadOnlyBookies())
.thenCompose(readonlyBookies -> {
- if (readonlyBookies.getValue().contains(b)) {
+ if (readonlyBookies.getValue().contains(id)) {
// if the bookie still shows up at readonly path,
wait for it to disappear
return readOnlyFuture;
} else {
@@ -125,7 +125,7 @@ public class BookKeeperTestClient extends BookKeeper {
return readOnlyFuture
.thenCompose(ignored ->
getMetadataClientDriver().getRegistrationClient().getWritableBookies())
.thenCompose(writableBookies -> {
- if (writableBookies.getValue().contains(b)) {
+ if (writableBookies.getValue().contains(id)) {
// if the bookie still shows up at writable path,
wait for it to disappear
return writableFuture;
} else {
@@ -139,7 +139,7 @@ public class BookKeeperTestClient extends BookKeeper {
* Force a read to zookeeper to get list of bookies.
*
* @throws InterruptedException
- * @throws KeeperException
+ * @throws BKException
*/
public void readBookiesBlocking() throws InterruptedException, BKException
{
bookieWatcher.initialBlockingBookieRead();
diff --git
a/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
index 4516cfea01f..11ec2dec938 100644
---
a/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
+++
b/testmocks/src/main/java/org/apache/bookkeeper/client/PulsarMockBookKeeper.java
@@ -105,13 +105,13 @@ public class PulsarMockBookKeeper extends BookKeeper {
}
@Override
- public LedgerHandle createLedger(DigestType digestType, byte passwd[])
+ public LedgerHandle createLedger(DigestType digestType, byte[] passwd)
throws BKException, InterruptedException {
return createLedger(3, 2, digestType, passwd);
}
@Override
- public LedgerHandle createLedger(int ensSize, int qSize, DigestType
digestType, byte passwd[])
+ public LedgerHandle createLedger(int ensSize, int qSize, DigestType
digestType, byte[] passwd)
throws BKException, InterruptedException {
return createLedger(ensSize, qSize, qSize, digestType, passwd);
}