@Test public void testGetTableForNormalRun() throws Exception { String dbName = "default"; String tableName = "tableName"; given(client.getTable(dbName, tableName)).willReturn(new Table()); assertTrue(service.getTable(dbName, tableName) != null); }
@Override @Cacheable(unless = "#result==null") public Table getTable(String dbName, String tableName) { Table result = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return null; } result = client.getTable(getUseDbName(dbName), tableName); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching table info : {}. {}", tableName, e); } return result; }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Table getTable(String dbName, String tableName) { Table result = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return null; } result = client.getTable(getUseDbName(dbName), tableName); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching table info : {}. {}", tableName, e); } return result; } }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Table getTable(String dbName, String tableName) { Table result = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return null; } result = client.getTable(getUseDbName(dbName), tableName); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching table info : {}. {}", tableName, e); } return result; } HiveMetaStoreServiceImpl(); }
HiveMetaStoreServiceImpl implements HiveMetaStoreService { @Override @Cacheable(unless = "#result==null") public Table getTable(String dbName, String tableName) { Table result = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return null; } result = client.getTable(getUseDbName(dbName), tableName); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching table info : {}. {}", tableName, e); } return result; } 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 Table getTable(String dbName, String tableName) { Table result = null; try { if (client == null) { LOGGER.warn("Hive client is null. " + "Please check your hive config."); return null; } result = client.getTable(getUseDbName(dbName), tableName); } catch (Exception e) { reconnect(); LOGGER.error("Exception fetching table info : {}. {}", tableName, e); } return result; } 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();  }