@Override
      public Statement apply(final Statement base, Description description) {
        return new Statement() {
          @Override
          public void evaluate() throws Throwable {
            metaStoreHandler.setSystemProperties(); // for QTestUtil pre-initialization
            CliAdapter.this.beforeClass(); // instantiating QTestUtil

            LOG.debug("will initialize metastore database in class rule");
            metaStoreHandler.getRule().before();
            metaStoreHandler.getRule().install();

            if (getQt() != null) {
              metaStoreHandler.setMetaStoreConfiguration(getQt().getConf());
              getQt().postInit();
              getQt().newSession();
              getQt().createSources();
            }

            CliAdapter.this.beforeClassSpec();
            try {
              base.evaluate();
            } finally {
              CliAdapter.this.shutdown();
              if (getQt() != null && firstTestNotYetRun) {
                LOG.debug("will destroy metastore database in class 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