本文整理了Java中de.flapdoodle.embed.mongo.MongodStarter.getDefaultInstance()
方法的一些代码示例,展示了MongodStarter.getDefaultInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongodStarter.getDefaultInstance()
方法的具体详情如下:
包路径:de.flapdoodle.embed.mongo.MongodStarter
类名称:MongodStarter
方法名:getDefaultInstance
暂无
代码示例来源: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: 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: 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: 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: 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: de.flapdoodle.embed/de.flapdoodle.embed.mongo
"Replica set name must match in mongo configuration");
MongodStarter starter = MongodStarter.getDefaultInstance();
MongodExecutable mongodExe = starter.prepare(mongoConfig);
MongodProcess process = mongodExe.start();
代码示例来源: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;
}
代码示例来源:origin: org.pac4j/pac4j-mongo
public void start(final int port) {
MongodStarter starter = MongodStarter.getDefaultInstance();
代码示例来源:origin: com.github.mlk/assortmentofjunitrules
@Override
public void before() throws Exception {
if(defaultPort < 0) {
currentPort = Helper.findRandomOpenPortOnAllLocalInterfaces();
} else {
currentPort = defaultPort;
}
IMongodConfig mongodConfig = new MongodConfigBuilder()
.version(version)
.net(new Net("localhost", currentPort, Network.localhostIsIPv6()))
.build();
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(mongodConfig);
mongod = mongodExe.start();
}
代码示例来源:origin: apache/eagle
public void start() throws Exception {
MongodStarter starter = MongodStarter.getDefaultInstance();
mongodExe = starter.prepare(new MongodConfigBuilder().version(Version.V3_2_1)
.net(new Net(27017, Network.localhostIsIPv6())).build());
mongod = mongodExe.start();
client = new MongoClient("localhost");
}
代码示例来源:origin: com.redhat.lightblue.mongo/lightblue-mongo-test
@Override
protected void before() throws IOException {
MongodStarter runtime = MongodStarter.getDefaultInstance();
IMongodConfig config = new MongodConfigBuilder().
version(getMongoVersion()).
net(new Net(getPort(), Network.localhostIsIPv6())).
build();
mongodExe = runtime.prepare(config);
try {
mongod = mongodExe.start();
} catch (IOException e) {
//Mongo failed to start for the previously stated reason. A single retry will be attempted.
mongod = mongodExe.start();
}
}
代码示例来源:origin: io.vertx/vertx-auth-mongo
@BeforeClass
public static void startMongo() throws Exception {
String uri = getConnectionString();
if (uri == null ) {
Version.Main version = Version.Main.V3_4;
int port = 27018;
System.out.println("Starting Mongo " + version + " on port " + port);
IMongodConfig config = new MongodConfigBuilder().
version(version).
net(new Net(port, Network.localhostIsIPv6())).
build();
exe = MongodStarter.getDefaultInstance().prepare(config);
exe.start();
} else {
System.out.println("Using existing Mongo " + uri);
}
}
代码示例来源:origin: io.vertx/vertx-service-discovery
@BeforeClass
public static void beforeClass() throws Exception {
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(
new MongodConfigBuilder().version(Version.V3_3_1)
.net(new Net(12345, Network.localhostIsIPv6()))
.build());
MongodProcess process = mongodExe.start();
await().until(() -> process != null);
}
代码示例来源:origin: io.vertx/vertx-service-discovery
@BeforeClass
public static void beforeClass() throws Exception {
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(
new MongodConfigBuilder().version(Version.V3_3_1)
.net(new Net(12345, Network.localhostIsIPv6()))
.build());
MongodProcess process = mongodExe.start();
await().until(() -> process != null);
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@BeforeClass
public static void beforeClass() throws Exception {
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(
new MongodConfigBuilder().version(Version.V3_3_1)
.net(new Net(12345, Network.localhostIsIPv6()))
.build());
MongodProcess process = mongodExe.start();
await().until(() -> process != null);
}
代码示例来源:origin: vert-x3/vertx-service-discovery
@BeforeClass
public static void beforeClass() throws Exception {
MongodStarter runtime = MongodStarter.getDefaultInstance();
mongodExe = runtime.prepare(
new MongodConfigBuilder().version(Version.V3_3_1)
.net(new Net(12345, Network.localhostIsIPv6()))
.build());
MongodProcess process = mongodExe.start();
await().until(() -> process != null);
}
内容来源于网络,如有侵权,请联系作者删除!