You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2018/08/09 07:07:10 UTC

[GitHub] ivankelly commented on issue #1589: Make LedgerHandle injectable

ivankelly commented on issue #1589: Make LedgerHandle injectable
URL: https://github.com/apache/bookkeeper/pull/1589#issuecomment-411659124
 
 
   @jvrao testability of the client. In particular, I need fine grain control of when "bookies" and the "ledger-manager" respond to demonstrate a data loss bug (will push later today).
   
   Currently, to get a ledger handle, you have to create a BookKeeper object, which creates zookeeper connections, bookie connections and a whole bunch of crap. These can be mocked with mockito, but this mocking is brittle; It's unclear as you are writing which objects you need to mock on the bookkeeper object. There's no defined interface between LedgerHandle and BookKeeper, so it ended up reaching into it's internals all over the place.
   
   With this change, the interface between LedgerHandle and BookKeeper is explicit. If it changes in a breaking way, it will break at compile time, not when you run the tests.
   
   I going to make mock BookieClient, BookieWatcher, and LedgerManager implementations, which can be used directly with LedgerHandle.
   
   

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


With regards,
Apache Git Services