本文整理了Java中de.flapdoodle.embed.mongo.MongodStarter
类的一些代码示例,展示了MongodStarter
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongodStarter
类的具体详情如下:
包路径:de.flapdoodle.embed.mongo.MongodStarter
类名称:MongodStarter
暂无
代码示例来源:origin: spring-projects/spring-data-examples
private void initializeConfigServer(IMongodConfig config) throws Exception {
if (!config.isConfigServer()) {
throw new Exception(
"Mongo configuration is not a defined for a config server.");
}
MongodStarter starter = MongodStarter.getDefaultInstance();
MongodExecutable mongodExe = starter.prepare(config);
MongodProcess process = mongodExe.start();
mongodProcessList.add(process);
}
代码示例来源:origin: spring-projects/spring-data-examples
.processOutput(outputFunction.apply(Command.MongoD))
.build();
MongodStarter starter = MongodStarter.getInstance(runtimeConfig);
MongodExecutable mongodExe = starter.prepare(mongoConfig);
MongodProcess process = mongodExe.start();
mongodProcessList.add(process);
代码示例来源:origin: stackoverflow.com
_mongodExe = starter.prepare(new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(port, Network.localhostIsIPv6()))
代码示例来源:origin: de.flapdoodle.embed/de.flapdoodle.embed.mongo
public static MongodStarter getDefaultInstance() {
return getInstance(new RuntimeConfigBuilder().defaults(Command.MongoD).build());
}
代码示例来源:origin: apache/jackrabbit-oak
public synchronized void start() throws IOException {
if (process != null) {
throw new IllegalStateException("Already started");
}
process = starter.prepare(config).start();
}
代码示例来源:origin: yandex-qatools/embedded-services
console()))
.build();
runtime = MongodStarter.getInstance(runtimeConfig);
代码示例来源:origin: kaaproject/kaa
public static void setUp(int port) throws Exception {
LOG.info("Embedded MongoDB server started on " + port + " port and " + MONGO_HOST + " host.");
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongoDBExec = runtime.prepare(createMongodConfig(port));
mongod = mongoDBExec.start();
mongo = new MongoClient(MONGO_HOST, port);
}
代码示例来源:origin: jirutka/embedmongo-spring
/**
* Builds {@link MongodStarter}, then starts "embedded" MongoDB instance
* and returns initialized {@code MongoClient}.
*
* <p>You should invoke {@link com.mongodb.Mongo#close()} after job is done to close
* the client and stop the MongoDB instance.</p>
*
* @return A fully initialized {@code MongoClient).
* @throws IOException
*/
public MongoClient build() throws IOException {
LOG.info("Initializing embedded MongoDB instance");
MongodStarter runtime = MongodStarter.getInstance(buildRuntimeConfig());
MongodExecutable mongodExe = runtime.prepare(buildMongodConfig());
LOG.info("Starting embedded MongoDB instance");
mongodExe.start();
return new MongoClient(bindIp, getPort());
}
代码示例来源:origin: restx/restx
@Override
public void evaluate() throws Throwable {
MongodExecutable _mongodExe = runtime
.prepare(new MongodConfigBuilder()
.version(mongoVersion)
.net(new Net(Integer.parseInt(mongoClientURI
.getURI().split(":")[2]), false))
.build());
MongodProcess _mongod = _mongodExe.start();
MongoClient mongoClient = new MongoClient(mongoClientURI);
base.evaluate();
mongoClient.close();
_mongod.stop();
_mongodExe.stop();
}
};
代码示例来源:origin: ru.yandex.qatools.embed/embedded-services
console()))
.build();
runtime = MongodStarter.getInstance(runtimeConfig);
代码示例来源:origin: de.flapdoodle.embed/de.flapdoodle.embed.mongo
private void initializeConfigServer(IMongodConfig config) throws Exception {
if (!config.isConfigServer()) {
throw new Exception(
"Mongo configuration is not a defined for a config server.");
}
MongodStarter starter = MongodStarter.getDefaultInstance();
MongodExecutable mongodExe = starter.prepare(config);
MongodProcess process = mongodExe.start();
mongodProcessList.add(process);
}
代码示例来源:origin: de.flapdoodle.embed/de.flapdoodle.embed.mongo
/**
* Create the testing utility using the specified version of MongoDB.
*
* @param version
* version of MongoDB.
*/
public MongodForTestsFactory(final IFeatureAwareVersion version) throws IOException {
final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder()
.defaultsWithLogger(Command.MongoD, logger)
.build());
mongodExecutable = runtime.prepare(newMongodConfig(version));
mongodProcess = mongodExecutable.start();
}
代码示例来源:origin: stackoverflow.com
return mongodStarter.prepare(iMongodConfig);
代码示例来源:origin: sakserv/hadoop-mini-clusters
@Override
public void start() throws Exception {
LOG.info("MONGODB: Starting MongoDB on {}:{}", ip, port);
starter = MongodStarter.getDefaultInstance();
configure();
mongodExe = starter.prepare(conf);
mongod = mongodExe.start();
}
代码示例来源:origin: org.apache.rya/mongodb.rya
/**
* Create the testing utility using the specified version of MongoDB.
*
* @param version
* version of MongoDB.
*/
private EmbeddedMongoFactory(final IFeatureAwareVersion version) throws IOException {
final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).build());
mongodExecutable = runtime.prepare(newMongodConfig(version));
mongodProcess = mongodExecutable.start();
}
代码示例来源:origin: georocket/georocket
/**
* Start MongoDB instance. Don't forget to call {@link #stop()}
* if you don't need it anymore!
* @throws IOException if the instance could not be started
*/
public MongoDBTestConnector() throws IOException {
mongodExe = starter.prepare(new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(serverAddress.getPort(), Network.localhostIsIPv6()))
.build());
mongod = mongodExe.start();
}
代码示例来源:origin: com.github.sakserv/hadoop-mini-clusters-mongodb
@Override
public void start() throws Exception {
LOG.info("MONGODB: Starting MongoDB on {}:{}", ip, port);
starter = MongodStarter.getDefaultInstance();
configure();
mongodExe = starter.prepare(conf);
mongod = mongodExe.start();
}
代码示例来源:origin: apache/incubator-rya
/**
* Create the testing utility using the specified version of MongoDB.
*
* @param version
* version of MongoDB.
*/
private EmbeddedMongoFactory(final IFeatureAwareVersion version) throws IOException {
final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder().defaultsWithLogger(Command.MongoD, logger).build());
mongodExecutable = runtime.prepare(newMongodConfig(version));
mongodProcess = mongodExecutable.start();
}
代码示例来源:origin: ru.yandex.qatools.embed/embedded-services
private void prepareExecutable(boolean authEnabled) throws IOException {
final MongoCmdOptionsBuilder cmdBuilder = new MongoCmdOptionsBuilder();
cmdBuilder.enableAuth(authEnabled);
if (useWiredTiger && isMongo3()) {
cmdBuilder.useStorageEngine(WIRED_TIGER);
}
final IMongoCmdOptions cmdOptions = cmdBuilder.build();
MongodConfigBuilder builder = new MongodConfigBuilder()
.version(useVersion)
.cmdOptions(cmdOptions)
.net(new Net(host, port, Network.localhostIsIPv6()));
if (authEnabled && isMongo3()) {
builder.setParameter("authenticationMechanisms", authMechanisms);
}
if (replSetName != null) {
removeLockFile(builder);
builder.replication(new Storage(dataDirectory, replSetName, oplogSizeMb));
}
mongodConfig = builder.build();
executable = null;
executable = runtime.prepare(mongodConfig);
}
代码示例来源:origin: de.braintags/vertx-key-generator
private boolean startMongoExe(boolean startMongoLocal, int localPort) {
if (startMongoLocal) {
LOGGER.info("STARTING MONGO EXE");
try {
IMongodConfig config = new MongodConfigBuilder().version(Version.Main.PRODUCTION)
.net(new Net(localPort, Network.localhostIsIPv6())).build();
exe = MongodStarter.getDefaultInstance().prepare(config);
exe.start();
return true;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!