public class FongoAsyncRule
extends org.junit.rules.ExternalResource
@Rule public FongoAsyncRule rule = new FongoAsyncRule().
Note than you can switch to a real mongodb on your localhost (for now).
WARNING : database is dropped after the test !!
| Constructor and Description |
|---|
FongoAsyncRule() |
FongoAsyncRule(boolean realMongo) |
FongoAsyncRule(boolean realMongo,
com.mongodb.async.client.MongoClient mongoClientIfReal) |
FongoAsyncRule(boolean realMongo,
com.mongodb.connection.ServerVersion serverVersion) |
FongoAsyncRule(com.mongodb.connection.ServerVersion serverVersion) |
FongoAsyncRule(String dbName) |
FongoAsyncRule(String dbName,
boolean realMongo) |
FongoAsyncRule(String dbName,
com.mongodb.connection.ServerVersion serverVersion,
boolean realMongo,
com.mongodb.async.client.MongoClient mongoClientIfReal)
Setup a rule with a real MongoDB.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
com.mongodb.async.client.MongoDatabase |
getDatabase() |
com.mongodb.async.client.MongoDatabase |
getDatabase(String name) |
FongoAsync |
getFongo() |
com.mongodb.async.client.MongoClient |
getMongoClient() |
boolean |
isRealMongo() |
protected FongoAsync |
newFongo(com.mongodb.connection.ServerVersion serverVersion) |
com.mongodb.async.client.MongoCollection<org.bson.Document> |
newMongoCollection() |
<T> com.mongodb.async.client.MongoCollection<T> |
newMongoCollection(Class<T> documentClass) |
com.mongodb.async.client.MongoCollection<org.bson.Document> |
newMongoCollection(String collectionName) |
<T> com.mongodb.async.client.MongoCollection<T> |
newMongoCollection(String collectionName,
Class<T> documentClass) |
public FongoAsyncRule(String dbName, com.mongodb.connection.ServerVersion serverVersion, boolean realMongo, com.mongodb.async.client.MongoClient mongoClientIfReal)
dbName - the dbName to use.serverVersion - version of the server to use for fongo.realMongo - set to true if you want to use a real mongoDB.mongoClientIfReal - real client to use if realMongo si true.public FongoAsyncRule()
public FongoAsyncRule(com.mongodb.connection.ServerVersion serverVersion)
public FongoAsyncRule(boolean realMongo)
public FongoAsyncRule(boolean realMongo,
com.mongodb.connection.ServerVersion serverVersion)
public FongoAsyncRule(boolean realMongo,
com.mongodb.async.client.MongoClient mongoClientIfReal)
public FongoAsyncRule(String dbName, boolean realMongo)
public FongoAsyncRule(String dbName)
public boolean isRealMongo()
protected void before()
throws UnknownHostException
before in class org.junit.rules.ExternalResourceUnknownHostExceptionprotected void after()
after in class org.junit.rules.ExternalResourcepublic com.mongodb.async.client.MongoCollection<org.bson.Document> newMongoCollection()
public com.mongodb.async.client.MongoCollection<org.bson.Document> newMongoCollection(String collectionName)
public <T> com.mongodb.async.client.MongoCollection<T> newMongoCollection(Class<T> documentClass)
public <T> com.mongodb.async.client.MongoCollection<T> newMongoCollection(String collectionName, Class<T> documentClass)
protected FongoAsync newFongo(com.mongodb.connection.ServerVersion serverVersion)
public FongoAsync getFongo()
public com.mongodb.async.client.MongoDatabase getDatabase(String name)
public com.mongodb.async.client.MongoDatabase getDatabase()
public com.mongodb.async.client.MongoClient getMongoClient()
Copyright © 2018. All rights reserved.