public Map<String, String> buildFromMongoProperties(MongoProperties mongoProps) { Map<String, String> props = Maps.newHashMap(); props.put("org.quartz.jobStore.class", "com.novemberain.quartz.mongodb.MongoDBJobStore"); props.put("org.quartz.threadPool.threadCount", "1"); if (uri == null) { Assert.notNull(mongoProps.getUri()); uri = mongoProps.getUri(); } String database = new MongoClientURI(uri).getDatabase(); Assert.notNull(database); props.put("org.quartz.jobStore.dbName", database); if (!StringUtils.isEmpty(collectionPrefix)) { props.put("org.quartz.jobStore.collectionPrefix", collectionPrefix); } props.put("org.quartz.jobStore.mongoUri", uri); return props; }
@Bean @Profile("!" + Constants.SPRING_PROFILE_FAST) public Mongeez mongeez() { log.debug("Configuring Mongeez"); Mongeez mongeez = new Mongeez(); mongeez.setFile(new ClassPathResource("/config/mongeez/master.xml")); mongeez.setMongo(mongo); mongeez.setDbName(mongoProperties.getDatabase()); mongeez.process(); return mongeez; }
@Before public void beforeEachTest() { CodecRegistry codecRegistry = CodecRegistries.fromRegistries( MongoClient.getDefaultCodecRegistry(), CodecRegistries.fromCodecs( new LocalDateTimeCodec(), new HostAndPortCodec(), new LocalDateTimeCodec())); MongoProperties properties = new MongoProperties(); MongoClient mongoClient = new MongoClient( new MongoClientURI( properties.getUri(), MongoClientOptions.builder().codecRegistry(codecRegistry))); mongoMetricsRepository = new MongoMetricsRepository(mongoClient, properties, new ObjectMapper()); mongoMetricsRepository.init(); metricsService = new MetricsService(mongoMetricsRepository); }
@Override protected String getDatabaseName() { return mongoProperties.getDatabase(); }