use of com.scalar.db.rpc.GetTableMetadataResponse in project scalardb by scalar-labs.
the class DistributedStorageAdminService method getTableMetadata.
@Override
public void getTableMetadata(GetTableMetadataRequest request, StreamObserver<GetTableMetadataResponse> responseObserver) {
execute(() -> {
TableMetadata tableMetadata = admin.getTableMetadata(request.getNamespace(), request.getTable());
GetTableMetadataResponse.Builder builder = GetTableMetadataResponse.newBuilder();
if (tableMetadata != null) {
builder.setTableMetadata(ProtoUtils.toTableMetadata(tableMetadata));
}
responseObserver.onNext(builder.build());
responseObserver.onCompleted();
}, responseObserver, "get_table_metadata");
}
use of com.scalar.db.rpc.GetTableMetadataResponse in project scalardb by scalar-labs.
the class GrpcAdminTest method getTableMetadata_IsCalledWithProperArguments_MetadataManagerShouldBeCalledProperly.
@Test
public void getTableMetadata_IsCalledWithProperArguments_MetadataManagerShouldBeCalledProperly() throws ExecutionException {
// Arrange
String namespace = "namespace";
String table = "table";
GetTableMetadataResponse response = mock(GetTableMetadataResponse.class);
when(stub.getTableMetadata(any())).thenReturn(response);
// Act
admin.getTableMetadata(namespace, table);
// Assert
verify(stub).getTableMetadata(any());
}
Aggregations