use of co.cask.cdap.data2.util.hbase.HBaseTableUtil in project cdap by caskdata.
the class AbstractHBaseTableUtilTest method drop.
private void drop(TableId tableId) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName());
tableUtil.dropTable(ddlExecutor, hTableId);
}
use of co.cask.cdap.data2.util.hbase.HBaseTableUtil in project cdap by caskdata.
the class AbstractHBaseTableUtilTest method enable.
private void enable(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
TableName name = HTableNameConverter.toTableName(getPrefix(), hTableId);
ddlExecutor.enableTableIfDisabled(name.getNamespaceAsString(), name.getQualifierAsString());
}
use of co.cask.cdap.data2.util.hbase.HBaseTableUtil in project cdap by caskdata.
the class AbstractHBaseTableUtilTest method truncate.
private void truncate(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
tableUtil.truncateTable(ddlExecutor, hTableId);
}
use of co.cask.cdap.data2.util.hbase.HBaseTableUtil in project cdap by caskdata.
the class AbstractHBaseTableUtilTest method writeSome.
private void writeSome(String namespace, String tableName) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(namespace), tableName);
try (HTable table = tableUtil.createHTable(TEST_HBASE.getConfiguration(), hTableId)) {
// writing at least couple megs to reflect in "megabyte"-based metrics
for (int i = 0; i < 8; i++) {
Put put = new Put(Bytes.toBytes("row" + i));
put.add(Bytes.toBytes("d"), Bytes.toBytes("col" + i), new byte[1024 * 1024]);
table.put(put);
}
}
}
use of co.cask.cdap.data2.util.hbase.HBaseTableUtil in project cdap by caskdata.
the class AbstractHBaseTableUtilTest method create.
private void create(TableId tableId) throws IOException {
HBaseTableUtil tableUtil = getTableUtil();
TableId htableId = tableUtil.createHTableId(new NamespaceId(tableId.getNamespace()), tableId.getTableName());
ColumnFamilyDescriptorBuilder cfdBuilder = HBaseTableUtil.getColumnFamilyDescriptorBuilder("d", hAdmin.getConfiguration());
TableDescriptorBuilder tdBuilder = HBaseTableUtil.getTableDescriptorBuilder(htableId, cConf);
tdBuilder.addColumnFamily(cfdBuilder.build());
ddlExecutor.createTableIfNotExists(tdBuilder.build(), null);
}
Aggregations