de.flapdoodle.embed.mongo.MongodStarter.prepare()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中de.flapdoodle.embed.mongo.MongodStarter.prepare()方法的一些代码示例,展示了MongodStarter.prepare()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MongodStarter.prepare()方法的具体详情如下:
包路径:de.flapdoodle.embed.mongo.MongodStarter
类名称:MongodStarter
方法名:prepare

MongodStarter.prepare介绍

暂无

代码示例

代码示例来源: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: spring-projects/spring-data-examples

.build();
MongodStarter starter = MongodStarter.getInstance(runtimeConfig);
MongodExecutable mongodExe = starter.prepare(mongoConfig);
MongodProcess process = mongodExe.start();
mongodProcessList.add(process);

代码示例来源: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: apache/jackrabbit-oak

public synchronized void start() throws IOException {
  if (process != null) {
    throw new IllegalStateException("Already started");
  }
  process = starter.prepare(config).start();
}

代码示例来源: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: 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: 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: 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: 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: 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: 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);
}

相关文章

微信公众号

最新文章

更多