use of com.google.cloud.bigtable.grpc.BigtableTableAdminClient in project simple-bigtable by spotify.
the class BigtableMock method getMock.
public static Bigtable getMock(final String project, final String instance) {
final BigtableDataClient dataClient = Mockito.mock(BigtableDataClient.class);
final BigtableTableAdminClient tableAdminClient = Mockito.mock(BigtableTableAdminClient.class);
final BigtableSession session = Mockito.mock(BigtableSession.class);
try {
Mockito.when(session.getDataClient()).thenReturn(dataClient);
Mockito.when(session.getTableAdminClient()).thenReturn(tableAdminClient);
} catch (IOException e) {
throw new RuntimeException(e);
}
return new BigtableMock(session, project, instance);
}
use of com.google.cloud.bigtable.grpc.BigtableTableAdminClient in project simple-bigtable by spotify.
the class BigtableMock method getMock.
public static BigtableMock getMock() {
final BigtableDataClient dataClient = Mockito.mock(BigtableDataClient.class);
final BigtableTableAdminClient tableAdminClient = Mockito.mock(BigtableTableAdminClient.class);
final BigtableSession session = Mockito.mock(BigtableSession.class);
final BigtableOptions options = Mockito.mock(BigtableOptions.class);
try {
Mockito.when(session.getDataClient()).thenReturn(dataClient);
Mockito.when(session.getTableAdminClient()).thenReturn(tableAdminClient);
Mockito.when(session.getOptions()).thenReturn(options);
Mockito.when(options.getInstanceName()).thenReturn(new BigtableInstanceName(PROJECT_ID, INSTANCE_ID));
} catch (IOException e) {
throw new RuntimeException(e);
}
return new BigtableMock(session, PROJECT_ID, INSTANCE_ID);
}
Aggregations