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();
}
Aggregations