use of de.flapdoodle.embed.mongo.config.MongodConfigBuilder 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.config.MongodConfigBuilder in project jnosql-diana-driver by eclipse.
the class MongoDbHelper method startMongoDb.
public static void startMongoDb() throws IOException {
_mongodExe = starter.prepare(new MongodConfigBuilder().version(Version.Main.PRODUCTION).net(new Net("localhost", 27017, Network.localhostIsIPv6())).build());
_mongod = _mongodExe.start();
_mongo = new MongoClient("localhost", 27017);
}
use of de.flapdoodle.embed.mongo.config.MongodConfigBuilder in project logging-log4j2 by apache.
the class MongoDb3TestRule method apply.
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
final String value = Objects.requireNonNull(System.getProperty(portSystemPropertyName), "System property '" + portSystemPropertyName + "' is null");
final int port = Integer.parseInt(value);
try {
mongodExecutable = starter.prepare(// @formatter:off
new MongodConfigBuilder().version(Version.Main.PRODUCTION).timeout(new Timeout(BUILDER_TIMEOUT_MILLIS)).net(new Net("localhost", port, Network.localhostIsIPv6())).build());
// @formatter:on
} catch (final IllegalArgumentException e) {
if (e.getMessage().contains("this version does not support 32Bit")) {
throw new AssumptionViolatedException("Unsupported platform: " + e.getMessage());
}
}
mongodProcess = mongodExecutable.start();
mongoClient = new MongoClient("localhost", port);
try {
base.evaluate();
} finally {
if (mongodProcess != null) {
mongodProcess.stop();
mongodProcess = null;
}
if (mongodExecutable != null) {
mongodExecutable.stop();
mongodExecutable = null;
}
}
}
};
}
use of de.flapdoodle.embed.mongo.config.MongodConfigBuilder in project logging-log4j2 by apache.
the class MongoDb4TestRule method apply.
@Override
public Statement apply(final Statement base, final Description description) {
return new Statement() {
@Override
public void evaluate() throws Throwable {
final String value = Objects.requireNonNull(System.getProperty(portSystemPropertyName), "System property '" + portSystemPropertyName + "' is null");
final int port = Integer.parseInt(value);
try {
mongodExecutable = starter.prepare(// @formatter:off
new MongodConfigBuilder().version(Version.Main.PRODUCTION).timeout(new Timeout(BUILDER_TIMEOUT_MILLIS)).net(new Net("localhost", port, Network.localhostIsIPv6())).build());
// @formatter:on
} catch (final IllegalArgumentException e) {
if (e.getMessage().contains("this version does not support 32Bit")) {
throw new AssumptionViolatedException("Unsupported platform: " + e.getMessage());
}
}
mongodProcess = mongodExecutable.start();
mongoClient = MongoClients.create("mongodb://localhost:" + port);
try {
base.evaluate();
} finally {
if (mongodProcess != null) {
mongodProcess.stop();
mongodProcess = null;
}
if (mongodExecutable != null) {
mongodExecutable.stop();
mongodExecutable = null;
}
}
}
};
}
use of de.flapdoodle.embed.mongo.config.MongodConfigBuilder 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();
}
Aggregations