MountTableResolver implements FileSubclusterResolver, StateStoreCache { public MountTable getMountPoint(final String path) throws IOException { verifyMountTable(); return findDeepest(RouterAdmin.normalizeFileSystemPath(path)); } @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 testGetMountPoint() throws IOException { MountTable mtEntry; mtEntry = mountTable.getMountPoint("/"); assertEquals("/", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user"); assertEquals("/user", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user/a"); assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user/a/"); assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user/a/11"); assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user/a1"); assertEquals("/user", mtEntry.getSourcePath()); }
@Test public void testGetMountPointOfConsecutiveSlashes() throws IOException { MountTable mtEntry; mtEntry = mountTable.getMountPoint(" assertEquals("/", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint(" assertEquals("/user", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user/a assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint(" assertEquals("/user/a", mtEntry.getSourcePath()); mtEntry = mountTable.getMountPoint("/user assertEquals("/user", mtEntry.getSourcePath()); }