private void updateTableNameInDB(String oldTableName, String newTableName) throws SQLException {
    String connectionStr = MetastoreConf.getVar(conf, ConfVars.CONNECT_URL_KEY);

    Connection conn = DriverManager.getConnection(connectionStr);
    PreparedStatement stmt = conn.prepareStatement("UPDATE TBLS SET tbl_name = '" +
        newTableName + "' WHERE tbl_name = '" + oldTableName + "'");
    stmt.executeUpdate();
  }
This method simulates another Hive metastore renaming a table, by accessing the db and
updating the name.

Unfortunately, derby cannot be run in two different JVMs simultaneously, but the only way
to rename without having it put in this client's cache is to run a metastore in a separate JVM,
so this simulation is required.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java