@Test public void dontThrowErrorWhenTableAlreadyDropped() throws TException { Mockito.doThrow(NoSuchObjectException.class).when(client).dropTable(DATABASE, TABLE_NAME); hiveClient.dropTable(DATABASE, TABLE_NAME); verify(client).dropTable(DATABASE, TABLE_NAME); }
@Override public void dropTable(String databaseName, String tableName) { if (dryRunEnabled) { log.info("Dry run - dropping table \"{}.{}\"", databaseName, tableName); } else { try { log.info("Dropping table \"{}.{}\"", databaseName, tableName); client.dropTable(databaseName, tableName); } catch (NoSuchObjectException e) { log.info("Could not drop table: table not found: \"{}.{}\"", databaseName, tableName); } catch (TException e) { throw new BeekeeperException( "Unexpected exception when dropping table: \"" + databaseName + "." + tableName + "\".", e); } } }
HiveClient implements CleanerClient { @Override public void dropTable(String databaseName, String tableName) { if (dryRunEnabled) { log.info("Dry run - dropping table \"{}.{}\"", databaseName, tableName); } else { try { log.info("Dropping table \"{}.{}\"", databaseName, tableName); client.dropTable(databaseName, tableName); } catch (NoSuchObjectException e) { log.info("Could not drop table: table not found: \"{}.{}\"", databaseName, tableName); } catch (TException e) { throw new BeekeeperException( "Unexpected exception when dropping table: \"" + databaseName + "." + tableName + "\".", e); } } } }
HiveClient implements CleanerClient { @Override public void dropTable(String databaseName, String tableName) { if (dryRunEnabled) { log.info("Dry run - dropping table \"{}.{}\"", databaseName, tableName); } else { try { log.info("Dropping table \"{}.{}\"", databaseName, tableName); client.dropTable(databaseName, tableName); } catch (NoSuchObjectException e) { log.info("Could not drop table: table not found: \"{}.{}\"", databaseName, tableName); } catch (TException e) { throw new BeekeeperException( "Unexpected exception when dropping table: \"" + databaseName + "." + tableName + "\".", e); } } } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); }
HiveClient implements CleanerClient { @Override public void dropTable(String databaseName, String tableName) { if (dryRunEnabled) { log.info("Dry run - dropping table \"{}.{}\"", databaseName, tableName); } else { try { log.info("Dropping table \"{}.{}\"", databaseName, tableName); client.dropTable(databaseName, tableName); } catch (NoSuchObjectException e) { log.info("Could not drop table: table not found: \"{}.{}\"", databaseName, tableName); } catch (TException e) { throw new BeekeeperException( "Unexpected exception when dropping table: \"" + databaseName + "." + tableName + "\".", e); } } } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); @Override void dropTable(String databaseName, String tableName); @Override boolean dropPartition(String databaseName, String tableName, String partitionName); @Override boolean tableExists(String databaseName, String tableName); @Override void close(); }
HiveClient implements CleanerClient { @Override public void dropTable(String databaseName, String tableName) { if (dryRunEnabled) { log.info("Dry run - dropping table \"{}.{}\"", databaseName, tableName); } else { try { log.info("Dropping table \"{}.{}\"", databaseName, tableName); client.dropTable(databaseName, tableName); } catch (NoSuchObjectException e) { log.info("Could not drop table: table not found: \"{}.{}\"", databaseName, tableName); } catch (TException e) { throw new BeekeeperException( "Unexpected exception when dropping table: \"" + databaseName + "." + tableName + "\".", e); } } } HiveClient(CloseableMetaStoreClient client, boolean dryRunEnabled); @Override void dropTable(String databaseName, String tableName); @Override boolean dropPartition(String databaseName, String tableName, String partitionName); @Override boolean tableExists(String databaseName, String tableName); @Override void close();  }