Search in sources :

Example 1 with FileLink

use of org.apache.hadoop.hbase.io.FileLink in project hbase by apache.

the class TestInputStreamBlockDistribution method itDerivesLocalityFromFileLinkInputStream.

@Test
public void itDerivesLocalityFromFileLinkInputStream() throws Exception {
    List<Path> files = new ArrayList<Path>();
    files.add(testPath);
    FileLink link = new FileLink(files);
    try (FSDataInputStream stream = link.open(fs)) {
        HDFSBlocksDistribution initial = new HDFSBlocksDistribution();
        InputStreamBlockDistribution test = new InputStreamBlockDistribution(stream, getMockedStoreFileInfo(initial, true));
        assertSame(initial, test.getHDFSBlockDistribution());
        test.setLastCachedAt(test.getCachePeriodMs() + 1);
        assertNotSame(initial, test.getHDFSBlockDistribution());
    }
}
Also used : Path(org.apache.hadoop.fs.Path) ArrayList(java.util.ArrayList) FileLink(org.apache.hadoop.hbase.io.FileLink) FSDataInputStream(org.apache.hadoop.fs.FSDataInputStream) HDFSBlocksDistribution(org.apache.hadoop.hbase.HDFSBlocksDistribution) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 FSDataInputStream (org.apache.hadoop.fs.FSDataInputStream)1 Path (org.apache.hadoop.fs.Path)1 HDFSBlocksDistribution (org.apache.hadoop.hbase.HDFSBlocksDistribution)1 FileLink (org.apache.hadoop.hbase.io.FileLink)1 Test (org.junit.Test)1