@Override public boolean tableExists(String tableString) throws IOException { return adm.tableExists(TableName.valueOf(tableString)); }
protected boolean tableExists(TableName table, Connection conn) throws IOException { try (Admin admin = conn.getAdmin()) { return admin.tableExists(table); } }
public static boolean isSecurityAvailable(Configuration conf) throws IOException { try (Connection conn = ConnectionFactory.createConnection(conf)) { try (Admin admin = conn.getAdmin()) { return admin.tableExists(AccessControlLists.ACL_TABLE_NAME); } } }
@Override public boolean evaluate() throws IOException { return conn.getAdmin().tableExists(QuotaUtil.QUOTA_TABLE_NAME); } });
@Override public void postStartMaster(ObserverContext<MasterCoprocessorEnvironment> ctx) throws IOException { try (Admin admin = ctx.getEnvironment().getConnection().getAdmin()) { if (!admin.tableExists(AccessControlLists.ACL_TABLE_NAME)) { createACLTable(admin); } else { this.aclTabAvailable = true; } } } /**
private void deleteTable() throws Exception { if (util.getAdmin().tableExists(TABLE_NAME)) { LOG.info("Deleting table"); util.deleteTable(TABLE_NAME); LOG.info("Deleted table"); } }
@Before public void beforeMethod() throws Exception { Admin admin = TEST_UTIL.getAdmin(); if (admin.tableExists(TABLE_NAME)) { TEST_UTIL.deleteTable(TABLE_NAME); } HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE)); htd.addFamily(new HColumnDescriptor(CFA)); htd.addFamily(new HColumnDescriptor(CFB)); admin.createTable(htd); }
@Test public void testTableExist() throws IOException { final TableName table = TableName.valueOf(name.getMethodName()); boolean exist; exist = this.admin.tableExists(table); assertEquals(false, exist); TEST_UTIL.createTable(table, HConstants.CATALOG_FAMILY); exist = this.admin.tableExists(table); assertEquals(true, exist); }
protected static Table openTable(TableName tableName) throws IOException { Table table = TEST_UTIL.getConnection().getTable(tableName); assertTrue("Fail to create the table", admin.tableExists(tableName)); return table; }
@Test public void testEnableReplicationWhenSlaveClusterDoesntHaveTable() throws Exception { admin1.disableTableReplication(tableName); admin2.disableTable(tableName); admin2.deleteTable(tableName); assertFalse(admin2.tableExists(tableName)); admin1.enableTableReplication(tableName); assertTrue(admin2.tableExists(tableName)); }
private void deleteTableIfNecessary() throws IOException { if (util.getAdmin().tableExists(getTablename())) { util.deleteTable(getTablename()); } }
@Test public void testDisableTableReplication() throws Exception { admin.disableTableRep(tableName); assertTrue(utility2.getAdmin().tableExists(tableName)); } }
@After public void tearDown() throws Exception { if (admin.tableExists(tableName)) { TEST_UTIL.deleteTable(tableName); } SnapshotTestingUtils.deleteAllSnapshots(admin); SnapshotTestingUtils.deleteArchiveDirectory(TEST_UTIL); } }
@Test public void createTableInSystemNamespace() throws Exception { final TableName tableName = TableName.valueOf("hbase:" + name.getMethodName()); HTableDescriptor desc = new HTableDescriptor(tableName); HColumnDescriptor colDesc = new HColumnDescriptor("cf1"); desc.addFamily(colDesc); admin.createTable(desc); assertEquals(0, admin.listTables().length); assertTrue(admin.tableExists(tableName)); admin.disableTable(desc.getTableName()); admin.deleteTable(desc.getTableName()); }
protected void deleteTable() throws Exception { if (util.getAdmin().tableExists(TABLE_NAME)) { LOG.info("Deleting table"); if (!util.getAdmin().isTableDisabled(TABLE_NAME)) { util.getAdmin().disableTable(TABLE_NAME); } util.getAdmin().deleteTable(TABLE_NAME); LOG.info("Deleted table"); } }
@Test public void testEnableTableReplication() throws Exception { admin.enableTableRep(tableName); assertTrue(utility2.getAdmin().tableExists(tableName)); }
private void checkTableIsIllegal(HTableDescriptor htd) throws IOException { Admin admin = TEST_UTIL.getAdmin(); try { admin.createTable(htd); fail(); } catch(Exception ex) { // should throw ex } assertFalse(admin.tableExists(htd.getTableName())); } }
private void checkTableIsLegal(HTableDescriptor htd) throws IOException { Admin admin = TEST_UTIL.getAdmin(); admin.createTable(htd); assertTrue(admin.tableExists(htd.getTableName())); TEST_UTIL.deleteTable(htd.getTableName()); }
@After public void clearQuotaTable() throws Exception { if (TEST_UTIL.getAdmin().tableExists(QuotaUtil.QUOTA_TABLE_NAME)) { TEST_UTIL.getAdmin().disableTable(QuotaUtil.QUOTA_TABLE_NAME); TEST_UTIL.getAdmin().truncateTable(QuotaUtil.QUOTA_TABLE_NAME, false); } }
@After public void tearDownAfterTest() throws IOException { Admin admin = TEST_UTIL.getAdmin(); if (admin.tableExists(TABLE_NAME)) { if (admin.isTableEnabled(TABLE_NAME)) { TEST_UTIL.getAdmin().disableTable(TABLE_NAME); } TEST_UTIL.getAdmin().deleteTable(TABLE_NAME); } LOCATOR.clearCache(TABLE_NAME); }