@Test
  public void testFallbackToDeprecatedConfig() throws Exception {

    Configuration conf = new Configuration();

    jsonReportFile = new File(workDir, "json_reporting");
    jsonReportFile.delete();

    conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, "local");
    conf.set(MetastoreConf.ConfVars.METRICS_CLASS.getHiveName(), CodahaleMetrics.class.getCanonicalName());
    conf.set(MetastoreConf.ConfVars.HIVE_METRICS_REPORTER.getHiveName(), "JMX, JSON");
    conf.set(MetastoreConf.ConfVars.METRICS_JSON_FILE_LOCATION.getHiveName(), jsonReportFile.toString());
    conf.setTimeDuration(MetastoreConf.ConfVars.METRICS_JSON_FILE_INTERVAL.getHiveName(), 100,
        TimeUnit.MILLISECONDS);

    MetricsFactory.init(conf);

    int runs = 5;
    for (int i = 0; i < runs; i++) {
      MetricsFactory.getInstance().incrementCounter("count2");
    }

    // we expect json file to be updated
    byte[] jsonData = MetricsTestUtils.getFileData(jsonReportFile.getAbsolutePath(), 2000, 3);
    ObjectMapper objectMapper = new ObjectMapper();

    JsonNode rootNode = objectMapper.readTree(jsonData);
    JsonNode countersNode = rootNode.path("counters");
    JsonNode methodCounterNode = countersNode.path("count2");
    JsonNode countNode = methodCounterNode.path("count");
    Assert.assertEquals(countNode.asInt(), 5);
  }
Tests that the deprecated HIVE_METRICS_REPORTER config is used if the HIVE_CODAHALE_METRICS_REPORTER_CLASSES is missing.
standalone-metastore/metastore-common/src/test/java/org/apache/hadoop/hive/common/metrics/metrics2/TestCodahaleReportersConf.java