コード例 #1
0
  /** tear down test fixture */
  @After
  public void tearDown() {
    // assert all downloads done after wait
    boolean allDownloadJobsDone = parallelDownloadService.waitTillAllDownloadJobsDone();

    if (!ConfigHolder.getInstance().isContinueOnError()) assertTrue(allDownloadJobsDone);
    // else isContinueOnError, so acceptable if not all jobs done due to errors

    // reset
    setContinueOnError(false);
  }
コード例 #2
0
  // random test (simulates random network errors for comprehensive test coverage of scenarios)
  @Test
  public void continuesOnRandomNetworkErrorsIfConfigured() throws Exception {
    printTestHeader("continuesOnExceptions");

    ConfigHolder.getInstance().setContinueOnError(true);
    ProgressWatcher.getInstance().setLogErrorsToFile(true);

    SmartsheetBackupService backupService =
        new SmartsheetBackupService(
            new ErrorContextualizingSmartsheetService(new StubBadConnectionSmartsheetService()),
            parallelDownloadService);

    backupToTempDir(backupService);

    if (ProgressWatcher.getInstance().getErrorCount() > 0) {
      String errorLogFile = ProgressWatcher.getInstance().getErrorLogFile();
      assertNotNull(errorLogFile);
      printErrorLogFilePathWhenDone(errorLogFile);
    }
  }
コード例 #3
0
 private static void setContinueOnError(boolean continueOnError) {
   ConfigHolder.getInstance().setContinueOnError(continueOnError);
   // the backup tool does setLogErrorsToFile true if continueOnError is true,
   // so simulate that behaviour by having the test do the same here:
   ProgressWatcher.getInstance().setLogErrorsToFile(continueOnError);
 }