@Test
  public void timeUnits() throws IOException {
    conf = MetastoreConf.newMetastoreConf();

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30s");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.SECONDS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30seconds");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.SECONDS));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30ms");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MILLISECONDS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30msec");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MILLISECONDS));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30us");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MICROSECONDS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30usec");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MICROSECONDS));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30m");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MINUTES));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30minutes");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.MINUTES));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30ns");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.NANOSECONDS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30nsec");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.NANOSECONDS));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30h");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.HOURS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30hours");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.HOURS));

    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30d");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.DAYS));
    conf.set(MetastoreConf.ConfVars.TIME_TEST_ENTRY.getVarname(), "30days");
    Assert.assertEquals(30, MetastoreConf.getTimeVar(conf, ConfVars.TIME_TEST_ENTRY,
        TimeUnit.DAYS));
  }
Verify that a config can be set with a deprecated key/name.
standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/conf/TestMetastoreConf.java