use of com.alibaba.graphscope.groot.ingestor.IngestorSnapshotService in project GraphScope by alibaba.
the class IngestorRpcTest method testIngestorSnapshotService.
@Test
void testIngestorSnapshotService() {
IngestService ingestService = mock(IngestService.class);
IngestorSnapshotService ingestorSnapshotService = new IngestorSnapshotService(ingestService);
AdvanceIngestSnapshotIdRequest req = AdvanceIngestSnapshotIdRequest.newBuilder().setSnapshotId(10L).build();
StreamObserver<AdvanceIngestSnapshotIdResponse> streamObserver = mock(StreamObserver.class);
doAnswer(invocation -> {
CompletionCallback<Long> callback = invocation.getArgument(1);
callback.onCompleted(9L);
return null;
}).when(ingestService).advanceIngestSnapshotId(anyLong(), any());
ingestorSnapshotService.advanceIngestSnapshotId(req, streamObserver);
verify(streamObserver).onNext(AdvanceIngestSnapshotIdResponse.newBuilder().setPreviousSnapshotId(9L).build());
verify(streamObserver).onCompleted();
}
Aggregations