@Test public void test() throws IOException { MongoDataSource ds = new MongoDataSource(getConnectionString()); Mongo mongo = ds.getMongoInstance(); DBCollection propertiesCollection = mongo.getDB(CMSConsts.SYS_DB) .getCollection(CMSConsts.PROPERTIES_COLLECTION); propertiesCollection.drop(); propertiesCollection.insert(new BasicDBObject().append("key1", "value1")); propertiesCollection.insert(new BasicDBObject().append("key2", 20)); propertiesCollection.insert(new BasicDBObject().append("key4", 20l)); CMSProperties cmsProperties = new CMSProperties(ds); Assert.assertEquals("value1", cmsProperties.get("key1")); Assert.assertEquals(Integer.valueOf(20), cmsProperties.get("key2")); Assert.assertNull(cmsProperties.get("key3")); Assert.assertNull(cmsProperties.get("key3")); Assert.assertNotNull(cmsProperties.get("key4")); CMSDBConfig dbConfig = new CMSDBConfig(ds); Assert.assertEquals("value1", dbConfig.get("key1")); Assert.assertEquals(20, dbConfig.get("key2")); Assert.assertEquals(1500, dbConfig.get(CMSDBConfig.MONGO_LOCK_RENEW_PERIOD)); Assert.assertNull(dbConfig.get("non exist key")); }
public Object get(String key) { return currentConfiguration.get(key); }
CMSDBConfig { public Object get(String key) { return currentConfiguration.get(key); } }
CMSDBConfig { public Object get(String key) { return currentConfiguration.get(key); } CMSDBConfig(MongoDataSource ds); }
CMSDBConfig { public Object get(String key) { return currentConfiguration.get(key); } CMSDBConfig(MongoDataSource ds); Object get(String key); Set<String> getConfigName(); Map<String, Object> loadAndGet(); Map<String, Object> getCurrentConfiguration(); void updateConfig(Map<String, Object> configs); }
CMSDBConfig { public Object get(String key) { return currentConfiguration.get(key); } CMSDBConfig(MongoDataSource ds); Object get(String key); Set<String> getConfigName(); Map<String, Object> loadAndGet(); Map<String, Object> getCurrentConfiguration(); void updateConfig(Map<String, Object> configs); static final String REPOSITORY_CACHE_SIZE_KEY; static final String REPOSITORY_CACHE_EXPIRE_SECONDS_KEY; static final String COLLECTION_COUNT_CACHE_SIZE_KEY; static final String COLLECTION_COUNT_CACHE_EXPIRE_SECONDS_KEY; static final String METADATA_LOCK_TYPE; static final String METADATA_LOCK_NAME; static final String MONGO_LOCK_EXPIRED_TIME; static final String MONGO_LOCK_RENEW_PERIOD; static final String MONGO_CONNECTION_PER_HOST; static final String MONGO_CONNECTION_POOL_NUM; static final String MONGO_CONNECTION_SOCKET_TIMEOUT; static final String HISTORY_COLLECTION_SIZE; static final String SUB_BRANCH_COLLECTION_SIZE; static final String TOP_QUERY_SNAPTSHOT_PERIOD; static final String TOP_QUERY_METRIC_SIZE; static final String TIME_WINDOW_SNAPSHOT_PERIOD; static final String TIME_WINDOW_BUCKET_IN_SECONDS; static final String MONGO_METRIC_SNAPSHOT_PERIOD; static final String MONGO_METRIC_LISTDB_WAIT; static final String METRIC_MAX_VALUE; static final String SLOT_COUNT; static final String THROTTLING_CHECK_ENABLED; static final String THROTTLING_EXPRESSION; static final String THROTTLING_CHECK_PERIOD; static final String RATE_LIMIT_CHECK_ENABLED; static final String HEAP_MEMORY_USAGE_CHECK_PERIOD; static final String HEALTHY_EXPRESSION; static final String HEALTHY_CHECK_PERIOD; static final String SYS_SHOW_STACK_TRACE_PROP; static final String SYS_ALLOW_FULL_TABLE_SCAN; static final String SYS_ALLOW_METADATA_DELETE; static final String SYS_ALLOW_REPOSITORY_DELETE; static final String SYS_NOTIFICATION_READ_THREADS_NUM; static final String SYS_NOTIFICATION_WRITE_THREADS_NUM; static final String JS_EXPRESSION_TIMEOUT_IN_SECONDS; static final String SYS_WRITE_CONCERN; static final String SYS_DAL_DEFAULT_IMPLEMENTATION; static final String SYS_DAL_MIGRATION_DUAL_WRITE; static final String SYS_LIMIT_JOINED_COLLECTIONS; static final String SYS_LIMIT_DOCUMENTS_MONGO_QUERY; static final String SYS_LIMIT_MEMORY_MONGO_QUERY; static final String SYS_LIMIT_MEMORY_MONGO_QUERY_SAMPLING_RATIO; static final String SYS_QUERY_PAGINATION_MODE; static final String DEFAULT_SYS_LIMIT_MAX_REPOSITORY_SIZE; static final String DEFAULT_SYS_LIMIT_MAX_INDEXES_NUM; static final String DEFAULT_SYS_LIMIT_MAX_INDEXED_ARRAY_SIZE; static final String DEFAULT_SYS_LIMIT_MAX_DOCUMENT_SIZE; }