Search in sources :

Example 1 with IngestorWriteService

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();
}
Also used : IngestService(com.alibaba.graphscope.groot.ingestor.IngestService) IngestorWriteService(com.alibaba.graphscope.groot.ingestor.IngestorWriteService) WriteIngestorRequest(com.alibaba.maxgraph.proto.groot.WriteIngestorRequest) WriteIngestorResponse(com.alibaba.maxgraph.proto.groot.WriteIngestorResponse) IngestCallback(com.alibaba.graphscope.groot.ingestor.IngestCallback) Test(org.junit.jupiter.api.Test)

Aggregations

IngestCallback (com.alibaba.graphscope.groot.ingestor.IngestCallback)1 IngestService (com.alibaba.graphscope.groot.ingestor.IngestService)1 IngestorWriteService (com.alibaba.graphscope.groot.ingestor.IngestorWriteService)1 WriteIngestorRequest (com.alibaba.maxgraph.proto.groot.WriteIngestorRequest)1 WriteIngestorResponse (com.alibaba.maxgraph.proto.groot.WriteIngestorResponse)1 Test (org.junit.jupiter.api.Test)1