HdfsBlobStoreImpl { public BlobStoreFile write(String key, boolean create) throws IOException { return new HdfsBlobStoreFile(getKeyDir(key), true, create, _hadoopConf); } HdfsBlobStoreImpl(Path path, Map<String, Object> conf);  HdfsBlobStoreImpl(Path path, Map<String, Object> conf,
                             Configuration hconf); Iterator<String> listKeys(); BlobStoreFile read(String key); BlobStoreFile write(String key, boolean create); boolean exists(String key); void deleteKey(String key); void fullCleanup(long age); void shutdown(); final static FsPermission BLOBSTORE_DIR_PERMISSION; }
@Test public void testGetFileLength() throws IOException { FileSystem fs = dfscluster.getFileSystem(); Map conf = new HashMap(); String validKey = "validkeyBasic"; String testString = "testingblob"; TestHdfsBlobStoreImpl hbs = new TestHdfsBlobStoreImpl(blobDir, conf, hadoopConf); BlobStoreFile pfile = hbs.write(validKey, false); SettableBlobMeta meta = new SettableBlobMeta(); meta.set_replication_factor(1); pfile.setMetadata(meta); OutputStream ios = pfile.getOutputStream(); ios.write(testString.getBytes(Charset.forName("UTF-8"))); ios.close(); assertEquals(testString.getBytes(Charset.forName("UTF-8")).length, pfile.getFileLength()); }