public Mongo getMongo() throws UnknownHostException, MongoException { return new MongoClient(new ServerAddress(mongosProcess.getConfig().net() .getServerAddress(), mongosProcess.getConfig().net().getPort())); }
.build(); try (MongoClient mongo = new MongoClient( new ServerAddress(this.config.net().getServerAddress() .getHostName(), this.config.net().getPort()), options)) { DB mongoAdminDB = mongo.getDB(ADMIN_DATABASE_NAME); command += ","; command += mongodConfig.net().getServerAddress().getHostName() + ":" + mongodConfig.net().getPort();
.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 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(); }
/** * Creates a new Mongo connection. * * @throws MongoException * @throws UnknownHostException */ public Mongo newMongo() throws UnknownHostException, MongoException { return new MongoClient(new ServerAddress(mongosProcess.getConfig().net().getServerAddress(), mongosProcess.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())); }
/** * Creates a new Mongo connection. * */ public MongoClient newMongo() throws UnknownHostException { return new MongoClient(new ServerAddress(mongodProcess.getConfig().net().getServerAddress(), mongodProcess.getConfig().net().getPort())); }
public Mongo getMongo() throws UnknownHostException, MongoException { return new MongoClient(new ServerAddress(mongosProcess.getConfig().net() .getServerAddress(), mongosProcess.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())); }
protected final boolean sendStopToMongoInstance() { try { return Mongod.sendShutdown(getConfig().net().getServerAddress(), getConfig().net().getPort()); } catch (UnknownHostException e) { logger.error("sendStop", e); } return false; }
.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);
.build(); try (MongoClient mongo = new MongoClient( new ServerAddress(this.config.net().getServerAddress() .getHostName(), this.config.net().getPort()), options)) { DB mongoAdminDB = mongo.getDB(ADMIN_DATABASE_NAME); command += ","; command += mongodConfig.net().getServerAddress().getHostName() + ":" + mongodConfig.net().getPort();
public Mongo mongo(MongodProcess mongodProcess) throws IOException { Net net = mongodProcess.getConfig().net(); properties.setHost(net.getServerAddress().getHostName()); properties.setPort(net.getPort()); return properties.createMongoClient(this.options);
mongoProcess = mongoExecutable.start(); host = mongodConfig.net().getServerAddress().getHostAddress(); port = mongodConfig.net().getPort();