use of com.alibaba.graphscope.groot.ingestor.IngestorWriteService in project GraphScope by alibaba.
the class IngestorRpcTest method testIngestorWriteService.
@Test
void testIngestorWriteService() {
IngestService ingestService = mock(IngestService.class);
IngestorWriteService ingestorWriteService = new IngestorWriteService(ingestService);
WriteIngestorRequest req = WriteIngestorRequest.newBuilder().setQueueId(2).setRequestId("test_req").setOperationBatch(OperationBatch.newBuilder().build().toProto()).build();
doAnswer(invocation -> {
IngestCallback callback = invocation.getArgument(3);
callback.onSuccess(10L);
return null;
}).when(ingestService).ingestBatch(eq("test_req"), eq(2), eq(OperationBatch.newBuilder().build()), any());
StreamObserver<WriteIngestorResponse> observer = mock(StreamObserver.class);
ingestorWriteService.writeIngestor(req, observer);
verify(observer).onNext(WriteIngestorResponse.newBuilder().setSnapshotId(10L).build());
verify(observer).onCompleted();
}
Aggregations