@Test
  public void testAtlasLoadMetrics() throws Exception {
    Mockito.when(work.getMetricCollector()).thenReturn(metricCollector);
    atlasLoadTask = new AtlasLoadTask(conf, work);
    AtlasLoadTask atlasLoadTaskSpy = Mockito.spy(atlasLoadTask);
    Mockito.when(conf.getBoolVar(HiveConf.ConfVars.HIVE_IN_TEST_REPL)).thenReturn(true);
    Logger logger = LoggerFactory.getLogger("ReplState");
    StringAppender appender = StringAppender.createStringAppender(null);
    appender.addToLogger(logger.getName(), Level.INFO);
    appender.start();
    AtlasReplInfo atlasReplInfo = new AtlasReplInfo("http://localhost:21000/atlas", "srcDB",
        "tgtDB", "srcCluster", "tgtCluster", new Path("hdfs://tmp"), null, conf);
    atlasReplInfo.setSrcFsUri("hdfs://srcFsUri:8020");
    atlasReplInfo.setTgtFsUri("hdfs:tgtFsUri:8020");
    Mockito.doReturn(atlasReplInfo).when(atlasLoadTaskSpy).createAtlasReplInfo();
    int status = atlasLoadTaskSpy.execute();
    Assert.assertEquals(0, status);
    String logStr = appender.getOutput();
    Assert.assertEquals(2, StringUtils.countMatches(logStr, "REPL::"));
    Assert.assertTrue(logStr.contains("ATLAS_LOAD_START"));
    Assert.assertTrue(logStr.contains("ATLAS_LOAD_END"));
    Assert.assertTrue(logStr.contains("{\"sourceDbName\":\"srcDB\",\"targetDbName\":\"tgtDB\",\"loadStartTime\":"));
    Assert.assertTrue(logStr.contains("{\"sourceDbName\":\"srcDB\",\"targetDbName\""
            + ":\"tgtDB\",\"numOfEntities\":0,\"loadEndTime\""));
    appender.removeFromLogger(logger.getName());
  }
Unit test class for testing Atlas metadata load.
ql/src/test/org/apache/hadoop/hive/ql/exec/repl/TestAtlasLoadTask.java