コード例 #1
0
  @Override
  protected MongoGraphDatabase createDatabase(Platform platform) throws Exception {
    IniMongoProperties properties = new IniMongoProperties();
    String host = properties.get("mongo.host", String.class).or("localhost");
    int port = properties.get("mongodb.port", Integer.class).or(27017);
    MongoClient client = new MongoClient(host, Integer.valueOf(port));
    DB db = client.getDB("geogit");
    db.dropDatabase();

    MongoConnectionManager manager = new MongoConnectionManager();
    ConfigDatabase config = new TestConfigDatabase(platform);
    MongoGraphDatabase mongoGraphDatabase = new MongoGraphDatabase(platform, manager, config);
    return mongoGraphDatabase;
  }
コード例 #2
0
  @Override
  protected MongoGraphDatabase createDatabase(Platform platform) throws Exception {
    final IniMongoProperties properties = new IniMongoProperties();
    final String uri = properties.get("mongodb.uri", String.class).or("mongodb://localhost:27017/");
    final String database = properties.get("mongodb.database", String.class).or("geogig");
    MongoClient client = new MongoClient(new MongoClientURI(uri));
    DB db = client.getDB(database);
    db.dropDatabase();

    MongoConnectionManager manager = new MongoConnectionManager();
    ConfigDatabase config = new TestConfigDatabase(platform);
    MongoGraphDatabase mongoGraphDatabase = new MongoGraphDatabase(manager, config);
    return mongoGraphDatabase;
  }