Search in sources :

Example 1 with IngestProgressService

use of com.alibaba.graphscope.groot.coordinator.IngestProgressService in project GraphScope by alibaba.

the class IngestProgressServiceTest method testIngestProgressService.

@Test
void testIngestProgressService() {
    SnapshotManager snapshotManager = mock(SnapshotManager.class);
    when(snapshotManager.getTailOffsets(Arrays.asList(1))).thenReturn(Arrays.asList(10L));
    IngestProgressService ingestProgressService = new IngestProgressService(snapshotManager);
    GetTailOffsetsRequest request = GetTailOffsetsRequest.newBuilder().addQueueId(1).build();
    ingestProgressService.getTailOffsets(request, new StreamObserver<GetTailOffsetsResponse>() {

        @Override
        public void onNext(GetTailOffsetsResponse response) {
            List<Long> offsetsList = response.getOffsetsList();
            assertEquals(offsetsList.size(), 1);
            assertEquals(offsetsList.get(0), 10L);
        }

        @Override
        public void onError(Throwable t) {
            throw new RuntimeException(t);
        }

        @Override
        public void onCompleted() {
        }
    });
    verify(snapshotManager).getTailOffsets(Arrays.asList(1));
}
Also used : List(java.util.List) GetTailOffsetsRequest(com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest) GetTailOffsetsResponse(com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse) SnapshotManager(com.alibaba.graphscope.groot.coordinator.SnapshotManager) IngestProgressService(com.alibaba.graphscope.groot.coordinator.IngestProgressService) Test(org.junit.jupiter.api.Test)

Aggregations

IngestProgressService (com.alibaba.graphscope.groot.coordinator.IngestProgressService)1 SnapshotManager (com.alibaba.graphscope.groot.coordinator.SnapshotManager)1 GetTailOffsetsRequest (com.alibaba.maxgraph.proto.groot.GetTailOffsetsRequest)1 GetTailOffsetsResponse (com.alibaba.maxgraph.proto.groot.GetTailOffsetsResponse)1 List (java.util.List)1 Test (org.junit.jupiter.api.Test)1