MountTableResolver implements FileSubclusterResolver, StateStoreCache { @Override public List<String> getMountPoints(final String str) throws IOException { verifyMountTable(); final String path = RouterAdmin.normalizeFileSystemPath(str); Set<String> children = new TreeSet<>(); readLock.lock(); try { String from = path; String to = path + Character.MAX_VALUE; SortedMap<String, MountTable> subMap = this.tree.subMap(from, to); boolean exists = false; for (String subPath : subMap.keySet()) { String child = subPath; if (!path.equals(Path.SEPARATOR)) { int ini = path.length(); child = subPath.substring(ini); } if (child.isEmpty()) { exists = true; } else if (child.startsWith(Path.SEPARATOR)) { exists = true; child = child.substring(1); int fin = child.indexOf(Path.SEPARATOR); if (fin > -1) { child = child.substring(0, fin); } if (!child.isEmpty()) { children.add(child); } } } if (!exists) { return null; } return new LinkedList<>(children); } finally { readLock.unlock(); } } @VisibleForTesting  MountTableResolver(Configuration conf);  MountTableResolver(Configuration conf, Router routerService);  MountTableResolver(Configuration conf, StateStoreService store);  MountTableResolver(Configuration conf, Router routerService,
      StateStoreService store); void addEntry(final MountTable entry); void removeEntry(final String srcPath); @VisibleForTesting void refreshEntries(final Collection<MountTable> entries); @Override boolean loadCache(boolean force); void clear(); @Override PathLocation getDestinationForPath(final String path); PathLocation lookupLocation(final String str); MountTable getMountPoint(final String path); @Override List<String> getMountPoints(final String str); List<MountTable> getMounts(final String path); @Override String toString(); @Override String getDefaultNamespace(); @VisibleForTesting String getDefaultNameService(); @VisibleForTesting void setDefaultNameService(String defaultNameService); @VisibleForTesting boolean isDefaultNSEnable(); @VisibleForTesting void setDefaultNSEnable(boolean defaultNSRWEnable); @VisibleForTesting void setDisabled(boolean disable);  }
@Test public void testTrailingSlashInInputPath() throws IOException { getMountPoints(true); }
@Test public void testGetMountPoints() throws IOException { getMountPoints(false); }
@Test public void testSuccessiveSlashesInInputPath() throws IOException { List<String> mounts = mountTable.getMountPoints(" assertEquals(5, mounts.size()); compareLists(mounts, new String[] {"tmp", "user", "usr", "readonly", "multi"}); String path = " mounts = mountTable.getMountPoints(path); assertEquals(2, mounts.size()); compareLists(mounts, new String[] {"a", "b"}); path = "/user mounts = mountTable.getMountPoints(path); assertEquals(1, mounts.size()); compareLists(mounts, new String[] {"demo"}); }