This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch branch-4.7
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/branch-4.7 by this push:
     new a4e5979  ISSUE #1387: added unit test for LedgerHandleAdv handling of 
attempts to use LedgerHandle's specific API calls (add without specifying entry 
id)
a4e5979 is described below

commit a4e5979525ad1f5f41150b9be232e8cb83aa6cdb
Author: Andrey Yegorov <[email protected]>
AuthorDate: Thu May 3 19:07:27 2018 -0700

    ISSUE #1387: added unit test for LedgerHandleAdv handling of attempts to 
use LedgerHandle's specific API calls (add without specifying entry id)
    
    Descriptions of the changes in this PR:
    
    - added unit test.
    
    Master Issue: #1387
    
    Author: Andrey Yegorov <[email protected]>
    
    Reviewers: Sijie Guo <[email protected]>, Venkateswararao Jujjuri (JV) <None>
    
    This closes #1388 from 
dlg99/fix/ISSUE-1387_LedgerHandleAdv_with_nonAdv_usage, closes #1387
    
    (cherry picked from commit 20e3f6c3e16e409b03d3d0fefad699c856ca3b49)
    Signed-off-by: Sijie Guo <[email protected]>
---
 .../bookkeeper/client/BookieWriteLedgerTest.java   | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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 1b061f0..368ffa3 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
@@ -334,6 +334,32 @@ public class BookieWriteLedgerTest extends
     }
 
     /**
+     * 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.
      *
      * @throws Exception

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to