joelittlejohn / embedmongo-maven-plugin

Maven plugin wrapper for the flapdoodle.de embedded MongoDB API
Apache License 2.0
88 stars 51 forks source link

Add ability to specify init script for mongoDB. #32

Closed duerlib closed 9 years ago

duerlib commented 11 years ago

I am having trouble finding a way to add some test data to the DB before my httptests are run. I am trying to use the @BeforeClass annotation but am unable to figure out what i need to do in that method to add something. I think it would be good if I could add a script file to the config of the plugin to be run once the DB is brought up. Any thoughts?

joelittlejohn commented 11 years ago

This would certainly be possible.

You should be on the right track with a @BeforeClass static method though. You simply need to connect to the running instance of MongoDB with a Java library of your choice and start inserting some data. You can use the official Java driver on its own or something extra (like Jongo).

duerlib commented 11 years ago

Ok thanks, I think I am close now. However I still like the idea of the script being included in the config. No rush though. Also thanks for an awesome plugin.

pvardanega commented 9 years ago

Hi,

I created a pull request https://github.com/joelittlejohn/embedmongo-maven-plugin/pull/40 to initialize data after a mongo instance is up and running.