@Inject public MongoStore(SeyrenConfig seyrenConfig) { try { String uri = seyrenConfig.getMongoUrl(); MongoURI mongoUri = new MongoURI(uri); DB mongo = mongoUri.connectDB(); if (mongoUri.getUsername() != null) { mongo.authenticate(mongoUri.getUsername(), mongoUri.getPassword()); } this.mongo = mongo; } catch (Exception e) { throw new RuntimeException(e); } }
@Test public void defaultMongoUrlIsCorrect() { assertThat(config.getMongoUrl(), is("mongodb://localhost:27017/seyren")); }