use of alluxio.client.file.MetadataCachingBaseFileSystem in project alluxio by Alluxio.
the class FuseShellTest method before.
@Before
public void before() throws Exception {
mConf.set(PropertyKey.USER_METADATA_CACHE_ENABLED, true);
ClientContext clientContext = ClientContext.create(mConf);
FileSystemContext fileContext = PowerMockito.mock(FileSystemContext.class);
mFileSystemMasterClient = new GetStatusFileSystemMasterClient();
when(fileContext.acquireMasterClientResource()).thenReturn(new CloseableResource<FileSystemMasterClient>(mFileSystemMasterClient) {
@Override
public void closeResource() {
// Noop.
}
});
when(fileContext.getClientContext()).thenReturn(clientContext);
when(fileContext.getClusterConf()).thenReturn(mConf);
when(fileContext.getPathConf(any())).thenReturn(mConf);
when(fileContext.getUriValidationEnabled()).thenReturn(true);
mFileSystem = new MetadataCachingBaseFileSystem(fileContext);
mFuseShell = new FuseShell(mFileSystem, mConf);
mFileStatusMap = new HashMap<>();
mFileStatusMap.put(FILE, FILE_STATUS);
mFileStatusMap.put(DIR, DIR_STATUS);
// Here metadata cache will have two contents.
mFileSystem.getStatus(FILE);
mFileSystem.getStatus(DIR);
// Remove from map, so the result will get from cache.
mFileStatusMap.remove(FILE);
mFileStatusMap.remove(DIR);
}
Aggregations