public class FongoRule
extends org.junit.rules.ExternalResource
@Rule public FongoRule rule = new FongoRule().
Note than you can switch to a realmongodb on your localhost (for now).
WARNING : database is dropped after the test !!
| Constructor and Description |
|---|
FongoRule() |
FongoRule(boolean realMongo) |
FongoRule(String dbName) |
FongoRule(String dbName,
boolean realMongo)
Setup a rule with a real MongoDB.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
com.mongodb.DB |
getDb() |
com.mongodb.Mongo |
getMongo() |
com.mongodb.DBCollection |
insertFile(com.mongodb.DBCollection coll,
String filename) |
com.mongodb.DBCollection |
insertJSON(com.mongodb.DBCollection coll,
String json) |
com.mongodb.DBCollection |
newCollection() |
com.mongodb.DBCollection |
newCollection(String collectionName) |
Fongo |
newFongo() |
<T> T |
parse(String json) |
com.mongodb.DBObject |
parseDBObject(String json) |
List<com.mongodb.DBObject> |
parseList(String json) |
public FongoRule(String dbName, boolean realMongo)
dbName - the dbName to use.realMongo - set to true if you want to use a real mongoDB.public FongoRule()
public FongoRule(boolean realMongo)
public FongoRule(String dbName)
protected void before()
throws UnknownHostException
before in class org.junit.rules.ExternalResourceUnknownHostExceptionprotected void after()
after in class org.junit.rules.ExternalResourcepublic com.mongodb.DBCollection insertJSON(com.mongodb.DBCollection coll,
String json)
public com.mongodb.DBCollection insertFile(com.mongodb.DBCollection coll,
String filename)
throws IOException
IOExceptionpublic com.mongodb.DBObject parseDBObject(String json)
public <T> T parse(String json)
public com.mongodb.DBCollection newCollection()
public com.mongodb.DBCollection newCollection(String collectionName)
public Fongo newFongo()
public com.mongodb.DB getDb()
public com.mongodb.Mongo getMongo()
Copyright © 2014. All Rights Reserved.