@Override
    public void beforeClass(HiveTestEnvContext ctx) throws Exception {

      File tmpFolder = ctx.tmpFolder;
      String tmpFolderPath = tmpFolder.getAbsolutePath();

      // these are mostly copied from the root pom.xml
      System.setProperty("build.test.dir", tmpFolderPath);
      System.setProperty("derby.stream.error.file", tmpFolderPath + "/derby.log");
      System.setProperty("hadoop.bin.path", HIVE_ROOT + "/testutils/hadoop");
      System.setProperty("hadoop.log.dir", tmpFolderPath);
      System.setProperty("mapred.job.tracker", "local");
      System.setProperty("log4j.configurationFile", "file://" + tmpFolderPath + "/conf/hive-log4j2.properties");
      System.setProperty("log4j.debug", "true");
      System.setProperty("java.io.tmpdir", tmpFolderPath);
      System.setProperty("test.build.data", tmpFolderPath);
      System.setProperty("test.data.files", DATA_DIR + "/files");
      System.setProperty("test.data.dir", DATA_DIR + "/files");
      System.setProperty("test.tmp.dir", tmpFolderPath);
      System.setProperty("test.tmp.dir.uri", "file://" + tmpFolderPath);
      System.setProperty("test.dfs.mkdir", "-mkdir -p");
      System.setProperty("test.warehouse.dir", tmpFolderPath + "/warehouse"); // this is changed to be *under* tmp dir
      System.setProperty("test.src.tables", "src");
      System.setProperty("hive.jar.directory", tmpFolderPath);
    }
Helps in setting up environments to run high level hive tests

For a sample testcase see {@link TestHiveTestEnvSetup}!
Because setting up such a complex environment is a bit more sophisticated than it should;
this class introduces some helper concepts beyond what juni4 has

<ul>
 <li>parts are decomposed into smaller {@link IHiveTestRule}
 <li>{@link HiveTestEnvContext} is visible to every methodcall</li>
 <li>invocation order of before calls are "forward"
 <li>invocation order of before calls are "backward"
 </ul>


Later this should be migrated to junit5...when it will be possible; see HIVE-18495
ql/src/test/org/apache/hive/testutils/HiveTestEnvSetup.java