@Test public void testWaitForReportReady_completed() throws ApiException, RemoteException, InterruptedException { ReportDownloader downloader = new ReportDownloader(reportService, 1); when(reportService.getReportJobStatus(Matchers.anyLong())) .thenReturn(ReportJobStatus.COMPLETED); assertTrue(downloader.waitForReportReady()); }
public boolean waitForReportReady() throws RemoteException, InterruptedException { ReportJobStatus status = reportService.getReportJobStatus(reportJobId); while (status == ReportJobStatus.IN_PROGRESS) { sleeper.sleep(SLEEP_TIMER); status = reportService.getReportJobStatus(reportJobId); } return status == ReportJobStatus.COMPLETED; }
ReportDownloader { public boolean waitForReportReady() throws RemoteException, InterruptedException { ReportJobStatus status = reportService.getReportJobStatus(reportJobId); while (status == ReportJobStatus.IN_PROGRESS) { sleeper.sleep(SLEEP_TIMER); status = reportService.getReportJobStatus(reportJobId); } return status == ReportJobStatus.COMPLETED; } }
ReportDownloader { public boolean waitForReportReady() throws RemoteException, InterruptedException { ReportJobStatus status = reportService.getReportJobStatus(reportJobId); while (status == ReportJobStatus.IN_PROGRESS) { sleeper.sleep(SLEEP_TIMER); status = reportService.getReportJobStatus(reportJobId); } return status == ReportJobStatus.COMPLETED; } ReportDownloader(ReportServiceInterface reportService, long reportJobId); @VisibleForTesting  ReportDownloader(ReportServiceInterface reportService, long reportJobId, Sleeper sleeper); }
ReportDownloader { public boolean waitForReportReady() throws RemoteException, InterruptedException { ReportJobStatus status = reportService.getReportJobStatus(reportJobId); while (status == ReportJobStatus.IN_PROGRESS) { sleeper.sleep(SLEEP_TIMER); status = reportService.getReportJobStatus(reportJobId); } return status == ReportJobStatus.COMPLETED; } ReportDownloader(ReportServiceInterface reportService, long reportJobId); @VisibleForTesting  ReportDownloader(ReportServiceInterface reportService, long reportJobId, Sleeper sleeper); Thread whenReportReady(final ReportCallback callback); boolean waitForReportReady(); URL getDownloadUrl(ReportDownloadOptions options); CharSource getReportAsCharSource(ReportDownloadOptions options); }
ReportDownloader { public boolean waitForReportReady() throws RemoteException, InterruptedException { ReportJobStatus status = reportService.getReportJobStatus(reportJobId); while (status == ReportJobStatus.IN_PROGRESS) { sleeper.sleep(SLEEP_TIMER); status = reportService.getReportJobStatus(reportJobId); } return status == ReportJobStatus.COMPLETED; } ReportDownloader(ReportServiceInterface reportService, long reportJobId); @VisibleForTesting  ReportDownloader(ReportServiceInterface reportService, long reportJobId, Sleeper sleeper); Thread whenReportReady(final ReportCallback callback); boolean waitForReportReady(); URL getDownloadUrl(ReportDownloadOptions options); CharSource getReportAsCharSource(ReportDownloadOptions options); static final Charset REPORT_CHARSET; static final int SLEEP_TIMER; }