sijie closed pull request #1388: ISSUE #1387: added unit test for
LedgerHandleAdv handling of attempts to use LedgerHandle's specific API calls
(add without specifying entry id)
URL: https://github.com/apache/bookkeeper/pull/1388
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
index 1b061f0be..368ffa3c6 100644
---
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
+++
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookieWriteLedgerTest.java
@@ -333,6 +333,32 @@ public void testLedgerCreateAdv() throws Exception {
lh.close();
}
+ /**
+ * Verify that attempts to use addEntry() variant that does not require
specifying entry id
+ * on LedgerHandleAdv results in error.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testLedgerCreateAdvAndWriteNonAdv() throws Exception {
+ long ledgerId = 0xABCDEF;
+ lh = bkc.createLedgerAdv(ledgerId, 3, 3, 2, digestType,
ledgerPassword, null);
+
+ ByteBuffer entry = ByteBuffer.allocate(4);
+ entry.putInt(rng.nextInt(maxInt));
+ entry.position(0);
+
+ try {
+ lh.addEntry(entry.array());
+ fail("expected IllegalOpException");
+ } catch (BKException.BKIllegalOpException e) {
+ // pass, expected
+ } finally {
+ lh.close();
+ bkc.deleteLedger(ledgerId);
+ }
+ }
+
/**
* Verify that LedgerHandleAdv cannnot handle addEntry without the entryId.
*
----------------------------------------------------------------
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