Skip to content

Instantly share code, notes, and snippets.

@cexbrayat
Created July 29, 2012 15:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cexbrayat/3199637 to your computer and use it in GitHub Desktop.
Save cexbrayat/3199637 to your computer and use it in GitHub Desktop.
Blog - Play!, MongoDB et Morphia - MongoPlayJUnitRunner.java
public class MongoPlayJUnitRunner extends PlayJUnitRunner {
static int PORT = 27017;
static {
try {
MongodConfig config = new MongodConfig(Version.V2_0, PORT, Network.localhostIsIPv6());
MongodExecutable prepared = MongoDBRuntime.getDefaultInstance().prepare(config);
prepared.start();
new Mongo("localhost", PORT);
PlayJUnitRunner.StartPlay.rule();
} catch (IOException e) {
Logger.error("Could not start embedmongo instance");
}
}
public MongoPlayJUnitRunner(Class testClass) throws ClassNotFoundException, InitializationError, IOException {
super(testClass);
}
}
@cexbrayat
Copy link
Author

Gist for a blog post

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment