@Test
  public void cacheAll() throws Exception {
    // Set the config value to empty string, which should result in all catalogs being cached.
    Configuration newConf = new Configuration(conf);
    MetastoreConf.setVar(newConf, MetastoreConf.ConfVars.CATALOGS_TO_CACHE, "");
    cachedStore = new CachedStore();
    cachedStore.setConf(newConf);
    CachedStore.stopCacheUpdateService(1);
    objectStore.setConf(newConf); // have to override it with the new conf since this is where
                                  // prewarm gets the conf object
    cachedStore.resetCatalogCache();

    CachedStore.prewarm(objectStore);

    // All the catalogs should be cached
    List<String> cachedCatalogs = cachedStore.getCatalogs();
    Assert.assertEquals(3, cachedCatalogs.size());
    cachedCatalogs.sort(Comparator.naturalOrder());
    Assert.assertEquals(CAT1_NAME, cachedCatalogs.get(0));
    Assert.assertEquals(CAT2_NAME, cachedCatalogs.get(1));
    Assert.assertEquals(Warehouse.DEFAULT_CATALOG_NAME, cachedCatalogs.get(2));
  }
Tests that catalogs are properly cached.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/cache/TestCatalogCaching.java