@Test public void testMismatchingChildComponent() { UfsStatus s = Mockito.mock(UfsStatus.class); when(s.getName()).thenReturn("name"); mThrown.expect(IllegalArgumentException.class); mCache.addStatus(new AlluxioURI("/notName"), s); }
@Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); }
UfsStatusCache { @Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); } }
UfsStatusCache { @Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); } UfsStatusCache(@Nullable ExecutorService prefetchExecutor); }
UfsStatusCache { @Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); } UfsStatusCache(@Nullable ExecutorService prefetchExecutor); @Nullable UfsStatus addStatus(AlluxioURI path, UfsStatus status); @Nullable Collection<UfsStatus> addChildren(AlluxioURI path, Collection<UfsStatus> children); @Nullable UfsStatus remove(AlluxioURI path); @Nullable UfsStatus getStatus(AlluxioURI path); @Nullable UfsStatus fetchStatusIfAbsent(AlluxioURI path, MountTable mountTable); @Nullable Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable,
      boolean useFallback); @Nullable Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable); @Nullable Collection<UfsStatus> getChildren(AlluxioURI path); @Nullable Future<Collection<UfsStatus>> prefetchChildren(AlluxioURI path, MountTable mountTable); void cancelAllPrefetch(); }
UfsStatusCache { @Nullable public UfsStatus addStatus(AlluxioURI path, UfsStatus status) { if (!path.getName().equals(status.getName())) { throw new IllegalArgumentException( String.format("path name %s does not match ufs status name %s", path.getName(), status.getName())); } return mStatuses.put(path, status); } UfsStatusCache(@Nullable ExecutorService prefetchExecutor); @Nullable UfsStatus addStatus(AlluxioURI path, UfsStatus status); @Nullable Collection<UfsStatus> addChildren(AlluxioURI path, Collection<UfsStatus> children); @Nullable UfsStatus remove(AlluxioURI path); @Nullable UfsStatus getStatus(AlluxioURI path); @Nullable UfsStatus fetchStatusIfAbsent(AlluxioURI path, MountTable mountTable); @Nullable Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable,
      boolean useFallback); @Nullable Collection<UfsStatus> fetchChildrenIfAbsent(AlluxioURI path, MountTable mountTable); @Nullable Collection<UfsStatus> getChildren(AlluxioURI path); @Nullable Future<Collection<UfsStatus>> prefetchChildren(AlluxioURI path, MountTable mountTable); void cancelAllPrefetch();  }