Source:
<code>public void testShrinkStatus() throws IOException { Configuration conf = getConfiguration(); MockFileSystem mockFs = (MockFileSystem) new Path("test:/ Path dir1 = new Path("test:/a1"); <START> RemoteIterator<LocatedFileStatus> statuses = mockFs.listLocatedStatus(dir1); <END> while (statuses.hasNext()) { LocatedFileStatus orig = statuses.next(); LocatedFileStatus shrink = (LocatedFileStatus)FileInputFormat.shrinkStatus(orig); Assert.assertTrue(orig.equals(shrink)); if (shrink.getBlockLocations() != null) { BlockLocation location = shrink.getBlockLocations()[0]; BlockLocation actual = orig.getBlockLocations()[0]; Assert.assertArrayEquals(actual.getHosts(), location.getHosts()); Assert.assertArrayEquals( actual.getCachedHosts(), location.getCachedHosts() ); Assert.assertArrayEquals( actual.getStorageIds(), location.getStorageIds() ); Assert.assertArrayEquals( actual.getStorageTypes(), location.getStorageTypes() ); Assert.assertArrayEquals( actual.getTopologyPaths(), location.getTopologyPaths() ); Assert.assertArrayEquals(actual.getNames(), location.getNames()); Assert.assertEquals(actual.getLength(), location.getLength()); Assert.assertEquals(actual.getOffset(), location.getOffset()); Assert.assertEquals(actual.isCorrupt(), location.isCorrupt()); } else { Assert.assertTrue(orig.getBlockLocations() == null); } } }</code><technical_language>This test test care in this change. MockFileSystem return a derived class of BlockLocation shrinks. This test passes if shrinkStatus simply returned original status, showing a useful test for verifying regress start caching large location statuses again</technical_language>

Target:
public void testShrinkStatus() throws IOException { Configuration conf = getConfiguration(); MockFileSystem mockFs = (MockFileSystem) new Path("test:/ Path dir1 = new Path("test:/a1"); RemoteIterator<LocatedFileStatus> statuses = mockFs.listLocatedStatus(dir1); boolean verified = false; while (statuses.hasNext()) { LocatedFileStatus orig = statuses.next(); LocatedFileStatus shrink = (LocatedFileStatus)FileInputFormat.shrinkStatus(orig); Assert.assertTrue(orig.equals(shrink)); if (shrink.getBlockLocations() != null) { Assert.assertEquals(orig.getBlockLocations().length, shrink.getBlockLocations().length); for (int i = 0; i < shrink.getBlockLocations().length; i++) { verified = true; BlockLocation location = shrink.getBlockLocations()[i]; BlockLocation actual = orig.getBlockLocations()[i]; Assert.assertNotNull(((HdfsBlockLocation)actual).getLocatedBlock()); Assert.assertEquals(BlockLocation.class.getName(), location.getClass().getName()); Assert.assertArrayEquals(actual.getHosts(), location.getHosts()); Assert.assertArrayEquals(actual.getCachedHosts(), location.getCachedHosts()); Assert.assertArrayEquals(actual.getStorageIds(), location.getStorageIds()); Assert.assertArrayEquals(actual.getStorageTypes(), location.getStorageTypes()); Assert.assertArrayEquals(actual.getTopologyPaths(), location.getTopologyPaths()); Assert.assertArrayEquals(actual.getNames(), location.getNames()); Assert.assertEquals(actual.getLength(), location.getLength()); Assert.assertEquals(actual.getOffset(), location.getOffset()); Assert.assertEquals(actual.isCorrupt(), location.isCorrupt()); } } else { Assert.assertTrue(orig.getBlockLocations() == null); } } Assert.assertTrue(verified); }