All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.mwarc.embeddedmongo.FongoServer Maven / Gradle / Ivy

Go to download

embedded-mongo-spring provides a way to use fongo with Spring TestContext Framework

The newest version!
package com.github.mwarc.embeddedmongo;

import com.github.fakemongo.Fongo;
import com.mongodb.DB;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public final class FongoServer implements MongoServer {

    private static Logger logger = LoggerFactory.getLogger(FongoServer.class);

    private DB db;

    @Override
    public void start(String dbName) {
        logger.debug("Starting mongo...");
        db = new Fongo("InMemoryMongo").getDB(dbName);

    }

    @Override
    public void clean() {
        if (db != null) {
            logger.debug("Cleaning mongo...");
            db.dropDatabase();
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy