Search in sources :

Example 1 with StoreWriteClient

use of com.alibaba.graphscope.groot.ingestor.StoreWriteClient in project GraphScope by alibaba.

the class IngestorRpcTest method testStoreWriteClient.

@Test
void testStoreWriteClient() {
    StoreWriteGrpc.StoreWriteStub stub = mock(StoreWriteGrpc.StoreWriteStub.class);
    StoreWriteClient client = new StoreWriteClient(stub);
    CompletionCallback callback = mock(CompletionCallback.class);
    doAnswer(invocation -> {
        StreamObserver<WriteStoreResponse> observer = invocation.getArgument(1);
        observer.onNext(WriteStoreResponse.newBuilder().setSuccess(true).build());
        return null;
    }).when(stub).writeStore(any(), any());
    client.writeStore(Arrays.asList(StoreDataBatch.newBuilder().requestId("test_req").build()), callback);
    verify(callback).onCompleted(10);
}
Also used : WriteStoreResponse(com.alibaba.maxgraph.proto.groot.WriteStoreResponse) StoreWriteGrpc(com.alibaba.maxgraph.proto.groot.StoreWriteGrpc) CompletionCallback(com.alibaba.graphscope.groot.CompletionCallback) StoreWriteClient(com.alibaba.graphscope.groot.ingestor.StoreWriteClient) Test(org.junit.jupiter.api.Test)

Aggregations

CompletionCallback (com.alibaba.graphscope.groot.CompletionCallback)1 StoreWriteClient (com.alibaba.graphscope.groot.ingestor.StoreWriteClient)1 StoreWriteGrpc (com.alibaba.maxgraph.proto.groot.StoreWriteGrpc)1 WriteStoreResponse (com.alibaba.maxgraph.proto.groot.WriteStoreResponse)1 Test (org.junit.jupiter.api.Test)1