use of com.scalar.db.rpc.GetTableMetadataRequest in project scalardb by scalar-labs.
the class DistributedStorageAdminServiceTest method getTableMetadata_IsCalledWithProperArguments_AdminShouldBeCalledProperly.
@Test
public void getTableMetadata_IsCalledWithProperArguments_AdminShouldBeCalledProperly() throws ExecutionException {
// Arrange
GetTableMetadataRequest request = GetTableMetadataRequest.newBuilder().setNamespace("namespace").setTable("table").build();
@SuppressWarnings("unchecked") StreamObserver<GetTableMetadataResponse> responseObserver = mock(StreamObserver.class);
// Act
adminService.getTableMetadata(request, responseObserver);
// Assert
verify(admin).getTableMetadata(any(), any());
verify(responseObserver).onNext(any());
verify(responseObserver).onCompleted();
}
use of com.scalar.db.rpc.GetTableMetadataRequest in project scalardb by scalar-labs.
the class DistributedTransactionAdminServiceTest method getTableMetadata_IsCalledWithProperArguments_AdminShouldBeCalledProperly.
@Test
public void getTableMetadata_IsCalledWithProperArguments_AdminShouldBeCalledProperly() throws ExecutionException {
// Arrange
GetTableMetadataRequest request = GetTableMetadataRequest.newBuilder().setNamespace("namespace").setTable("table").build();
@SuppressWarnings("unchecked") StreamObserver<GetTableMetadataResponse> responseObserver = mock(StreamObserver.class);
TableMetadata tableMetadata = TableMetadata.newBuilder().addColumn("col1", DataType.INT).addColumn("col2", DataType.INT).addColumn("col3", DataType.TEXT).addPartitionKey("col1").addClusteringKey("col2").build();
when(admin.getTableMetadata("namespace", "table")).thenReturn(tableMetadata);
// Act
adminService.getTableMetadata(request, responseObserver);
// Assert
verify(admin).getTableMetadata(any(), any());
verify(responseObserver).onNext(GetTableMetadataResponse.newBuilder().setTableMetadata(ProtoUtils.toTableMetadata(tableMetadata)).build());
verify(responseObserver).onCompleted();
}
Aggregations