本文整理了Java中de.flapdoodle.embed.mongo.MongodStarter.getInstance()
方法的一些代码示例,展示了MongodStarter.getInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongodStarter.getInstance()
方法的具体详情如下:
包路径:de.flapdoodle.embed.mongo.MongodStarter
类名称:MongodStarter
方法名:getInstance
暂无
代码示例来源: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();
代码示例来源:origin: de.flapdoodle.embed/de.flapdoodle.embed.mongo
public static MongodStarter getDefaultInstance() {
return getInstance(new RuntimeConfigBuilder().defaults(Command.MongoD).build());
}
代码示例来源: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: 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: 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: 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: com.redhat.lightblue.mongo/lightblue-mongo-test
.build();
MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
mongodExe = runtime.prepare(
new MongodConfigBuilder()
代码示例来源:origin: yandex-qatools/embedded-services
console()))
.build();
runtime = MongodStarter.getInstance(runtimeConfig);
代码示例来源:origin: zscott/MultiBitExchange
public MongodSandboxFactory() throws IOException {
// TODO Consider alternatives for configuring the logger level for de.flapdoodle
Logger logger = Logger.getLogger("de.flapdoodle");
// log only severe messsages for de.flapdoodle
logger.setLevel(Level.WARNING);
RuntimeConfig runtimeConfig = new RuntimeConfig();
runtimeConfig.setProcessOutput(
new ProcessOutput(
Processors.logTo(logger, Level.INFO),
Processors.logTo(logger, Level.SEVERE),
Processors.named("[console>]", Processors.logTo(logger, Level.FINE))
)
);
MongodConfig mongodConfig = new MongodConfig(Version.Main.V2_2);
MongodStarter runtime = MongodStarter.getInstance(runtimeConfig);
mongodExecutable = runtime.prepare(mongodConfig);
mongodProcess = mongodExecutable.start();
}
代码示例来源:origin: ru.yandex.qatools.embed/embedded-services
console()))
.build();
runtime = MongodStarter.getInstance(runtimeConfig);
代码示例来源:origin: otto-de/edison-microservice
public static void startMongoDB() throws IOException {
if (!started.compareAndSet(false, true)) {
throw new RuntimeException("Embedded mongo already running, call stopMongoDB before starting it again!");
}
final String bindIp = "localhost";
try {
final int port = Network.getFreeServerPort();
final IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(Version.Main.PRODUCTION)
.net(new Net(bindIp, port, Network.localhostIsIPv6()))
.build();
final MongodStarter runtime = MongodStarter.getInstance(new RuntimeConfigBuilder()
.defaultsWithLogger(Command.MongoD, LOG)
.build());
mongodExecutable = runtime.prepare(mongodConfig, Distribution.detectFor(Version.Main.PRODUCTION));
mongodProcess = mongodExecutable.start();
mongoClient = new MongoClient(bindIp, port);
} catch (final IOException e) {
stopMongoDB();
throw e;
}
}
代码示例来源:origin: ModeShape/modeshape
@BeforeClass
public static void setUpClass() throws Exception {
RuntimeConfig config = RuntimeConfig.getInstance(LOGGER);
MongodStarter runtime = MongodStarter.getInstance(config);
int freeServerPort = Network.getFreeServerPort();
mongodExecutable = runtime.prepare(new MongodConfig(Version.Main.V2_3, freeServerPort,
Network.localhostIsIPv6()));
mongodProcess = mongodExecutable.start();
binaryStore = new MongodbBinaryStore("localhost", freeServerPort, "test-" + UUID.randomUUID(), null, null, null);
binaryStore.setMimeTypeDetector(DEFAULT_DETECTOR);
binaryStore.start();
}
代码示例来源:origin: com.github.joelittlejohn.embedmongo/embedmongo-maven-plugin
.build();
executable = MongodStarter.getInstance(runtimeConfig).prepare(config);
} catch (DistributionException e) {
throw new MojoExecutionException("Failed to download MongoDB distribution: " + e.withDistribution(), e);
代码示例来源:origin: joelittlejohn/embedmongo-maven-plugin
.build();
executable = MongodStarter.getInstance(runtimeConfig).prepare(config);
} catch (DistributionException e) {
throw new MojoExecutionException("Failed to download MongoDB distribution: " + e.withDistribution(), e);
代码示例来源:origin: atlanmod/NeoEMF
.build();
final MongodStarter starter = MongodStarter.getInstance(runtimeConfig);
代码示例来源:origin: eclipse/ditto
private static MongodExecutable configureMongoDb(final String bindIp, final int mongoDbPort,
final IProxyFactory proxyFactory) throws IOException {
final Command command = Command.MongoD;
final MongodStarter mongodStarter = MongodStarter.getInstance(new RuntimeConfigBuilder()
.defaults(command)
.processOutput(ProcessOutput.getDefaultInstanceSilent())
.artifactStore(new ArtifactStoreBuilder()
.defaults(command)
.download(new DownloadConfigBuilder()
.defaultsForCommand(command)
.proxyFactory(proxyFactory)
.progressListener(new StandardConsoleProgressListener())
)
)
.build());
return mongodStarter.prepare(new MongodConfigBuilder()
.net(new Net(bindIp, mongoDbPort, false))
.version(Version.Main.PRODUCTION)
.cmdOptions(new MongoCmdOptionsBuilder()
.useStorageEngine("wiredTiger")
.useNoJournal(false)
.build())
.build());
}
内容来源于网络,如有侵权,请联系作者删除!