@Override
      public Statement apply(final Statement base, Description description) {
        return new Statement() {
          @Override
          public void evaluate() throws Throwable {

            if (getQt() != null && !firstTestNotYetRun) {
              LOG.debug("will initialize metastore database in test rule");
              metaStoreHandler.setMetaStoreConfiguration(getQt().getConf());
              metaStoreHandler.beforeTest();
            }
            firstTestNotYetRun = false;

            if (getQt() != null && CliAdapter.this.shouldRunCreateScriptBeforeEveryTest()){
              // it's because some drivers still use init scripts, which can create a non-dataset table
              // and get cleant after every test
              getQt().createSources();
            }
            CliAdapter.this.setUp();
            try {
              base.evaluate();
            } finally {
              CliAdapter.this.tearDown();
              if (getQt() != null) {
                LOG.debug("will destroy metastore database in test rule (if not derby)");
                metaStoreHandler.afterTest(getQt());
              }
            }
          }
        };
      }
This class adapts old vm test-executors to be executed in multiple instances
itests/util/src/main/java/org/apache/hadoop/hive/cli/control/CliAdapter.java