HBaseBundleHintProvider extends AbstractBundleHintProvider { @Override public Map<String, Object> getHintsOnCluster(Cluster cluster, SecurityContext securityContext, Subject subject) { Map<String, Object> hintMap = new HashMap<>(); try (HBaseMetadataService hBaseMetadataService = HBaseMetadataService.newInstance(environmentService, cluster.getId(), securityContext, subject)) { hintMap.put(FIELD_NAME_TABLE, hBaseMetadataService.getHBaseTables().getTables()); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + Constants.HBase.SERVICE_NAME + " in cluster " + cluster.getName() + " not found but mapping information exists."); } catch (ServiceConfigurationNotFoundException e) { } catch (Exception e) { throw new RuntimeException(e); } return hintMap; }  @Override Map<String, Object> getHintsOnCluster(Cluster cluster, SecurityContext securityContext, Subject subject); @Override String getServiceName(); static final String FIELD_NAME_TABLE; }
@Ignore @Test public void testGetHintsOnCluster() throws Exception { List<String> tables = Lists.newArrayList("test1", "test2", "test3"); new Expectations() {{ hbaseMetadataService.getHBaseTables(); result = new Tables(tables); }}; Cluster cluster = new Cluster(); cluster.setId(1L); cluster.setName("cluster1"); Map<String, Object> hints = provider.getHintsOnCluster(cluster, null, null); Assert.assertNotNull(hints); Assert.assertEquals(1, hints.size()); Assert.assertEquals(tables, hints.get(HBaseBundleHintProvider.FIELD_NAME_TABLE)); new Verifications() {{ hbaseMetadataService.getHBaseTables(); }}; }