@Override public boolean dropDatabase(String catName, String dbName) throws NoSuchObjectException, MetaException {
    boolean succ = rawStore.dropDatabase(catName, dbName);
    if (succ && !canUseEvents) {
      // in case of event based cache update, cache will be updated during commit.
      sharedCache
          .removeDatabaseFromCache(StringUtils.normalizeIdentifier(catName), StringUtils.normalizeIdentifier(dbName));
    }
    return succ;
  }
@Test public void testDropDatabase() throws Exception {
    Configuration conf = MetastoreConf.newMetastoreConf();
    MetastoreConf.setBoolVar(conf, MetastoreConf.ConfVars.HIVE_IN_TEST, true);
    MetastoreConf.setVar(conf, MetastoreConf.ConfVars.CACHED_RAW_STORE_MAX_CACHE_MEMORY, "-1Kb");
    MetaStoreTestUtils.setConfForStandloneMode(conf);
    CachedStore cachedStore = new CachedStore();
    CachedStore.clearSharedCache();
    cachedStore.setConfForTest(conf);
    ObjectStore objectStore = (ObjectStore) cachedStore.getRawStore();
    // Add a db via ObjectStore
    String dbName = "testDropDatabase";
    String dbOwner = "user1";
    Database db = createDatabaseObject(dbName, dbOwner);
    objectStore.createDatabase(db);
    db = objectStore.getDatabase(DEFAULT_CATALOG_NAME, dbName);
    // Prewarm CachedStore
    CachedStore.setCachePrewarmedState(false);
    CachedStore.prewarm(objectStore);
    // Read database via CachedStore
    Database dbRead = cachedStore.getDatabase(DEFAULT_CATALOG_NAME, dbName);
    Assert.assertEquals(db, dbRead);
    List<String> allDatabases = cachedStore.getAllDatabases(DEFAULT_CATALOG_NAME);
    Assert.assertEquals(3, allDatabases.size());
    // Drop db via CachedStore
    cachedStore.dropDatabase(DEFAULT_CATALOG_NAME, dbName);
    // Read via ObjectStore
    allDatabases = objectStore.getAllDatabases(DEFAULT_CATALOG_NAME);
    Assert.assertEquals(2, allDatabases.size());
    // Create another db via CachedStore and drop via ObjectStore
    String dbName1 = "testDropDatabase1";
    Database localDb1 = createDatabaseObject(dbName1, dbOwner);
    cachedStore.createDatabase(localDb1);
    localDb1 = cachedStore.getDatabase(DEFAULT_CATALOG_NAME, dbName1);
    // Read db via ObjectStore
    dbRead = objectStore.getDatabase(DEFAULT_CATALOG_NAME, dbName1);
    Assert.assertEquals(localDb1, dbRead);
    allDatabases = cachedStore.getAllDatabases(DEFAULT_CATALOG_NAME);
    Assert.assertEquals(3, allDatabases.size());
    objectStore.dropDatabase(DEFAULT_CATALOG_NAME, dbName1);
    updateCache(cachedStore);
    updateCache(cachedStore);
    allDatabases = cachedStore.getAllDatabases(DEFAULT_CATALOG_NAME);
    Assert.assertEquals(2, allDatabases.size());
    cachedStore.shutdown();
  }