AbstractHDFSBundleHintProvider extends AbstractBundleHintProvider { @Override public Map<String, Object> getHintsOnCluster(Cluster cluster, SecurityContext securityContext, Subject subject) { Map<String, Object> hintMap = new HashMap<>(); try { HDFSMetadataService hdfsMetadataService = HDFSMetadataService.newInstance(environmentService, cluster.getId()); hintMap.put(getFieldNameForFSUrl(), hdfsMetadataService.getDefaultFsUrl()); } catch (ServiceNotFoundException e) { throw new IllegalStateException("Service " + Constants.HDFS.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();  }
@Test public void getHintsOnCluster() throws Exception { String expectedFsUrl = "hdfs: new Expectations() {{ hdfsMetadataService.getDefaultFsUrl(); result = expectedFsUrl; }}; Cluster cluster = new Cluster(); cluster.setId(1L); cluster.setName("cluster1"); Map<String, Object> hints = provider.getHintsOnCluster(cluster, null, null); Assert.assertEquals(1, hints.size()); Assert.assertEquals(expectedFsUrl, hints.get(TEST_FIELD_NAME_FS_URL)); }