コード例 #1
0
    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;
    }
コード例 #2
0
 @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;
 }
コード例 #3
0
  @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);
  }
コード例 #4
0
 @Override
 protected String getDatabaseName() {
   return mongoProperties.getDatabase();
 }