de.flapdoodle.embedmongo.tests
Class MongodForTestsFactory

java.lang.Object
  extended by de.flapdoodle.embedmongo.tests.MongodForTestsFactory

public class MongodForTestsFactory
extends Object

This class encapsulates everything that would be needed to do embedded MongoDB testing.


Constructor Summary
MongodForTestsFactory()
          Create the testing utility using the latest production version of MongoDB.
MongodForTestsFactory(IVersion version)
          Create the testing utility using the specified version of MongoDB.
 
Method Summary
 com.mongodb.DB newDB(com.mongodb.Mongo mongo)
          Creates a new DB with unique name for connection.
 com.mongodb.Mongo newMongo()
          Creates a new Mongo connection.
 void shutdown()
          Cleans up the resources created by the utility.
static MongodForTestsFactory with(IVersion version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MongodForTestsFactory

public MongodForTestsFactory()
                      throws IOException
Create the testing utility using the latest production version of MongoDB.

Throws:
IOException

MongodForTestsFactory

public MongodForTestsFactory(IVersion version)
                      throws IOException
Create the testing utility using the specified version of MongoDB.

Parameters:
version - version of MongoDB.
Throws:
IOException
Method Detail

with

public static MongodForTestsFactory with(IVersion version)
                                  throws IOException
Throws:
IOException

newMongo

public com.mongodb.Mongo newMongo()
                           throws UnknownHostException,
                                  com.mongodb.MongoException
Creates a new Mongo connection.

Throws:
com.mongodb.MongoException
UnknownHostException

newDB

public com.mongodb.DB newDB(com.mongodb.Mongo mongo)
Creates a new DB with unique name for connection.


shutdown

public void shutdown()
Cleans up the resources created by the utility.



Copyright © 2012. All Rights Reserved.