de.flapdoodle.embed.mongo.config.MongodConfigBuilder.build()方法的使用及代码示例

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

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

MongodConfigBuilder.build介绍

暂无

代码示例

代码示例来源:origin: kaaproject/kaa

protected static IMongodConfig createMongodConfig(int port) throws Exception {
 return createMongodConfigBuilder(port).build();
}

代码示例来源:origin: spring-projects/spring-data-examples

return builder.build();
} catch (IOException e) {
  throw new RuntimeException(e);

代码示例来源:origin: de.flapdoodle.embed/de.flapdoodle.embed.mongo

protected IMongodConfig newMongodConfig(final IFeatureAwareVersion version) throws IOException {
  return new MongodConfigBuilder().version(version).build();
}

代码示例来源:origin: sakserv/hadoop-mini-clusters

@Override
public void configure() throws Exception {
  conf = new MongodConfigBuilder()
      .version(Version.Main.PRODUCTION)
      .net(new Net(ip, port, false))
      .build();
}

代码示例来源:origin: com.github.sakserv/hadoop-mini-clusters-mongodb

@Override
public void configure() throws Exception {
  conf = new MongodConfigBuilder()
      .version(Version.Main.PRODUCTION)
      .net(new Net(ip, port, false))
      .build();
}

代码示例来源:origin: org.apache.rya/mongodb.rya

private IMongodConfig newMongodConfig(final IFeatureAwareVersion version) throws UnknownHostException, IOException {
  final Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
  return new MongodConfigBuilder().version(version).net(net).build();
}

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

private IMongodConfig newMongodConfig(final IFeatureAwareVersion version) throws UnknownHostException, IOException {
  final Net net = new Net(findRandomOpenPortOnAllLocalInterfaces(), false);
  return new MongodConfigBuilder().version(version).net(net).build();
}

代码示例来源:origin: jirutka/embedmongo-spring

private IMongodConfig buildMongodConfig() throws IOException {
  return new MongodConfigBuilder()
      .version(version)
      .net(new Net(bindIp, getPort(), Network.localhostIsIPv6()))
      .build();
}

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

private IMongodConfig createConfiguration(String rsName, int p)
    throws IOException {
  return new MongodConfigBuilder()
      .version(Versions.withFeatures(() -> VERSION))
      .net(new Net(InetAddress.getLoopbackAddress().getHostAddress(), p, false))
      .replication(newStorage(p, rsName))
      // enable journal
      .cmdOptions(new MongoCmdOptionsBuilder().useNoJournal(false).build())
      .build();
}

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

相关文章