def test_filesystem(self): hfile = Hfile(hostname, port, path, mode='w') hfile.close() fs = Hfilesystem(hostname, port) self.assertTrue(fs.exists(path)) self.assertFalse(fs.exists(path + 'doesnotexist')) self.assertTrue(fs.rename(path, path + 'renamed')) self.assertTrue(fs.delete(path + 'renamed')) self.assertFalse(fs.delete(path))
def __init__(self, server, port, storage_directory, app_id): """Constructor. Args: server: HDFS server address port: HDFS listen port storage_directory: Directory within which to store blobs. app_id: App id to store blobs on behalf of. """ self._server = server self._port = port self._storage_directory = storage_directory self._app_id = app_id self._fs = Hfilesystem(self._server, self._port)
def test_mkdir(self): fs = Hfilesystem(hostname, port) self.assertTrue(fs.mkdir(path)) self.assertTrue(fs.delete(path))