SharedCacheClientImpl extends SharedCacheClient { @Override public String getFileChecksum(Path sourceFile) throws IOException { FileSystem fs = sourceFile.getFileSystem(this.conf); FSDataInputStream in = null; try { in = fs.open(sourceFile); return this.checksum.computeChecksum(in); } finally { if (in != null) { in.close(); } } } SharedCacheClientImpl(); @Override Path use(ApplicationId applicationId, String resourceKey); @Override void release(ApplicationId applicationId, String resourceKey); @Override String getFileChecksum(Path sourceFile);  }
@Test public void testChecksum() throws Exception { String filename = "test1.txt"; Path file = makeFile(filename); assertEquals(inputChecksumSHA256, client.getFileChecksum(file)); }
@Test(expected = FileNotFoundException.class) public void testNonexistantFileChecksum() throws Exception { Path file = new Path(TEST_ROOT_DIR, "non-existant-file"); client.getFileChecksum(file); }