use of de.flapdoodle.embed.mongo.MongodStarter in project gora by apache.
the class GoraMongodbTestDriver method setUpClass.
/**
* Initiate the MongoDB server on the default port
*/
@Override
public void setUpClass() throws IOException {
IRuntimeConfig runtimeConfig = new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, log).processOutput(ProcessOutput.getDefaultInstanceSilent()).build();
MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
int port = Network.getFreeServerPort();
IMongodConfig mongodConfig = new MongodConfigBuilder().version(version).net(new Net(port, Network.localhostIsIPv6())).build();
// Store Mongo server "host:port" in Hadoop configuration
// so that MongoStore will be able to get it latter
conf.set(MongoStoreParameters.PROP_MONGO_SERVERS, "127.0.0.1:" + port);
log.info("Starting embedded Mongodb server on {} port.", port);
try {
_mongodExe = runtime.prepare(mongodConfig);
_mongod = _mongodExe.start();
_mongo = new MongoClient("localhost", port);
} catch (Exception e) {
log.error("Error starting embedded Mongodb server... tearing down test driver.");
tearDownClass();
}
}
use of de.flapdoodle.embed.mongo.MongodStarter in project sling by apache.
the class SlingLaunchpadNosqlMongoIT method startMongo.
protected void startMongo(final int port) throws IOException {
final MongodStarter starter = MongodStarter.getDefaultInstance();
final Net net = new Net(port, Network.localhostIsIPv6());
final IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(net).build();
executable = starter.prepare(mongodConfig);
process = executable.start();
}
use of de.flapdoodle.embed.mongo.MongodStarter in project sling by apache.
the class SlingLaunchpadOakMongoIT method startMongo.
protected void startMongo(final int port) throws IOException {
final MongodStarter starter = MongodStarter.getDefaultInstance();
final Net net = new Net(port, Network.localhostIsIPv6());
final IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(net).build();
executable = starter.prepare(mongodConfig);
process = executable.start();
}
use of de.flapdoodle.embed.mongo.MongodStarter in project pinpoint by naver.
the class MongoDBITBase method startDB.
public void startDB() throws Exception {
MongodStarter starter = MongodStarter.getDefaultInstance();
IMongodConfig mongodConfig = new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(new Net(MongoDBITConstants.BIND_ADDRESS, MongoDBITConstants.PORT, Network.localhostIsIPv6())).build();
MongodExecutable mongodExecutable = starter.prepare(mongodConfig);
// replaced via awaitCompleted()
// //give time for previous DB close to finish and port to be released"
// Thread.sleep(200L);
mongod = mongodExecutable.start();
setClient();
}
use of de.flapdoodle.embed.mongo.MongodStarter in project spring-boot by spring-projects.
the class EmbeddedMongoAutoConfiguration method embeddedMongoServer.
@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
public MongodExecutable embeddedMongoServer(IMongodConfig mongodConfig) throws IOException {
Integer configuredPort = this.properties.getPort();
if (configuredPort == null || configuredPort == 0) {
setEmbeddedPort(mongodConfig.net().getPort());
}
MongodStarter mongodStarter = getMongodStarter(this.runtimeConfig);
return mongodStarter.prepare(mongodConfig);
}
Aggregations