Search in sources :

Example 1 with MongodConfig

use of de.flapdoodle.embed.mongo.config.MongodConfig in project zeppelin by apache.

the class MongoNotebookRepoTest method setUp.

@Before
public void setUp() throws IOException {
    String bindIp = "localhost";
    ServerSocket socket = new ServerSocket(0);
    int port = socket.getLocalPort();
    socket.close();
    MongodConfig mongodConfig = MongodConfig.builder().version(Version.Main.PRODUCTION).net(new Net(bindIp, port, Network.localhostIsIPv6())).build();
    mongodExecutable = MongodStarter.getDefaultInstance().prepare(mongodConfig);
    mongodExecutable.start();
    System.setProperty(ZEPPELIN_NOTEBOOK_MONGO_URI.getVarName(), "mongodb://" + bindIp + ":" + port);
    zConf = ZeppelinConfiguration.create();
    notebookRepo = new MongoNotebookRepo();
    notebookRepo.init(zConf);
}
Also used : MongodConfig(de.flapdoodle.embed.mongo.config.MongodConfig) ServerSocket(java.net.ServerSocket) Net(de.flapdoodle.embed.mongo.config.Net) Before(org.junit.Before)

Aggregations

MongodConfig (de.flapdoodle.embed.mongo.config.MongodConfig)1 Net (de.flapdoodle.embed.mongo.config.Net)1 ServerSocket (java.net.ServerSocket)1 Before (org.junit.Before)1