@Test
  public void testRetryingClientTimeBasedExhausted() throws AtlasServiceException {
    AtlasClientV2 atlasClientV2 = mock(AtlasClientV2.class);
    AtlasExportRequest exportRequest = mock(AtlasExportRequest.class);
    AtlasServiceException atlasServiceException = mock(AtlasServiceException.class);
    when(atlasServiceException.getMessage()).thenReturn("import or export is in progress");
    when(atlasClientV2.exportData(any(AtlasExportRequest.class))).thenThrow(atlasServiceException);
    when(exportRequest.toString()).thenReturn("dummyExportRequest");
    setupConfForRetry();
    AtlasRestClient atlasClient = new AtlasRestClientImpl(atlasClientV2, conf);
    AtlasRestClientImpl atlasRestClientImpl = (AtlasRestClientImpl)atlasClient;
    InputStream inputStream = null;
    try {
      inputStream = atlasRestClientImpl.exportData(exportRequest);
      Assert.fail("Should have thrown SemanticException.");
    } catch (SemanticException ex) {
      Assert.assertTrue(ex.getMessage().contains("Retry exhausted for retryable error code"));
      Assert.assertTrue(atlasServiceException == ex.getCause());
    }
    ArgumentCaptor<AtlasExportRequest> expReqCaptor = ArgumentCaptor.forClass(AtlasExportRequest.class);
    verify(atlasClientV2, times(3)).exportData(expReqCaptor.capture());
    for (AtlasExportRequest atlasExportRequest: expReqCaptor.getAllValues()) {
      Assert.assertEquals(atlasExportRequest.toString(), "dummyExportRequest");
    }
    Assert.assertTrue(inputStream == null);
  }
Unit test class for testing Atlas metadata Dump.
ql/src/test/org/apache/hadoop/hive/ql/exec/repl/TestAtlasDumpTask.java