use of org.apache.beam.sdk.io.gcp.spanner.changestreams.dao.ChangeStreamResultSet in project beam by apache.
the class QueryChangeStreamActionTest method testQueryChangeStreamWithStreamFinished.
@Test
public void testQueryChangeStreamWithStreamFinished() {
final ChangeStreamResultSet changeStreamResultSet = mock(ChangeStreamResultSet.class);
when(changeStreamDao.changeStreamQuery(PARTITION_TOKEN, PARTITION_START_TIMESTAMP, PARTITION_END_TIMESTAMP, PARTITION_HEARTBEAT_MILLIS)).thenReturn(changeStreamResultSet);
when(changeStreamResultSet.next()).thenReturn(false);
when(watermarkEstimator.currentWatermark()).thenReturn(WATERMARK);
when(restrictionTracker.tryClaim(PARTITION_END_MICROS)).thenReturn(true);
final ProcessContinuation result = action.run(partition, restrictionTracker, outputReceiver, watermarkEstimator, bundleFinalizer);
assertEquals(ProcessContinuation.stop(), result);
verify(partitionMetadataDao).updateWatermark(PARTITION_TOKEN, WATERMARK_TIMESTAMP);
verify(partitionMetadataDao).updateToFinished(PARTITION_TOKEN);
verify(dataChangeRecordAction, never()).run(any(), any(), any(), any(), any());
verify(heartbeatRecordAction, never()).run(any(), any(), any(), any());
verify(childPartitionsRecordAction, never()).run(any(), any(), any(), any());
}
Aggregations