use of com.google.api.services.dataflow.model.WorkItemStatus in project beam by apache.
the class WorkItemStatusClientTest method reportSuccess.
@Test
public void reportSuccess() throws IOException {
when(worker.extractMetricUpdates()).thenReturn(Collections.emptyList());
statusClient.setWorker(worker, executionContext);
statusClient.reportSuccess();
verify(workUnitClient).reportWorkItemStatus(statusCaptor.capture());
WorkItemStatus workStatus = statusCaptor.getValue();
assertThat(workStatus.getWorkItemId(), equalTo(Long.toString(WORK_ID)));
assertThat(workStatus.getCompleted(), equalTo(true));
assertThat(workStatus.getReportIndex(), equalTo(INITIAL_REPORT_INDEX));
assertThat(workStatus.getErrors(), nullValue());
}
use of com.google.api.services.dataflow.model.WorkItemStatus in project beam by apache.
the class WorkItemStatusClientTest method populateProgress.
@Test
public void populateProgress() throws Exception {
WorkItemStatus status = new WorkItemStatus();
Progress progress = cloudProgressToReaderProgress(ReaderTestUtils.approximateProgressAtIndex(42L));
when(worker.getWorkerProgress()).thenReturn(progress);
statusClient.setWorker(worker, executionContext);
statusClient.populateProgress(status);
assertThat(status.getReportedProgress(), equalTo(ReaderTestUtils.approximateProgressAtIndex(42L)));
}
Aggregations