.connectTimeout(10) .build(); MongoClient mongo = new MongoClient(new ServerAddress(mongoConfigList.get(0).net() .getServerAddress().getHostName(), mongoConfigList.get(0).net() .getPort()), mo); DB mongoAdminDB = mongo.getDB(ADMIN_DATABASE_NAME); DBObject host = new BasicDBObject(); host.put("_id", i++); host.put("host", mongoConfig.net().getServerAddress().getHostName() + ":" + mongoConfig.net().getPort()); members.add(host);
public Net net() { return mongodConfig.net(); }
public Net net() { return mongodConfig.net(); }
/** * @return A new Mongo client that is connected to the embedded MongoDB Server. * @throws UnknownHostException The hostname used was unknown. * @throws MongoException Couldn't create the client. */ public MongoClient newMongoClient() throws UnknownHostException, MongoException { return new MongoClient(new ServerAddress(mongodProcess.getConfig().net().getServerAddress(), mongodProcess.getConfig().net().getPort())); }
/** * @return A new Mongo client that is connected to the embedded MongoDB Server. * @throws UnknownHostException The hostname used was unknown. * @throws MongoException Couldn't create the client. */ public MongoClient newMongoClient() throws UnknownHostException, MongoException { return new MongoClient(new ServerAddress(mongodProcess.getConfig().net().getServerAddress(), mongodProcess.getConfig().net().getPort())); }
/** * @return The embedded Mongo DB's hostname. * @throws UnknownHostException The host couldn't be presented as a String. */ public String getMongoHostname() throws UnknownHostException { return EmbeddedMongoSingleton.getMongodConfig().net().getServerAddress().getHostAddress(); }
/** * @return The embedded Mongo DB's port. */ public int getMongoPort() { return EmbeddedMongoSingleton.getMongodConfig().net().getPort(); } }
@Configuration @EnableAutoConfiguration(exclude = { EmbeddedMongoAutoConfiguration.class }) public class MongoConfiguration { @Autowired private Environment environment; @Autowired private MongoProperties properties; @Autowired(required = false) private MongoClientOptions options; @Autowired private IMongodConfig mongoConfig; @Bean public MongoClient mongo() throws Exception { properties.setPort(mongoConfig.net().getPort()); return properties.createMongoClient(this.options, this.environment); } }
.connectTimeout(10) .build(); MongoClient mongo = new MongoClient(new ServerAddress(mongoConfigList.get(0).net() .getServerAddress().getHostName(), mongoConfigList.get(0).net() .getPort()), mo); DB mongoAdminDB = mongo.getDB(ADMIN_DATABASE_NAME); DBObject host = new BasicDBObject(); host.put("_id", i++); host.put("host", mongoConfig.net().getServerAddress().getHostName() + ":" + mongoConfig.net().getPort()); members.add(host);
/** * @return the port on which the db listens. */ public int getPort() { return mongodProcess.getConfig().net().getPort(); }
/** * @return the IP on which the db was bound. */ public String getBindIp() { return mongodProcess.getConfig().net().getBindIp(); }
.scriptName(scriptFile.getAbsolutePath()) .version(mongodConfig.version()) .net(mongodConfig.net()) .build()).start(); if (mongoOutput instanceof LogWatchStreamProcessor) {
.scriptName(scriptFile.getAbsolutePath()) .version(mongodConfig.version()) .net(mongodConfig.net()) .build()).start(); if (mongoOutput instanceof LogWatchStreamProcessor) {