@Test
    public void testDbChange() throws Throwable {
    String scriptText =
        "DROP TABLE IF EXISTS result;\n" +
        "CREATE TABLE result (n int);\n" +
        "create database test_db1;\n" +
        "create database test_db2;\n" +
        "use test_db1; CREATE PROCEDURE f() BEGIN INSERT INTO default.result VALUES(42); END;\n" +
        "use test_db2; CREATE PROCEDURE f() BEGIN INSERT INTO default.result VALUES(43); END;\n" +
        "use test_db1; f();/\n" +
        "use test_db2; f();/\n" +
        "SELECT sum(n) FROM default.result; /\n";
    testScriptFile(scriptText, args(), "85");
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java