couchbase / CouchbaseMock

A Java mock for Couchbase
Apache License 2.0
64 stars 42 forks source link

RFC: Explicit Embedded Mode Support #21

Open jimhooker2002 opened 7 years ago

jimhooker2002 commented 7 years ago

Just wanted to contribute the following for discussion. As argued in https://github.com/couchbase/CouchbaseMock/issues/16 (see my comments on the ticket towards the bottom) I'd love to see "embedded" mode, explicitly supported as part of this project.

I sketched out the following https://github.com/jimhooker2002/CouchbaseMock/compare/master...embedded-support-proto

I'd love to get some comments/thoughts on the idea. Is it worth me spending a bit of time sketching out the rest of that class (production quality/tests/documentation etc)? Philosophically, is it clear what I'm trying to do here, and do you guys agree it's a good idea? Of course, if you don't agree that this is useful, then there's no point me spending a bunch of time on it.

As mentioned in the comments of the diff - the existing client code that we have to talk with HarikiriMonitor over a socket/HTTP makes perfect sense when running in a seperate process. But, when running in embedded mode (same process as test code) it's a nicer experience to just do "regular Java stuff" with the CouchbaseMock object itself - no network/REST/socket interaction, and the usage of Java types as opposed to the raw JSON.

All the best,

Jim.