Search in sources :

Example 1 with IngestorSnapshotService

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();
}
Also used : IngestService(com.alibaba.graphscope.groot.ingestor.IngestService) AdvanceIngestSnapshotIdResponse(com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdResponse) AdvanceIngestSnapshotIdRequest(com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdRequest) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) IngestorSnapshotService(com.alibaba.graphscope.groot.ingestor.IngestorSnapshotService) Test(org.junit.jupiter.api.Test)

Aggregations

IngestService (com.alibaba.graphscope.groot.ingestor.IngestService)1 IngestorSnapshotService (com.alibaba.graphscope.groot.ingestor.IngestorSnapshotService)1 AdvanceIngestSnapshotIdRequest (com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdRequest)1 AdvanceIngestSnapshotIdResponse (com.alibaba.maxgraph.proto.groot.AdvanceIngestSnapshotIdResponse)1 Test (org.junit.jupiter.api.Test)1 ArgumentMatchers.anyLong (org.mockito.ArgumentMatchers.anyLong)1