DatanodeManager { public void sortLocatedBlocks(final String targetHost, final List<LocatedBlock> locatedBlocks) { Comparator<DatanodeInfo> comparator = avoidStaleDataNodesForRead ? new DFSUtil.ServiceAndStaleComparator(staleInterval) : new DFSUtil.ServiceComparator(); for (LocatedBlock lb : locatedBlocks) { if (lb.isStriped()) { sortLocatedStripedBlock(lb, comparator); } else { sortLocatedBlock(lb, targetHost, comparator); } } } DatanodeManager(final BlockManager blockManager, final Namesystem namesystem,
      final Configuration conf); NetworkTopology getNetworkTopology(); @VisibleForTesting DatanodeAdminManager getDatanodeAdminManager(); HostConfigManager getHostConfigManager(); @VisibleForTesting void setHeartbeatExpireInterval(long expiryMs); @VisibleForTesting FSClusterStats getFSClusterStats(); @VisibleForTesting int getBlockInvalidateLimit(); DatanodeStatistics getDatanodeStatistics(); void sortLocatedBlocks(final String targetHost,
      final List<LocatedBlock> locatedBlocks); DatanodeDescriptor getDatanodeByHost(final String host); DatanodeDescriptor getDatanodeByXferAddr(String host, int xferPort); Set<DatanodeDescriptor> getDatanodes(); Host2NodesMap getHost2DatanodeMap(); DatanodeDescriptor getDatanode(final String datanodeUuid); DatanodeDescriptor getDatanode(DatanodeID nodeID); DatanodeStorageInfo[] getDatanodeStorageInfos(
      DatanodeID[] datanodeID, String[] storageIDs,
      String format, Object... args); void removeDatanode(final DatanodeID node); HashMap<String, Integer> getDatanodesSoftwareVersions(); List<String> resolveNetworkLocation(List<String> names); void registerDatanode(DatanodeRegistration nodeReg); void refreshNodes(final Configuration conf); int getNumLiveDataNodes(); int getNumDeadDataNodes(); int getNumOfDataNodes(); List<DatanodeDescriptor> getDecommissioningNodes(); List<DatanodeDescriptor> getEnteringMaintenanceNodes(); boolean shouldAvoidStaleDataNodesForWrite(); long getBlocksPerPostponedMisreplicatedBlocksRescan(); long getHeartbeatInterval(); long getHeartbeatRecheckInterval(); int getNumStaleNodes(); int getNumStaleStorages(); void fetchDatanodes(final List<DatanodeDescriptor> live, 
      final List<DatanodeDescriptor> dead, final boolean removeDecommissionNode); List<DatanodeDescriptor> getDatanodeListForReport(
      final DatanodeReportType type); DatanodeCommand[] handleHeartbeat(DatanodeRegistration nodeReg,
      StorageReport[] reports, final String blockPoolId,
      long cacheCapacity, long cacheUsed, int xceiverCount, 
      int maxTransfers, int failedVolumes,
      VolumeFailureSummary volumeFailureSummary,
      @Nonnull SlowPeerReports slowPeers,
      @Nonnull SlowDiskReports slowDisks); void handleLifeline(DatanodeRegistration nodeReg,
      StorageReport[] reports, String blockPoolId, long cacheCapacity,
      long cacheUsed, int xceiverCount, int maxTransfers, int failedVolumes,
      VolumeFailureSummary volumeFailureSummary); void setBalancerBandwidth(long bandwidth); void markAllDatanodesStale(); void clearPendingQueues(); void resetLastCachingDirectiveSentTime(); @Override String toString(); void clearPendingCachingCommands(); void setShouldSendCachingCommands(boolean shouldSendCachingCommands); void setHeartbeatInterval(long intervalSeconds); void setHeartbeatRecheckInterval(int recheckInterval); String getSlowPeersReport(); @VisibleForTesting SlowDiskTracker getSlowDiskTracker(); String getSlowDisksReport(); DatanodeStorageReport[] getDatanodeStorageReport(
      DatanodeReportType type);  }
@Test public void testSortLocatedBlocks() throws IOException, URISyntaxException { HelperFunction(null, 0); }