use of com.google.bigtable.admin.v2.TableName in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method snapshotTableExceptionTest2.
@Test
public void snapshotTableExceptionTest2() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableTableAdmin.addException(exception);
try {
TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
String cluster = "cluster872092154";
String snapshotId = "snapshotId-1113817601";
String description = "description-1724546052";
client.snapshotTableAsync(name, cluster, snapshotId, description).get();
Assert.fail("No exception raised");
} catch (ExecutionException e) {
Assert.assertEquals(InvalidArgumentException.class, e.getCause().getClass());
InvalidArgumentException apiException = ((InvalidArgumentException) e.getCause());
Assert.assertEquals(StatusCode.Code.INVALID_ARGUMENT, apiException.getStatusCode().getCode());
}
}
use of com.google.bigtable.admin.v2.TableName in project java-bigtable by googleapis.
the class BaseBigtableTableAdminClientTest method deleteTableExceptionTest.
@Test
public void deleteTableExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockBigtableTableAdmin.addException(exception);
try {
TableName name = TableName.of("[PROJECT]", "[INSTANCE]", "[TABLE]");
client.deleteTable(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.bigtable.admin.v2.TableName in project java-bigtable-hbase by googleapis.
the class BigtableAdminTest method testDeleteRowRangeByPrefixNonUtf8.
@Test
public void testDeleteRowRangeByPrefixNonUtf8() throws IOException, InterruptedException {
TableName tableName = TableName.valueOf(TABLE_ID);
ByteString expectedKey = ByteString.copyFrom(new byte[] { 0, 0, 0, (byte) 128 });
DropRowRangeRequest expectedRequest = DropRowRangeRequest.newBuilder().setName(TABLE_NAME).setRowKeyPrefix(expectedKey).build();
responseQueue.put(Empty.getDefaultInstance());
admin.deleteRowRangeByPrefix(tableName, expectedKey.toByteArray());
assertEquals(expectedRequest, requestQueue.take());
}
use of com.google.bigtable.admin.v2.TableName in project java-bigtable-hbase by googleapis.
the class TestBigtableAdmin method testDeleteRowRangeByPrefixNonUtf8.
@Test
public void testDeleteRowRangeByPrefixNonUtf8() throws IOException, InterruptedException {
TableName tableName = TableName.valueOf(TABLE_ID);
ByteString expectedKey = ByteString.copyFrom(new byte[] { 0, 0, 0, (byte) 128 });
DropRowRangeRequest expectedRequest = DropRowRangeRequest.newBuilder().setName(TABLE_NAME).setRowKeyPrefix(expectedKey).build();
responseQueue.put(Empty.getDefaultInstance());
admin.deleteRowRangeByPrefix(tableName, expectedKey.toByteArray());
assertEquals(expectedRequest, requestQueue.take());
}
use of com.google.bigtable.admin.v2.TableName in project beam by apache.
the class BigtableClientWrapper method deleteTable.
void deleteTable(String tableId) {
final String tableName = bigtableOptions.getInstanceName().toTableNameStr(tableId);
DeleteTableRequest.Builder deleteTableRequestBuilder = DeleteTableRequest.newBuilder().setName(tableName);
tableAdminClient.deleteTable(deleteTableRequestBuilder.build());
}
Aggregations