use of co.cask.cdap.data2.transaction.queue.hbase.coprocessor.ConsumerConfigCache in project cdap by caskdata.
the class HBaseQueueTest method verifyConsumerConfigIsDeleted.
@Override
protected void verifyConsumerConfigIsDeleted(QueueName... queueNames) throws Exception {
for (QueueName queueName : queueNames) {
// Either the config table doesn't exists, or the consumer config is empty for the given queue
try {
ConsumerConfigCache cache = getConsumerConfigCache(queueName);
cache.updateCache();
Assert.assertNull("for " + queueName, cache.getConsumerConfig(queueName.toBytes()));
} catch (TableNotFoundException e) {
// Expected.
}
}
}
use of co.cask.cdap.data2.transaction.queue.hbase.coprocessor.ConsumerConfigCache in project cdap by caskdata.
the class HBaseQueueTest method getConsumerConfigCache.
private ConsumerConfigCache getConsumerConfigCache(QueueName queueName) throws Exception {
String tableName = HBaseQueueAdmin.getConfigTableName();
TableId hTableId = tableUtil.createHTableId(new NamespaceId(queueName.getFirstComponent()), tableName);
try (HTable hTable = tableUtil.createHTable(hConf, hTableId)) {
HTableDescriptor htd = hTable.getTableDescriptor();
final TableName configTableName = htd.getTableName();
String prefix = htd.getValue(Constants.Dataset.TABLE_PREFIX);
CConfigurationReader cConfReader = new CConfigurationReader(hConf, HTableNameConverter.getSysConfigTablePrefix(prefix));
return TableNameAwareCacheSupplier.getSupplier(configTableName, cConfReader, new Supplier<TransactionVisibilityState>() {
@Override
public TransactionVisibilityState get() {
try {
return getTransactionManager().getSnapshot();
} catch (IOException e) {
throw Throwables.propagate(e);
}
}
}, new InputSupplier<HTableInterface>() {
@Override
public HTableInterface getInput() throws IOException {
return new HTable(hConf, configTableName);
}
}).get();
}
}
use of co.cask.cdap.data2.transaction.queue.hbase.coprocessor.ConsumerConfigCache in project cdap by caskdata.
the class HBaseQueueTest method verifyConsumerConfigExists.
@Override
protected void verifyConsumerConfigExists(QueueName... queueNames) throws Exception {
for (QueueName queueName : queueNames) {
ConsumerConfigCache cache = getConsumerConfigCache(queueName);
cache.updateCache();
Assert.assertNotNull("for " + queueName, cache.getConsumerConfig(queueName.toBytes()));
}
}
Aggregations