sijie commented on a change in pull request #1042: ISSUE #1041: Adding new
testcases
URL: https://github.com/apache/bookkeeper/pull/1042#discussion_r163145711
##########
File path:
bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
##########
@@ -344,6 +347,88 @@ public void testLedgerCreateWithCustomMetadata() throws
Exception {
}
/*
+ * Verify the functionality of Advanced Ledger which accepts ledgerId as
+ * input and returns LedgerHandleAdv. LedgerHandleAdv takes entryId for
+ * addEntry, and let user manage entryId allocation.
+ * This testcase is mainly added for covering missing code coverage
branches
+ * in LedgerHandleAdv
+ *
+ * @throws Exception
+ */
+ @Test(timeout = 60000)
+ public void testLedgerHandleAdvFunctionality() throws Exception {
+ // Create a ledger
+ long ledgerId = 0xABCDEF;
+ lh = bkc.createLedgerAdv(ledgerId, 5, 3, 2, digestType,
ledgerPassword, null);
+ numEntriesToWrite = 3;
+
+ ByteBuffer entry = ByteBuffer.allocate(4);
+ entry.putInt(rng.nextInt(maxInt));
+ entry.position(0);
+ entries1.add(entry.array());
+ lh.addEntry(0, entry.array());
+
+ // here asyncAddEntry(final long entryId, final byte[] data, final
+ // AddCallback cb, final Object ctx) method is
+ // called which is not covered in any other testcase
+ entry = ByteBuffer.allocate(4);
+ entry.putInt(rng.nextInt(maxInt));
+ entry.position(0);
+ entries1.add(entry.array());
+ CountDownLatch latch = new CountDownLatch(1);
Review comment:
line 378-389 can be simplified with the sync method, no?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services