@Test public void should_retry_export_if_cancelled_on_first_run() throws Exception { when(mDelegate.export(any(ReportExportOptions.class))).then(crashOnFirstRun()); reportExecution.export(EXPORT_CRITERIA); verify(mDelegate, times(2)).export(EXPORT_CRITERIA); }
@NotNull @Override public ReportExport export(@NotNull ReportExportOptions options) throws ServiceException { try { return mDelegate.export(options); } catch (ServiceException ex) { boolean isCancelled = (ex.code() == StatusCodes.EXPORT_EXECUTION_CANCELLED || ex.code() == StatusCodes.REPORT_EXECUTION_CANCELLED); if (isCancelled) { return mDelegate.export(options); } throw ex; } }
RetryReportExecution extends ReportExecution { @NotNull @Override public ReportExport export(@NotNull ReportExportOptions options) throws ServiceException { try { return mDelegate.export(options); } catch (ServiceException ex) { boolean isCancelled = (ex.code() == StatusCodes.EXPORT_EXECUTION_CANCELLED || ex.code() == StatusCodes.REPORT_EXECUTION_CANCELLED); if (isCancelled) { return mDelegate.export(options); } throw ex; } } }
RetryReportExecution extends ReportExecution { @NotNull @Override public ReportExport export(@NotNull ReportExportOptions options) throws ServiceException { try { return mDelegate.export(options); } catch (ServiceException ex) { boolean isCancelled = (ex.code() == StatusCodes.EXPORT_EXECUTION_CANCELLED || ex.code() == StatusCodes.REPORT_EXECUTION_CANCELLED); if (isCancelled) { return mDelegate.export(options); } throw ex; } } RetryReportExecution(ReportExecution delegate); }
RetryReportExecution extends ReportExecution { @NotNull @Override public ReportExport export(@NotNull ReportExportOptions options) throws ServiceException { try { return mDelegate.export(options); } catch (ServiceException ex) { boolean isCancelled = (ex.code() == StatusCodes.EXPORT_EXECUTION_CANCELLED || ex.code() == StatusCodes.REPORT_EXECUTION_CANCELLED); if (isCancelled) { return mDelegate.export(options); } throw ex; } } RetryReportExecution(ReportExecution delegate); @NotNull @Override ReportExport export(@NotNull ReportExportOptions options); @NotNull @Override ReportMetadata waitForReportCompletion(); @NotNull @Override ReportExecution updateExecution(@Nullable List<ReportParameter> newParameters); @NotNull @Override String getExecutionId(); }
RetryReportExecution extends ReportExecution { @NotNull @Override public ReportExport export(@NotNull ReportExportOptions options) throws ServiceException { try { return mDelegate.export(options); } catch (ServiceException ex) { boolean isCancelled = (ex.code() == StatusCodes.EXPORT_EXECUTION_CANCELLED || ex.code() == StatusCodes.REPORT_EXECUTION_CANCELLED); if (isCancelled) { return mDelegate.export(options); } throw ex; } } RetryReportExecution(ReportExecution delegate); @NotNull @Override ReportExport export(@NotNull ReportExportOptions options); @NotNull @Override ReportMetadata waitForReportCompletion(); @NotNull @Override ReportExecution updateExecution(@Nullable List<ReportParameter> newParameters); @NotNull @Override String getExecutionId();  }