@Test public void testGetAllTableNamesForNormalRun() throws MetaException { String dbName = "default"; given(client.getAllTables(dbName)).willReturn(Arrays.asList(dbName)); assertEquals(service.getAllTableNames(dbName).iterator().hasNext(), true); }
@Override @Cacheable(unless = "#result==null") public Iterable<String> getAllTableNames(String dbName) { Iterable<String> results = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return new ArrayList<>(); } results = client.getAllTables(getUseDbName(dbName)); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching tables info: {}", e); return null; } return results; }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Iterable<String> getAllTableNames(String dbName) { Iterable<String> results = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return new ArrayList<>(); } results = client.getAllTables(getUseDbName(dbName)); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching tables info: {}", e); return null; } return results; } }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Iterable<String> getAllTableNames(String dbName) { Iterable<String> results = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return new ArrayList<>(); } results = client.getAllTables(getUseDbName(dbName)); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching tables info: {}", e); return null; } return results; } HiveMetaStoreServiceImpl(); }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Iterable<String> getAllTableNames(String dbName) { Iterable<String> results = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return new ArrayList<>(); } results = client.getAllTables(getUseDbName(dbName)); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching tables info: {}", e); return null; } return results; } HiveMetaStoreServiceImpl(); void setClient(IMetaStoreClient client); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllDatabases(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllTableNames(String dbName); @Override @Cacheable(unless = "#result==null || #result.isEmpty()") List<Table> getAllTable(String db); @Override @Cacheable(unless = "#result==null || #result.isEmpty()") Map<String, List<String>> getAllTableNames(); @Override @Cacheable(unless = "#result==null") Map<String, List<Table>> getAllTable(); @Override @Cacheable(unless = "#result==null") Table getTable(String dbName, String tableName); @Scheduled(fixedRateString = "${cache.evict.hive.fixedRate.in.milliseconds}") @CacheEvict( cacheNames = "hive", allEntries = true, beforeInvocation = true) void evictHiveCache(); }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Iterable<String> getAllTableNames(String dbName) { Iterable<String> results = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return new ArrayList<>(); } results = client.getAllTables(getUseDbName(dbName)); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching tables info: {}", e); return null; } return results; } HiveMetaStoreServiceImpl(); void setClient(IMetaStoreClient client); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllDatabases(); @Override @Cacheable(unless = "#result==null") Iterable<String> getAllTableNames(String dbName); @Override @Cacheable(unless = "#result==null || #result.isEmpty()") List<Table> getAllTable(String db); @Override @Cacheable(unless = "#result==null || #result.isEmpty()") Map<String, List<String>> getAllTableNames(); @Override @Cacheable(unless = "#result==null") Map<String, List<Table>> getAllTable(); @Override @Cacheable(unless = "#result==null") Table getTable(String dbName, String tableName); @Scheduled(fixedRateString = "${cache.evict.hive.fixedRate.in.milliseconds}") @CacheEvict( cacheNames = "hive", allEntries = true, beforeInvocation = true) void evictHiveCache();  }