reddycharan commented on a change in pull request #1281: Issue #570: 
Introducing EntryLogManager.
URL: https://github.com/apache/bookkeeper/pull/1281#discussion_r180565394
 
 

 ##########
 File path: 
bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/CreateNewLogTest.java
 ##########
 @@ -93,16 +98,16 @@ public void testCreateNewLog() throws Exception {
         // Extracted from createNewLog()
         String logFileName = Long.toHexString(1) + ".log";
         File dir = ledgerDirsManager.pickRandomWritableDir();
-        LOG.info("Picked this directory: " + dir);
+        LOG.info("Picked this directory: {}", dir);
         File newLogFile = new File(dir, logFileName);
         newLogFile.createNewFile();
 
         EntryLogger el = new EntryLogger(conf, ledgerDirsManager);
         // Calls createNewLog, and with the number of directories we
         // are using, if it picks one at random it will fail.
-        el.createNewLog();
-        LOG.info("This is the current log id: " + el.getCurrentLogId());
-        assertTrue("Wrong log id", el.getCurrentLogId() > 1);
+        ((EntryLogManagerBase) el.entryLogManager).createNewLog(0L);
 
 Review comment:
   1) I can add simple getter for EntryLogManager in EntryLogger, but wondering 
how would it help us in mocking if inside EntryLogger class direct reference of 
EntryLogger instance is used and using getter of EntryLogManager in all the 
places it is used in EntryLogger class is a stretch. 
   2) if mocking is the requirement here then i can create 
initializeEntryLogManager method, which would initialize the EntryLogManager 
depending on the config, and for mocking purpose that method can be mocked to 
return what we want.
   3) ok. in some places I wanted to test  getPreviousAllocatedEntryLogId, but 
it seems in this test it is not appropriate to change it to 
getPreviousAllocatedEntryLogId. will revert it back.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to