@Test
  public void testSystemPropertyPrecedence() {
    // Using property defined in HiveConf.ConfVars to test System property
    // overriding
    final String OVERRIDE_KEY = "hive.conf.restricted.list";
    try {
      HiveConf.setHiveSiteLocation(oldDefaultHiveSite);
      System.setProperty(OVERRIDE_KEY, "from.sysprop");
      HiveConf conf = new HiveConf();
      // ensure metatore site.xml does not get to override this
      assertEquals("from.sysprop", conf.get(OVERRIDE_KEY));

      // get HS2 site.xml loaded
      new HiveServer2();
      conf = new HiveConf();
      assertTrue(HiveConf.isLoadHiveServer2Config());
      // ensure hiveserver2 site.xml does not get to override this
      assertEquals("from.sysprop", conf.get(OVERRIDE_KEY));

    } finally {
      System.getProperties().remove(OVERRIDE_KEY);
    }
  }
Ensure that system properties still get precedence. Config params set as
-hiveconf on commandline get set as system properties They should have the
final say
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestServerSpecificConfig.java