Search in sources :

Example 1 with SchemaService

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

the class CoordinatorRpcTest method testSchemaService.

@Test
void testSchemaService() {
    SchemaManager schemaManager = mock(SchemaManager.class);
    doAnswer(invocationOnMock -> {
        CompletionCallback<Long> callback = invocationOnMock.getArgument(3);
        callback.onCompleted(10L);
        callback.onError(new DdlException("test_exception"));
        return null;
    }).when(schemaManager).submitBatchDdl(eq("test_req"), eq("test_session"), any(), any());
    SchemaService schemaService = new SchemaService(schemaManager);
    StreamObserver<SubmitBatchDdlResponse> streamObserver = mock(StreamObserver.class);
    schemaService.submitBatchDdl(SubmitBatchDdlRequest.newBuilder().setRequestId("test_req").setSessionId("test_session").build(), streamObserver);
    verify(streamObserver).onNext(SubmitBatchDdlResponse.newBuilder().setSuccess(true).setDdlSnapshotId(10L).build());
    verify(streamObserver).onNext(SubmitBatchDdlResponse.newBuilder().setSuccess(false).setMsg("test_exception").build());
    verify(streamObserver, times(2)).onCompleted();
}
Also used : DdlException(com.alibaba.graphscope.groot.schema.request.DdlException) SchemaService(com.alibaba.graphscope.groot.coordinator.SchemaService) Test(org.junit.jupiter.api.Test)

Aggregations

SchemaService (com.alibaba.graphscope.groot.coordinator.SchemaService)1 DdlException (com.alibaba.graphscope.groot.schema.request.DdlException)1 Test (org.junit.jupiter.api.Test)1