@Test
  public void testDBLocationChange() throws IOException, TException {
    final String dbName = "alterDbLocation";
    String defaultUri = MetastoreConf.getVar(conf, ConfVars.WAREHOUSE) + "/default_location.db";
    String newUri = MetastoreConf.getVar(conf, ConfVars.WAREHOUSE) + "/new_location.db";

    new DatabaseBuilder()
        .setName(dbName)
        .setLocation(defaultUri)
        .create(client, conf);

    Database db = client.getDatabase(dbName);

    assertEquals("Incorrect default location of the database",
        warehouse.getDnsPath(new Path(defaultUri)).toString(), db.getLocationUri());

    db.setLocationUri(newUri);
    client.alterDatabase(dbName, db);

    db = client.getDatabase(dbName);

    assertEquals("Incorrect new location of the database",
        warehouse.getDnsPath(new Path(newUri)).toString(), db.getLocationUri());

    client.dropDatabase(dbName);
    silentDropDatabase(dbName);
  }
Test table objects can be retrieved in batches
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java