flapdoodle-oss/embedmongo.flapdoodle.de — pull request #3 by adutra (2012-05-16 16:21:17+00:00)
Title: New pull request: Ability to choose a log backend + New process shutdown + Reactivation of cross-platform tests

Herzliche Grüsse aus Frankreich :)

I started using EmbedMongo a few days ago, and would like to thank you guys for this very useful plugin.

In this pull request I am proposing a few enhancements that were all motivated by my own personal needs:

1) Ability to choose a different log backend for mongod process output.

As I was lacking the possibility to use my favorite logging framework to display mongod messages (these are currently sent to System.out), I reworked this part of the application so that one could use either System.out, SLF4J, Log4j, JCL or JUL, or even some other exotic logging solution.
(BTW, IMHO the plugin should use exclusively SLF4J + Logback as its own logging framework.)

2) New (simpler?) process management.

Killing a mongod process is hard. I'm proposing a different approach: send a "shutdown" command to the server via the java driver. Unit tests have shown that this solution is fast and reliable and does not require keeping track of PIDs, which is always error-prone.
The major drawback is that we need a compile-scope dependency on the java driver, but after all, it seems rather logic: if one is using EmbedMongo, he is probably using the java driver already.

3) Reactivation of cross-platform tests.

As I wanted to be sure that everything would work in different platforms, I reactivated tests in de.flapdoodle.embedmongo.MongoDBExampleAllVersionsTest, excluding only some platform/version combinations that are known to be problematic. Tests passed in the following platforms: Win XP 32 bits; Mac OS X 32 bits; Linux Fedora 64 bits (kernel 2.6.38.2). I know I might not have anticipated some other problematic combinations, but I needed to be sure that at least on a few common situations, my modifications were OK.

Topics 1) and 2) required a lot of redesign, so please feel free to decline this proposal if you think that it goes too far.

Also, I am not familiar at all with Gradle, so I used Maven to build the project. I cannot guarantee that Gradle builds will work.