Пример #1
0
 @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);
   }
 }
Пример #2
0
 @Test
 public void defaultMongoUrlIsCorrect() {
   assertThat(config.getMongoUrl(), is("mongodb://localhost:27017/seyren"));
 }